/* Seat Booking — clean, RTL Hebrew interface */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #1e293b;
    --text-dim: #64748b;
    --primary: #1e3a8a;
    --primary-light: #3b82f6;
    --accent: #d4a017;
    --success: #16a34a;
    --warning: #ea580c;
    --danger: #dc2626;
    --border: #e2e8f0;
    --radius: 8px;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-2: #334155;
    --text: #f1f5f9;
    --text-dim: #94a3b8;
    --primary: #60a5fa;
    --primary-light: #93c5fd;
    --accent: #fbbf24;
    --success: #22c55e;
    --warning: #fb923c;
    --danger: #f87171;
    --border: #334155;
}

[data-theme="dark"] .warning-box {
    background: #422006;
    color: var(--text);
    border-right-color: var(--warning);
}
[data-theme="dark"] .rules-box {
    background: #422006;
    color: var(--text);
    border-right-color: var(--accent);
}
[data-theme="dark"] .info-box {
    background: #1e3a8a33;
    border-right-color: var(--primary);
}
[data-theme="dark"] .my-booking {
    background: var(--surface-2);
    border-right-color: var(--accent);
}
[data-theme="dark"] .add-form {
    background: var(--surface-2);
}
[data-theme="dark"] .modal-body {
    background: var(--surface-2);
}
[data-theme="dark"] .modal-checkbox {
    background: #422006;
    border-color: #fbbf24;
}
[data-theme="dark"] .day-header.weekend,
[data-theme="dark"] .calendar-table thead th {
    background: var(--surface-2);
}
[data-theme="dark"] .day-cell.booked {
    background: var(--bg);
    color: var(--text-dim);
}
[data-theme="dark"] .seat-name {
    background: var(--surface-2);
}
[data-theme="dark"] .btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Heebo", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.logo-icon {
    width: 28px;
    height: 28px;
    vertical-align: middle;
}
nav {
    display: flex;
    gap: 16px;
    align-items: center;
}
nav a, .nav-link {
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}
nav a:hover, .nav-link:hover { color: var(--primary); }
.user-name {
    color: var(--text);
    font-size: 0.9rem;
    padding: 4px 10px;
    background: var(--surface-2);
    border-radius: 20px;
}

.theme-toggle {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}
.theme-toggle:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: scale(1.05);
}

main { padding-bottom: 40px; min-height: 60vh; }

/* Headings */
h1 { color: var(--primary); font-size: 1.8rem; margin-bottom: 16px; }
h2 { color: var(--text); font-size: 1.3rem; margin: 24px 0 12px; }
h3 { color: var(--text); font-size: 1.05rem; margin-bottom: 8px; }

/* Boxes */
.info-box, .warning-box, .rules-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-right: 4px solid var(--primary);
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}
.warning-box {
    border-right-color: var(--warning);
    background: #fff7ed;
}
.rules-box {
    border-right-color: var(--accent);
    background: #fefce8;
}
.info-box ul, .rules-box ol {
    padding-right: 24px;
    margin-top: 8px;
}
.info-box li, .rules-box li {
    margin-bottom: 4px;
}

/* Login / Verify */
.login-wrap {
    display: flex;
    justify-content: center;
    padding: 30px 0;
}
.login-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.login-form h1 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 6px;
}
.login-form .subtitle {
    text-align: center;
    color: var(--text-dim);
    margin-bottom: 24px;
    font-size: 0.95rem;
}
.login-form label {
    display: block;
    margin-bottom: 16px;
    color: var(--text-dim);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.login-form input {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 1rem;
}
.login-form input:focus { outline: none; border-color: var(--primary); }
.login-form .btn-primary { width: 100%; margin-top: 8px; }
.login-form .hint {
    text-align: center;
    margin-top: 16px;
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger, .btn-book,
.btn-primary-sm, .btn-secondary-sm, .btn-danger-sm {
    padding: 9px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    transition: opacity 0.15s;
}
.btn-primary { background: var(--primary); color: white; display: inline-block; text-align: center; }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.85; }
.btn-book { background: var(--accent); color: white; padding: 6px 12px; font-size: 0.85rem; width: 100%; }
.btn-book:hover { opacity: 0.85; }
.btn-primary-sm, .btn-secondary-sm, .btn-danger-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}
.btn-primary-sm { background: var(--primary); color: white; }
.btn-secondary-sm { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-danger-sm { background: var(--danger); color: white; }

/* Bookings summary */
.bookings-summary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}
.my-bookings {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.my-booking {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--surface-2);
    border-radius: 6px;
    border-right: 3px solid var(--accent);
}
.my-booking .date { color: var(--text-dim); font-size: 0.9rem; margin-right: 8px; }
.empty-state { color: var(--text-dim); font-style: italic; }

/* Calendar */
.calendar-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    overflow-x: auto;
}
.calendar-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}
.calendar-table th, .calendar-table td {
    border: 1px solid var(--border);
    padding: 8px;
    text-align: center;
    vertical-align: middle;
}
.calendar-table thead th {
    background: var(--surface-2);
    font-weight: 600;
    color: var(--text);
}
.day-header.weekend {
    background: #fef3c7;
}
.day-name { font-size: 0.8rem; color: var(--text-dim); }
.day-date { font-weight: 700; }
.seat-name {
    background: var(--surface-2);
    font-weight: 600;
    text-align: right;
    padding-right: 12px;
    min-width: 120px;
}
.seat-name small { color: var(--text-dim); font-weight: normal; }
.day-cell {
    height: 80px;
    position: relative;
    padding: 4px;
}
.day-cell.available {
    background: #dcfce7;
}
.day-cell.booked {
    background: #fee2e2;
    color: var(--text-dim);
}
.day-cell.past {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}
[data-theme="dark"] .day-cell.available {
    background: #14532d;
}
[data-theme="dark"] .day-cell.booked {
    background: #7f1d1d;
    color: var(--text-dim);
}
[data-theme="dark"] .day-cell.past {
    background: #1f2937;
    color: #4b5563;
}
.booking-info {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 0.8rem;
    font-weight: 500;
}
.booked-by { color: var(--text-dim); }
.available-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--success);
    font-size: 0.75rem;
    font-weight: 600;
}
[data-theme="dark"] .available-hint {
    color: #86efac;
}
.past-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6b7280;
    font-size: 0.75rem;
    font-style: italic;
}
[data-theme="dark"] .past-hint {
    color: #6b7280;
}
.book-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
    height: 100%;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-dim);
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] { margin: 0; }

/* Admin */
.admin-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}
.add-form {
    background: var(--surface-2);
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 20px;
}
.add-form h3 { margin-bottom: 10px; }
.form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.form-row input[type="text"], .form-row input[type="email"] {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
    flex: 1;
    min-width: 180px;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th, .admin-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    text-align: right;
}
.admin-table th {
    background: var(--surface-2);
    font-weight: 600;
}
.admin-table tr.inactive { opacity: 0.5; }
.admin-table .actions { display: flex; gap: 6px; }
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge.active { background: #dcfce7; color: #166534; }
.badge.inactive { background: #fee2e2; color: #991b1b; }
.badge.admin { background: #dbeafe; color: #1e40af; }

/* Flashes */
.flashes { margin-bottom: 20px; }
.flash {
    padding: 12px 18px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-weight: 500;
}
.flash.success { background: #dcfce7; color: #166534; border-right: 4px solid var(--success); }
.flash.error { background: #fee2e2; color: #991b1b; border-right: 4px solid var(--danger); }

/* Footer */
footer {
    text-align: center;
    color: var(--text-dim);
    padding: 20px;
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}
.footer-credit {
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Mobile */
@media (max-width: 768px) {
    header .container { flex-direction: column; align-items: flex-start; }
    .form-row { flex-direction: column; align-items: stretch; }
    .form-row input { min-width: 100%; }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal h2 {
    color: var(--primary);
    font-size: 1.3rem;
    margin-bottom: 16px;
}
.modal-close {
    position: absolute;
    top: 12px;
    left: 12px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-dim);
    cursor: pointer;
    width: 32px;
    height: 32px;
    line-height: 1;
    padding: 0;
}
.modal-close:hover { color: var(--text); }
.modal-body {
    background: var(--surface-2);
    padding: 14px 18px;
    border-radius: 6px;
    margin-bottom: 18px;
}
.modal-detail {
    padding: 4px 0;
    color: var(--text);
}
.modal-detail strong {
    color: var(--text-dim);
    font-weight: 600;
    margin-left: 6px;
}
.modal-checkbox {
    display: flex;
    gap: 10px;
    padding: 14px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 18px;
    align-items: flex-start;
}
.modal-checkbox input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.modal-checkbox span {
    color: var(--text);
    line-height: 1.5;
}
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.modal-actions button[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}
