:root {
    --bg-color: #0A0A14;
    --text-main: #FFFFFF;
    --text-muted: #A0A0AB;
    --accent-color: #033e90;
    --accent-hover: #033e90;
    --card-bg: #1A1A24;
    --border-color: #2D2D3D;
    --success: #10B981;
    --error: #EF4444;
    --font-heading: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    --font-body: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    --focus-ring: 0 0 0 3px #FFD93D;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 600;
}

.heading {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.subtext {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.container {
    padding: 1.5rem;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.mt-20 {
    margin-top: 1.25rem;
}

.pb-80 {
    padding-bottom: 5rem;
}

.hide {
    display: none !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.1rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color) 0%, #4A90E2 100%);
    color: #FFF;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 25px rgba(3, 62, 144, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4A90E2 0%, var(--accent-color) 100%);
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(3, 62, 144, 0.5);
}

.btn:disabled,
.btn-primary:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-block {
    width: 100%;
    display: flex;
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0.5rem 0;
    font-family: var(--font-body);
}

/* Forms Integration */
#form-register {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    font-weight: 500;
}

input, select {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 1.1rem 1.25rem;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

input:focus, select:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: #4A90E2;
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.15);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23A0A0AB' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 1rem center;
    background-size: 1em;
    padding-left: 2.5rem;
}

select option {
    background-color: var(--card-bg);
    color: var(--text-main);
}

/* Toggle Switches */
.segmented {
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 0.35rem;
    gap: 0.35rem;
}

.btn-section, .btn-floor {
    flex: 1;
    padding: 0.85rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-body);
}

.btn-section:hover:not(:disabled), .btn-floor:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.btn-section.active, .btn-floor.active {
    background: linear-gradient(135deg, var(--accent-color), #4A90E2);
    color: #FFF;
    box-shadow: 0 4px 15px rgba(3, 62, 144, 0.4);
    transform: translateY(-1px);
}

/* Views */
.view {
    display: none;
    width: 100%;
    min-height: calc(100vh - 60px);
    animation: fadeIn 0.3s ease forwards;
}

.view.active {
    display: block;
}

.slide-up {
    animation: slideUp 0.4s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loaders */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 50vh auto 0;
    transform: translateY(-50%);
}

@keyframes spin {
    100% {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Events selection */
.event-card {
    display: block;
    width: 100%;
    text-align: inherit;
    color: inherit;
    font: inherit;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.event-card h3 {
    margin-bottom: 0.25rem;
}

.event-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.event-card.selected {
    border-color: #4A90E2;
    background: rgba(74, 144, 226, 0.08);
}

/* Sponsors header */
.app-header {
    background: var(--card-bg);
    padding: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
}

.app-header .event-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #7DB3F0;
}

.app-header .user-greeting {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Grid */
.sponsors-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

@media (min-width: 600px) {
    .sponsors-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.sponsor-card {
    border: none;
    width: 100%;
    background: #FFFFFF;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.sponsor-card img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sponsor-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(255, 217, 61, 0.2);
}

/* Vouchers */
.vouchers-header {
    padding: 1.5rem;
    background: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
}

.voucher-card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.voucher-img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 80vh;
    background: #111;
    object-fit: contain;
}

.voucher-content {
    padding: 1.25rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--border-color);
    color: var(--text-muted);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

.badge.redeemed {
    background: var(--success);
    color: #FFF;
}

.badge.gift {
    background: #3B82F6;
    color: #FFF;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.modal-content h3 {
    margin-bottom: 1rem;
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
}

.modal-actions button {
    flex: 1;
}

/* Toast */
#toast-container {
    position: fixed;
    top: 72px; /* below the fixed 60px top bar */
    left: 50%;
    transform: translateX(-50%);
    z-index: 2100;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background: var(--error);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 10px;
    text-align: center;
    font-weight: 500;
    font-family: var(--font-body);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

.toast.success {
    background: var(--success);
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- THEATER SEAT MAP --- */
.theater-grid {
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 1vw, 8px);
    align-items: center;
    width: 100%;
    margin: 0 auto;
    padding: 0;
}

.theater-row {
    display: flex;
    gap: clamp(2px, 1vw, 6px);
    width: 100%;
    align-items: center;
    justify-content: center;
}

.theater-row-label {
    flex: 0 0 20px;
    font-weight: bold;
    color: #9CA3AF;
    font-size: clamp(0.6rem, 2vw, 0.85rem);
    text-align: center;
}

.theater-seat, .theater-space {
    flex: 1;
    aspect-ratio: 1/1;
    max-width: 32px;
    max-height: 32px;
    border-radius: 4px;
    padding: 0;
    font-family: inherit;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(0.55rem, 2vw, 0.75rem);
    font-weight: 600;
    user-select: none;
}

.theater-seat {
    cursor: pointer;
    transition: all 0.2s ease;
    background: #1A1A24;
    color: #fff;
    border: 1px solid #2D2D3D;
}

.theater-seat.available {
    background: #10B981; /* Green */
    border: 1px solid #059669;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.theater-seat.available:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.theater-seat.taken {
    background: #EF4444 repeating-linear-gradient(45deg, transparent 0 3px, rgba(0, 0, 0, 0.35) 3px 5px); /* Red + stripes (not colour-only) */
    color: #FEE2E2;
    border: 1px solid #DC2626;
    cursor: not-allowed;
    opacity: 0.6;
}

.theater-seat.selected {
    background: #3B82F6; /* Blue */
    color: #fff;
    border: 2px solid #2563EB;
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.theater-space {
    visibility: hidden;
}

.theater-stage {
    width: 100%;
    min-width: 300px;
    background: linear-gradient(135deg, #1E1E2D, #2A2A40);
    color: #A0A0AB;
    padding: 10px 0;
    text-align: center;
    border-radius: 8px 8px 0 0;
    margin-bottom: 25px;
    font-weight: 700;
    letter-spacing: 2px;
    border: 2px solid rgba(255, 255, 255, 0.05);
    border-bottom: 4px solid var(--accent-color);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
}

/* --- GLOBAL FIXED HEADER --- */
.global-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(10, 10, 20, 0.85); /* Deep dark glass */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.global-top-bar h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #FFD700, #FBB034);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#app-container {
    padding-top: 60px; /* Push all views down below the global header */
}

/* Offset existing sticky headers to clear the new 60px global header */
.app-header, .vouchers-header {
    top: 60px;
}
/* --- Additions (v2) --- */
.form-group .label {
    display: block;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    font-weight: 500;
}

.btn-section:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

:focus-visible {
    outline: 3px solid #FFD93D;
    outline-offset: 2px;
}

input:focus-visible, select:focus-visible {
    outline: none; /* inputs already have a visible focus style */
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.seat-chip {
    display: inline-block;
    margin-inline-start: 0.5rem;
    padding: 0 0.5rem;
    border-radius: 999px;
    background: rgba(74, 144, 226, 0.15);
    color: #BFDBFE;
    font-size: 0.8rem;
}

.section-title {
    margin-top: 0.5rem;
}

.theater-map-scroll {
    overflow-x: auto;
    padding: 10px 0;
    direction: ltr;
    -webkit-overflow-scrolling: touch;
}

.seat-legend {
    list-style: none;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.seat-legend li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.seat-legend .theater-seat {
    width: 18px;
    height: 18px;
    flex: none;
    cursor: default;
    transform: none;
    opacity: 1;
}

.selected-seat {
    text-align: center;
    margin-top: 10px;
    font-weight: 700;
    color: var(--success);
}

.restore-box {
    margin-top: 1.5rem;
    text-align: center;
}

.btn-text.link {
    color: #7DB3F0;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.card-form {
    margin-top: 1rem;
    text-align: start;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1.5rem;
    border-radius: 16px;
}

.restore-seat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 0.75rem;
}

.spinner.small {
    margin: 3rem auto;
    transform: none;
    animation-name: spin-flat;
}

@keyframes spin-flat {
    100% { transform: rotate(360deg); }
}

.modal.hide {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
