/* ============================================================
   layout.css - shell, header, footer, hero, admin shell
   ============================================================ */

/* Sticky footer shell */
.page-shell { display: flex; flex-direction: column; min-height: 100svh; }
.page-shell main { flex: 1 0 auto; }
.page-shell .footer { flex-shrink: 0; }

/* ---------- Top bar (public) ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    padding-top: env(safe-area-inset-top);
    background: rgba(11, 13, 18, 0.82);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid rgba(224, 35, 47, 0.35);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 30px rgba(0, 0, 0, 0.28);
    color: #eef0f4;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .topbar { background: rgba(11, 13, 18, 0.97); }
}
.topbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-block: 12px;
    gap: 14px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { height: 52px; width: auto; transition: transform var(--dur-2) var(--ease-spring); }
.brand:hover img { transform: rotate(-3deg) scale(1.05); }
.brand-name {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.topnav { display: flex; align-items: center; gap: 8px; }
.topnav a {
    color: #cdd1dc;
    font-weight: 600;
    font-size: var(--step--1);
    padding: 8px 14px;
    border-radius: var(--r-full);
    white-space: nowrap;
    transition: color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.topnav a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); text-decoration: none; }

/* ---------- Footer ---------- */
.footer {
    background: var(--black);
    color: #9aa0b2;
    padding-block: var(--sp-7);
    margin-top: var(--sp-7);
    font-size: var(--step--1);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.footer a { color: #c3c7d2; }
.footer a:hover { color: #fff; }
.footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-4); }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    background: var(--grad-dark);
    color: #eef0f4;
    padding-block: clamp(2.5rem, 1.5rem + 4vw, 5rem);
    border-bottom: 1px solid rgba(224, 35, 47, 0.35);
    overflow: hidden;
    isolation: isolate;
}
/* ambient glows */
.hero::before, .hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    z-index: -1;
    opacity: 0.5;
    pointer-events: none;
}
.hero::before { width: 460px; height: 460px; top: -140px; left: -80px; background: radial-gradient(circle, var(--red-glow), transparent 70%); }
.hero::after { width: 520px; height: 520px; bottom: -200px; right: -120px; background: radial-gradient(circle, var(--blue-glow), transparent 70%); }
.hero-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: clamp(1.5rem, 0.5rem + 4vw, 3.5rem);
    align-items: center;
}
.hero-copy {
    border-left: 2px solid rgba(255, 255, 255, 0.14);
    padding-left: clamp(1rem, 0.4rem + 2vw, 2.5rem);
}
.hero-copy p { font-size: var(--step-1); color: #cbd0dc; margin: 0; }
.hero h1 { color: #fff; margin-bottom: 0; }

.hero-logo-wrap { margin: 0; padding: 0; line-height: 0; }
.hero-logo-wrap:focus, .hero-logo-wrap:focus-visible { outline: none; }
.hero-logo {
    width: 100%;
    max-width: 480px;
    height: auto;
    filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.55));
    animation: pv-float 7s var(--ease-out) infinite;
}

/* ---------- Admin shell ---------- */
.admin { display: flex; min-height: 100svh; background: var(--paper); }
.admin-side {
    width: 244px;
    background: linear-gradient(180deg, #10131c 0%, var(--black) 100%);
    color: #c3c7d2;
    padding: var(--sp-5) 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100svh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}
.admin-side .brand { padding: 0 22px var(--sp-5); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.admin-side nav { display: flex; flex-direction: column; padding: var(--sp-4) 12px; gap: 3px; }
.admin-side nav a {
    color: #b3b8c6;
    padding: 11px 14px;
    font-weight: 600;
    font-size: var(--step--1);
    border-radius: var(--r-sm);
    position: relative;
    transition: color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.admin-side nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.admin-side nav a.active { color: #fff; background: linear-gradient(90deg, rgba(224, 35, 47, 0.22), rgba(224, 35, 47, 0.04)); }
.admin-side nav a.active::before {
    content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
    background: var(--red); border-radius: var(--r-full);
}
.admin-side form { padding: var(--sp-4) 22px; margin-top: auto; }
.admin-side .btn-signout { background: var(--red-dark); color: #fff; border: 1px solid var(--red-dark); }
.admin-side .btn-signout:hover { background: #8f1620; color: #fff; }

/* Fills common widths, centers on ultra-wide so tables never stretch absurdly
   and there is no asymmetric dead space. */
.admin-main { flex: 1; min-width: 0; max-width: 1600px; margin-inline: auto; padding: clamp(1.25rem, 0.5rem + 3vw, 2.5rem) clamp(1.25rem, 0.4rem + 3vw, 2.75rem); }
.admin-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-6); }

/* ---------- Bottom tab bar (mobile app-shell) ---------- */
.tabbar { display: none; }

@media (max-width: 768px) {
    /* Desktop chrome gives way to the fixed bottom tab bar. */
    .admin { display: block; }
    .admin-side { display: none; }
    .topnav { display: none; }

    .tabbar {
        position: fixed;
        inset: auto 0 0 0;
        z-index: var(--z-tabbar);
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        /* Solid (not translucent + blur) so iOS Safari never fades or drops the
           bar while scrolling - a known backdrop-filter-on-fixed rendering bug. */
        background: var(--chrome-solid);
        border-top: 1px solid var(--chrome-line);
        box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.28);
        padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
    }
    .tab {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 52px;
        padding: 4px 2px;
        background: none;
        border: 0;
        border-radius: var(--r-md);
        color: var(--tab-idle);
        font: inherit;
        text-decoration: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: color var(--dur-1) var(--ease-out);
    }
    .tab-ico {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 46px;
        height: 27px;
        border-radius: var(--r-full);
        transition: background-color var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
    }
    .tab-ico .nav-svg { width: 22px; height: 22px; }
    .tab-label { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.03em; }
    .tab:active .tab-ico { transform: scale(0.88); }
    .tab:hover, .tab:focus, .tab:visited { color: var(--tab-idle); text-decoration: none; }
    .tab.active, .tab.active:hover, .tab.active:focus { color: var(--tab-active); }
    .tab.active .tab-ico { background: var(--tab-active-bg); }
    .tab-badge {
        position: absolute;
        top: -2px;
        right: 4px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        border-radius: var(--r-full);
        background: var(--red);
        color: #fff;
        font-size: 0.6rem;
        font-weight: 800;
        line-height: 16px;
        text-align: center;
        box-shadow: 0 0 0 2px var(--chrome-solid);
    }

    /* Content clears the fixed bar (only layouts that opt in). */
    .admin-main.has-tabbar,
    .page-shell main.has-tabbar {
        padding-bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 620px) {
    .brand img { height: 40px; }
    .brand-name { font-size: 1.05rem; }
    .topbar .container { padding-block: 10px; }
    .hero-grid { grid-template-columns: 1fr; gap: var(--sp-4); text-align: center; }
    .hero-copy { border-left: none; padding-left: 0; border-top: 2px solid rgba(255, 255, 255, 0.12); padding-top: var(--sp-4); }
    .hero-logo { margin: 0 auto; max-width: 320px; }
    .footer .container { flex-direction: column; }
}
