/* ══════════════════════════════════════════════════════
   Hall Booking Platform — Stylesheet (RTL & LTR safe)
   ══════════════════════════════════════════════════════ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #15803d;
    --danger: #dc2626;
    --warning: #92400e;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ── Navbar ── */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: relative;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    font-weight: 700;
    font-size: 1.2rem;
    text-decoration: none;
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text);
    font-size: 0.9rem;
}

.nav-links a:hover { color: var(--primary); }

.nav-user {
    color: var(--muted);
    font-size: 0.85rem;
}

/* ── Tenant badge ── */
.tenant-badge {
    padding: 0.5rem 2rem;
    background: #eff6ff;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--muted);
}

/* ── Container ── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ── Messages ── */
.messages {
    margin-bottom: 1.5rem;
}

.message {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.message.success { background: #dcfce7; border: 1px solid #86efac; }
.message.error { background: #fee2e2; border: 1px solid #fca5a5; }
.message.warning { background: #fef3c7; border: 1px solid #fcd34d; }
.message.info { background: #dbeafe; border: 1px solid #93c5fd; }

/* ── Home ── */
.home-hero {
    text-align: center;
    padding: 3rem 0;
}

.home-hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.home-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card-link {
    text-decoration: none;
    color: inherit;
}

.home-card {
    background: var(--card);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-align: center;
    transition: box-shadow 0.2s, transform 0.2s;
}

.home-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.home-card h3 { margin-bottom: 0.5rem; color: var(--primary); }

/* ── Hall grid ── */
.hall-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.hall-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.hall-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

.hall-thumb {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #e2e8f0;
}

.hall-thumb.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.hall-card-body { padding: 1rem; }
.hall-card-body h3 { margin-bottom: 0.25rem; }
.ar-name { color: var(--muted); }
.hall-type { font-size: 0.85rem; color: var(--muted); margin: 0.25rem 0; }
.hall-price { font-weight: 600; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-ok { background: #dcfce7; color: #15803d; }
.badge-off { background: #fee2e2; color: #b91c1c; }

.status-pending { background: #fef3c7; color: #92400e; }
.status-approved { background: #dbeafe; color: #1e40af; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-invoiced { background: #e0e7ff; color: #4338ca; }
.status-paid { background: #dcfce7; color: #15803d; }
.status-cancelled { background: #f1f5f9; color: #64748b; }

/* ── Tables ── */
.data-table, .info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.data-table th, .data-table td,
.info-table th, .info-table td {
    padding: 0.6rem 0.8rem;
    text-align: start;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #f1f5f9;
    font-weight: 600;
    font-size: 0.85rem;
}

.info-table th {
    width: 30%;
    color: var(--muted);
    font-weight: 600;
}

/* ── Forms ── */
.booking-form {
    max-width: 600px;
    margin: 1rem 0;
}

.form-field {
    margin-bottom: 1rem;
}

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

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: 2px solid var(--primary);
    border-color: var(--primary);
}

.field-errors { color: var(--danger); font-size: 0.85rem; }

fieldset {
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

legend { padding: 0 0.5rem; font-weight: 600; }

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: opacity 0.2s;
}

.btn:hover { opacity: 0.88; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.8rem; }

/* ── Hall detail ── */
.hall-main-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.hall-gallery {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hall-gallery img {
    width: 200px;
    height: 150px;
    object-fit: cover;
    border-radius: var(--radius);
}

.features-list { margin-block: 0.5rem 0; margin-inline: 1.5rem 0; }

/* ── Tenant cards ── */
.tenant-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.tenant-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    text-align: center;
    transition: box-shadow 0.2s;
}

.tenant-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

.tenant-logo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0.5rem;
}

.role-badge {
    display: inline-block;
    padding: 0.2rem 0.8rem;
    background: #dbeafe;
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.8rem;
    margin: 0.5rem 0;
}

.hint { color: var(--muted); font-size: 0.8rem; }

/* ── Manager actions ── */
.manager-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
}

/* ── Misc ── */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--muted);
}

.error-page {
    text-align: center;
    padding: 3rem;
}

.error-page h1 {
    font-size: 4rem;
    color: var(--danger);
}

.login-cta {
    text-align: center;
    padding: 1.5rem;
}

/* ── Footer ── */
.footer {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 2rem;
}

.developer-credit {
    margin-top: 0.4rem;
    font-weight: 600;
    color: var(--text);
}

/* Keyboard access, logical layout, and small screens; no external assets. */
body { min-height: 100vh; display: flex; flex-direction: column; }
.container { width: 100%; flex: 1; min-width: 0; }
a { color: var(--primary-dark); text-underline-offset: 0.15em; }
:focus-visible { outline: 3px solid var(--primary-dark); outline-offset: 3px; }
.skip-link { position: absolute; inset-inline-start: 1rem; top: -6rem; background: white; padding: 0.75rem; z-index: 200; }
.skip-link:focus { top: 0.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.navbar, .nav-links, .language-form, .manager-actions { flex-wrap: wrap; }
.navbar { gap: 1rem; }
.nav-links { gap: 0.75rem; }
.inline-form { display: inline-flex; }
.nav-button { border: 0; background: transparent; color: var(--text); cursor: pointer; font: inherit; }
.nav-button:hover { color: var(--primary-dark); text-decoration: underline; }
.nav-links a, .nav-button { padding-block: 0.5rem; }
.language-form { display: flex; gap: 0.5rem; align-items: center; }
.language-form select { max-width: 100%; padding: 0.5rem; border: 1px solid #94a3b8; border-radius: var(--radius); background: white; color: var(--text); }
input, select, textarea, button { font-family: inherit; }
.form-field input, .form-field select, .form-field textarea { border-color: #94a3b8; }
textarea { resize: vertical; }
.field-errors .errorlist { padding-inline-start: 1.25rem; }
.field-errors { margin-block: 0.5rem; color: #b91c1c; }
.btn { min-height: 44px; vertical-align: middle; }
.table-scroll { overflow-x: auto; max-width: 100%; margin-block: 1rem; }
.table-scroll .data-table { min-width: 640px; margin: 0; }
.auth-panel { max-width: 600px; margin-inline: auto; padding: 1.5rem; background: white; border: 1px solid var(--border); border-radius: var(--radius); }
.invoice-status { margin-block: 1.5rem; padding: 1rem; background: white; border: 1px solid var(--border); border-radius: var(--radius); }
.invoice-status h2 { font-size: 1.15rem; margin-block-end: 0.5rem; }
.tenant-card { cursor: default; }
.hall-card { display: block; }
.hall-gallery img { max-width: 100%; }
.info-table { table-layout: fixed; }
.info-table td, .info-table th { overflow-wrap: anywhere; }
.footer { overflow-wrap: anywhere; }
.home-cards, .hall-grid, .tenant-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
@media (max-width: 700px) {
    .navbar, .tenant-badge, .container { padding: 1rem; }
    .navbar { align-items: flex-start; flex-direction: column; }
    .nav-links { width: 100%; }
    .language-form { width: 100%; }
    .home-hero { padding-block: 1.5rem; }
    .home-hero h1 { font-size: 1.8rem; }
    .home-card, fieldset { padding: 1rem; }
    .info-table th { width: 38%; }
    .info-table th, .info-table td { padding: 0.5rem; }
    .empty-state, .error-page { padding: 1.5rem 0.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
    .home-card:hover { transform: none; }
}
