/* Reset y base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #fafafa;
}

/* Layout */
header {
    background: #1a1a2e;
    padding: 1rem 2rem;
}

header nav {
    max-width: 1200px;
    margin: 0 auto;
}

header .logo {
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

footer {
    text-align: center;
    padding: 2rem;
    color: #888;
    font-size: 0.875rem;
}

/* Botones */
.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    background: #1a1a2e;
    color: #fff;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
}

.btn:hover {
    background: #16213e;
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-small {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

.ac-import-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.3rem;
}

.ac-import-btn {
    cursor: pointer;
    margin: 0;
}

.btn-disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-link {
    background: none;
    border: none;
    color: #1a1a2e;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.875rem;
}

/* Formularios */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

/* Grid de eventos */
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.event-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.event-card-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.event-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.event-card-placeholder {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.event-card-placeholder span {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
}

.event-card-body {
    padding: 1.5rem;
}

.event-card h2 {
    margin-bottom: 0.5rem;
}

.event-card p {
    margin-bottom: 0.25rem;
    color: #555;
}

.event-card .btn {
    margin-top: 1rem;
}

/* Detalle de evento */
.event-detail {
    max-width: 600px;
}

.event-detail-image {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.event-detail-image img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    display: block;
}

.event-info {
    margin: 1.5rem 0;
}

.purchase-form {
    margin-top: 1.5rem;
    max-width: 400px;
}

.attendee-row {
    display: flex;
    gap: 1rem;
}

.attendee-row .attendee-field {
    flex: 1;
}

.attendee-row .attendee-field label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.attendee-row .attendee-field input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.sold-out {
    font-size: 1.25rem;
    color: #dc3545;
    font-weight: 700;
    margin-top: 1rem;
}

/* Paginas de mensaje */
.message-page {
    text-align: center;
    padding: 3rem 0;
}

.message-page h1 {
    margin-bottom: 1rem;
}

.message-page p {
    margin-bottom: 0.5rem;
    color: #555;
}

.message-page .btn {
    margin-top: 1.5rem;
}

/* Admin */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-header div {
    display: flex;
    gap: 0.5rem;
}

.events-table,
.purchases-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.events-table th,
.events-table td,
.purchases-table th,
.purchases-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.events-table th,
.purchases-table th {
    background: #f5f5f5;
    font-weight: 600;
}

.actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-active, .status-paid { background: #d4edda; color: #155724; }
.status-paused { background: #fff3cd; color: #856404; }
.status-finished, .status-cancelled { background: #e2e3e5; color: #383d41; }
.status-used { background: #cce5ff; color: #004085; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
}

.stat-card h3 {
    font-size: 0.875rem;
    color: #888;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: #1a1a2e;
    border-radius: 4px;
}

/* Scanner */
.scanner-page {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.scanner-info {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.pin-display {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.5rem;
    font-family: monospace;
}

#reader {
    margin: 1rem auto;
    max-width: 400px;
}

#scan-result {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1.25rem;
    font-weight: 700;
}

#scan-result.valid {
    background: #d4edda;
    color: #155724;
}

#scan-result.invalid {
    background: #f8d7da;
    color: #721c24;
}

/* Login */
.login-form {
    max-width: 300px;
    margin: 1rem auto;
}

.error {
    color: #dc3545;
    margin-top: 0.5rem;
}

/* Admin - Image preview */
.image-preview {
    margin: 0.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    max-width: 400px;
}

.image-preview img {
    width: 100%;
    max-height: 250px;
    object-fit: cover;
    display: block;
}

.form-hint {
    font-size: 0.85rem;
    color: #888;
    margin: 0.25rem 0 0.5rem;
}

/* Ticket type rows (admin form) */
.ticket-type-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.ticket-type-row input[type="text"] {
    flex: 2;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.ticket-type-row input[type="number"] {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.btn-remove-type {
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-remove-type:hover {
    background: #c82333;
}

/* Ticket type selector (public event detail) */
.ticket-type-select {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.ticket-type-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.ticket-type-price {
    color: #555;
    font-size: 0.95rem;
}

.ticket-type-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ticket-type-controls input[type="number"] {
    width: 60px;
    padding: 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    text-align: center;
}

.ticket-type-avail {
    font-size: 0.8rem;
    color: #888;
    white-space: nowrap;
}

.sold-out-type {
    color: #dc3545;
    font-weight: 600;
    font-size: 0.9rem;
}
