/* ==========================================================================
   Fehérvár AV19 — brand theme
   Brand colors: white, black, dark blue (#0d47a1), light blue (#42a5f5).
   Mobile-first: base rules target small screens, larger layouts behind
   min-width media queries.
   ========================================================================== */

:root {
    --navy: #0d47a1;
    --navy-dark: #092f6b;
    --blue: #42a5f5;
    --blue-light: #e8f3fd;
    --black: #000000;
    --white: #ffffff;

    /* functional, non-brand colors — kept minimal, only for state feedback */
    --gray-50: #f6f7f9;
    --gray-200: #e2e5ea;
    --gray-400: #9aa2b1;
    --gray-700: #444a56;
    --error: #c62828;
    --error-bg: #fdecea;
    --success: #2e7d32;
    --success-bg: #eaf6ea;

    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    --max-width: 1100px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--black);
    background: var(--gray-50);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--navy); }
a:hover { color: var(--blue); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.6em; }

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

/* wider container for pages whose tables have many columns (users, partners,
   seatmap, reservations, ...) so PC users aren't stuck with a cramped table
   inside the standard content width; still shrinks to 100% on small screens */
.container--wide {
    max-width: 1500px;
}

/* --- header / nav ------------------------------------------------------- */

.site-header {
    background: var(--navy);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: var(--shadow);
}

.site-header__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--white);
    font-weight: 700;
    font-size: 1.1rem;
}

.brand__logo {
    height: 36px;
    width: auto;
}

.main-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
}

.main-nav a {
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    opacity: 0.92;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: opacity 0.15s, border-color 0.15s;
}

.main-nav a:hover { opacity: 1; text-decoration: none; border-color: rgba(255, 255, 255, 0.6); }

/* --- dropdown nav item (e.g. Parking -> Availability / Issue / Tickets) --- */

.nav-dropdown {
    position: relative;
}

.nav-dropdown__trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--white);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    opacity: 0.92;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: opacity 0.15s, border-color 0.15s;
}

.nav-dropdown__trigger::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    opacity: 0.8;
    transition: transform 0.15s;
}

.nav-dropdown:hover .nav-dropdown__trigger,
.nav-dropdown.is-open .nav-dropdown__trigger {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.6);
}

.nav-dropdown.is-open .nav-dropdown__trigger::after { transform: rotate(180deg); }

.nav-dropdown__menu {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 10px;
    padding: 6px;
    min-width: 200px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 30;
}

.nav-dropdown:hover .nav-dropdown__menu,
.nav-dropdown.is-open .nav-dropdown__menu {
    display: flex;
}

.nav-dropdown__menu a {
    color: var(--gray-700);
    opacity: 1;
    font-weight: 500;
    padding: 9px 12px;
    border-radius: 6px;
    border-bottom: none;
}

.nav-dropdown__menu a:hover {
    background: var(--blue-light);
    border-color: transparent;
}

.lang-switch select {
    background: var(--navy-dark);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 0.9rem;
}

/* --- QR code modal (fan dashboard: distraction-free view for gate scanning) --- */

.qr-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.qr-modal__inner {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.qr-modal__inner img {
    display: block;
    width: min(70vw, 70vh, 420px);
    height: auto;
}

.qr-modal__close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--navy);
    color: var(--white);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

/* --- impersonation bar ----------------------------------------------------- */

.impersonation-bar {
    background: var(--error);
    color: var(--white);
}

.impersonation-bar__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 8px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 0.9rem;
    text-align: center;
}

.impersonation-bar a {
    color: var(--white);
    text-decoration: underline;
    font-weight: 700;
}

/* --- main / footer ------------------------------------------------------- */

.site-main {
    flex: 1;
    padding: 24px 0 48px;
}

.site-footer {
    background: var(--black);
    color: var(--gray-200);
    font-size: 0.85rem;
}

.site-footer__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 14px 16px;
    text-align: center;
}

/* --- cards / panels ------------------------------------------------------ */

.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.card + .card { margin-top: 16px; }

/* --- stat tiles (dashboard) ------------------------------------------------ */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.stat-tile {
    background: var(--blue-light);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.stat-tile--warn {
    background: var(--error-bg);
}

.stat-tile__value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--navy);
}

.stat-tile--warn .stat-tile__value {
    color: var(--error);
}

.stat-tile__label {
    font-size: 0.82rem;
    color: var(--gray-700);
    margin-top: 4px;
}

/* --- forms ---------------------------------------------------------------- */

.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--gray-700);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"],
.field input[type="number"],
.field select,
.field textarea {
    width: 100%;
    padding: 11px 12px;
    font-size: 1rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--white);
    color: var(--black);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-light);
}

.field-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.9rem;
}

.field-checkbox input { margin-top: 3px; }

.field-error {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 4px;
}

.field-help {
    color: var(--gray-400);
    font-size: 0.82rem;
    margin-top: 4px;
}

/* honeypot field: present in the DOM but invisible/unreachable to real users */
.hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    height: 0;
    width: 0;
    overflow: hidden;
}

/* --- buttons --------------------------------------------------------------- */

.btn {
    display: inline-block;
    background: var(--navy);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.btn:hover { background: var(--navy-dark); color: var(--white); }

.btn-block { display: block; width: 100%; }

.btn-secondary {
    background: var(--white);
    color: var(--navy);
    border: 1px solid var(--navy);
}

.btn-secondary:hover { background: var(--blue-light); color: var(--navy); }

.btn-light {
    background: transparent;
    color: var(--navy);
    border: 1px dashed var(--gray-400);
}

/* --- alerts / flash messages ------------------------------------------------ */

.alert {
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.alert-error { background: var(--error-bg); color: var(--error); }
.alert-success { background: var(--success-bg); color: var(--success); }

/* --- auth pages (login / register / staff login) --------------------------- */

.auth-page {
    max-width: 480px;
    margin: 0 auto;
}

.auth-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: var(--max-width);
    margin: 0 auto;
}

.auth-grid .card { height: 100%; }

.auth-footer-actions {
    text-align: center;
    margin-top: 20px;
}

.code-display {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--navy);
    background: var(--blue-light);
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    margin: 12px 0;
}

@media (min-width: 900px) {
    .auth-grid {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

/* --- simple data table (used from Phase 2 onward) --------------------------- */

.table-wrap { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    font-size: 0.92rem;
}

table.data-table th,
table.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-200);
    text-align: left;
    white-space: nowrap;
}

table.data-table th {
    background: var(--gray-50);
    font-weight: 700;
}

.text-danger { color: var(--error); }

/* --- scanner ---------------------------------------------------------------- */

.mode-switch {
    display: flex;
    max-width: 420px;
    margin: 0 auto 16px;
    border: 1px solid var(--navy);
    border-radius: 8px;
    overflow: hidden;
}

.mode-switch__btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: var(--white);
    color: var(--navy);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
}

.mode-switch__btn--active {
    background: var(--navy);
    color: var(--white);
}

#reader {
    border-radius: var(--radius);
    overflow: hidden;
}

.scan-result {
    margin-top: 16px;
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}

.scan-result--ok {
    background: var(--success-bg);
    color: var(--success);
}

.scan-result--error {
    background: var(--error-bg);
    color: var(--error);
}

.scan-result__icon {
    font-size: 3.5rem;
    line-height: 1;
    font-weight: 700;
}

.scan-result__title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-top: 8px;
}

.scan-result__detail {
    margin-top: 6px;
    font-size: 0.95rem;
}

.scan-result__meta {
    margin-top: 10px;
    font-size: 0.85rem;
    opacity: 0.85;
}
.text-muted { color: var(--gray-400); }

.badge {
    display: inline-block;
    min-width: 18px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--blue);
    color: var(--white);
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.5;
}

.badge--alert {
    background: var(--error);
}

.nav-bell {
    position: relative;
    font-size: 1.1rem;
    text-decoration: none !important;
}

.nav-bell .badge {
    position: absolute;
    top: -8px;
    right: -10px;
}

/* --- icon buttons (edit/delete in lists) ------------------------------------ */

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--navy);
    cursor: pointer;
    text-decoration: none;
    vertical-align: middle;
}

.icon-btn:hover { background: var(--blue-light); }

.icon-btn--danger { color: var(--error); }
.icon-btn--danger:hover { background: var(--error-bg); }

.row-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    white-space: nowrap;
}

/* --- collapsible create/edit forms ------------------------------------------ */

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.collapsible-panel {
    margin-top: 16px;
}

/* --- responsive card tables: below the breakpoint, rows become stacked
       label:value cards instead of a horizontally-scrolling table -------- */

@media (max-width: 720px) {
    table.data-table.responsive-cards thead {
        position: absolute;
        width: 1px; height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
    table.data-table.responsive-cards,
    table.data-table.responsive-cards tbody,
    table.data-table.responsive-cards tr,
    table.data-table.responsive-cards td {
        display: block;
        width: 100%;
    }
    table.data-table.responsive-cards tr {
        margin-bottom: 12px;
        border: 1px solid var(--gray-200);
        border-radius: 8px;
        padding: 4px 0;
    }
    table.data-table.responsive-cards td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        white-space: normal;
        text-align: right;
        border-bottom: 1px solid var(--gray-50);
    }
    table.data-table.responsive-cards td:last-child { border-bottom: none; }
    table.data-table.responsive-cards td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--gray-700);
        text-align: left;
        margin-right: auto;
    }
    table.data-table.responsive-cards td:empty::before { content: none; }
    table.data-table.responsive-cards td[data-label=""]::before { content: none; }
}
