/* ==========================================
   Hera-Style Topbar & Background
   Adapted from Project Hera theme
   ========================================== */

/* --- Montserrat Font --- */
@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/Montserrat-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/Montserrat-Bold.ttf') format('truetype');
}

/* --- CSS Variables --- */
:root {
    --bg-deep: #14100e;
    --gold: #c5a059;
    --gold-soft: #e6d4a8;
    --gold-dim: #8a7038;
    --teal-glow: rgba(45, 120, 115, .35);
    --topbar-h: 70px;
    --mobile-topbar-h: 56px;
    --font-ui: 'Montserrat', 'Nunito Sans', system-ui, sans-serif;
    --topbar-glass: rgba(18, 14, 12, .72);
    --topbar-ink: #c9b896;
}

/* --- Body Background Override --- */
html, body {
    min-height: 100%;
    background: var(--bg-deep) !important;
    color: #e8dcc4;
    font-family: var(--font-ui);
}
body {
    background-image:
        radial-gradient(ellipse 90% 50% at 50% -10%, var(--teal-glow), transparent 55%),
        radial-gradient(ellipse 70% 40% at 100% 80%, rgba(90, 70, 35, .18), transparent),
        linear-gradient(180deg, #0f0c0a 0%, #1a130f 40%, #0f0c0a 100%) !important;
}

/* --- Page Logo Banner (all pages except home) --- */
.page-logo-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem 1.5rem;
    position: relative;
}
.page-logo-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(400px, 60%);
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(197, 160, 89, .3), transparent);
}
.page-logo-banner__img {
    height: clamp(70px, 12vw, 120px);
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 20px rgba(197, 160, 89, .3));
    transition: filter .3s ease;
}
.page-logo-banner__img:hover {
    filter: drop-shadow(0 4px 28px rgba(197, 160, 89, .5));
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,.25); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* --- Desktop Topbar --- */
.site-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: var(--topbar-h);
    z-index: 1400;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1rem;
    padding: .4rem 1.25rem .4rem 1rem;
    background: linear-gradient(180deg, #181410 0%, #0e0c0a 100%);
    border-bottom: 1px solid rgba(197, 160, 89, .2);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .55);
}

.site-topbar__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.site-topbar__logo img {
    height: 55px;
    width: auto;
    max-width: min(320px, 42vw);
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 8px rgba(197, 160, 89, .25));
}

.site-topbar__center {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .6rem 1rem;
}

.site-topbar__nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .12rem;
    max-width: min(980px, calc(100vw - 360px));
    padding: .34rem .55rem .36rem;
    border-radius: 12px;
    background: linear-gradient(160deg, rgba(255, 255, 255, .045) 0%, rgba(0, 0, 0, .38) 100%);
    background-color: var(--topbar-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(197, 160, 89, .18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 3px 20px rgba(0, 0, 0, .4);
}

.site-topbar__nav-link {
    font-family: var(--font-ui);
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--topbar-ink);
    text-decoration: none;
    padding: .52rem .85rem;
    border-radius: 9px;
    border: 1px solid transparent;
    background: transparent;
    transition: color .22s ease, background .22s ease, border-color .22s ease, box-shadow .22s ease;
    position: relative;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    white-space: nowrap;
}
.site-topbar__nav-link::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: .32rem;
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    transform: translateX(-50%);
    transition: width .28s ease;
    opacity: .75;
}
.site-topbar__nav-link:hover {
    color: #f5efe4;
    background: rgba(197, 160, 89, .08);
    border-color: rgba(197, 160, 89, .14);
    box-shadow: none;
    text-decoration: none;
}
.site-topbar__nav-link:hover::after {
    width: calc(100% - 1.25rem);
}
.site-topbar__nav-link:focus-visible {
    outline: 2px solid rgba(230, 212, 168, .5);
    outline-offset: 3px;
}
.site-topbar__nav-link .fas,
.site-topbar__nav-link .far,
.site-topbar__nav-link .fab {
    font-size: .78rem;
    opacity: .75;
}

/* --- Dropdown inside topbar --- */
.site-topbar__dropdown {
    position: relative;
}
.site-topbar__dropdown-toggle {
    cursor: pointer;
}
.site-topbar__dropdown-toggle .fa-angle-down {
    font-size: .65rem;
    margin-left: .15rem;
    transition: transform .2s ease;
}
.site-topbar__dropdown.is-open .fa-angle-down {
    transform: rotate(180deg);
}
.site-topbar__dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 160px;
    padding: .35rem;
    border-radius: 10px;
    background: linear-gradient(180deg, #1e1814 0%, #14100e 100%);
    border: 1px solid rgba(197, 160, 89, .45);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .75), inset 0 0 0 1px rgba(255, 255, 255, .04);
    display: none;
    z-index: 1600;
}
.site-topbar__dropdown.is-open .site-topbar__dropdown-menu {
    display: block;
}
.site-topbar__dropdown-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .65rem;
    border-radius: 6px;
    text-decoration: none;
    color: #e8dcc4;
    font-size: .8rem;
    font-weight: 600;
    transition: background .15s, color .15s;
}
.site-topbar__dropdown-item:hover {
    background: rgba(197, 160, 89, .18);
    color: #fff;
    text-decoration: none;
}

/* --- Right Section (user area) --- */
.site-topbar__right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .55rem;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

/* --- CTA Pill Buttons (Login/Register/User) --- */
.topbar-cta-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: .48rem 1.1rem;
    text-align: center;
    font-family: var(--font-ui);
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 10px;
    transition: transform .25s ease, box-shadow .25s ease, filter .25s ease;
    white-space: nowrap;
}
.topbar-cta-pill--gold {
    color: #1c1612;
    background: linear-gradient(165deg, #f0e4c8 0%, #c5a059 42%, #9a7a3d 100%);
    border: 1px solid rgba(255, 255, 255, .35);
    box-shadow: 0 4px 18px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .45), 0 0 0 1px rgba(0, 0, 0, .2);
}
.topbar-cta-pill--gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(197, 160, 89, .22), inset 0 1px 0 rgba(255, 255, 255, .5);
    filter: brightness(1.05);
    text-decoration: none;
    color: #1c1612;
}
.topbar-cta-pill--outline {
    color: var(--gold-soft);
    background: rgba(0, 0, 0, .35);
    border: 1px solid rgba(197, 160, 89, .32);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.topbar-cta-pill--outline:hover {
    background: rgba(197, 160, 89, .12);
    border-color: var(--gold);
    color: #fff;
    text-decoration: none;
}
.topbar-cta-pill .fas {
    font-size: .72rem;
}

/* --- User Badge (cash display) --- */
.topbar-user-badge {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .38rem .75rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--gold-soft);
    background: rgba(0, 0, 0, .35);
    border: 1px solid rgba(197, 160, 89, .25);
    border-radius: 10px;
    text-decoration: none;
    transition: background .2s, border-color .2s;
}
.topbar-user-badge:hover {
    background: rgba(197, 160, 89, .1);
    border-color: rgba(197, 160, 89, .45);
    color: #fff;
    text-decoration: none;
}
.topbar-user-badge .fas {
    font-size: .72rem;
    opacity: .8;
}

/* ==========================================
   Mobile Topbar
   ========================================== */
#mobileHeader {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1500;
    background: linear-gradient(180deg, #1c1512 0%, #14100e 100%);
    border-bottom: 1px solid rgba(197, 160, 89, .35);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .6);
}

.mobile-topbar__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .35rem;
    min-height: 52px;
    padding: 6px 10px 6px 12px;
}
.mobile-topbar__row > a {
    flex-shrink: 0;
}
.mobile-topbar__row img {
    max-height: 40px;
    width: auto;
    max-width: min(120px, 32vw);
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 0 4px rgba(197, 160, 89, .35));
}

.mobile-topbar__nav {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .12rem;
    max-width: 100%;
    padding: .32rem .45rem .36rem;
    border-top: 1px solid rgba(197, 160, 89, .18);
    background: linear-gradient(180deg, rgba(255, 255, 255, .04) 0%, rgba(0, 0, 0, .32) 100%);
    background-color: rgba(18, 14, 12, .78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(197, 160, 89, .12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.mobile-topbar__nav.is-open {
    display: flex;
}

.mobile-topbar__nav-link {
    font-family: var(--font-ui);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--topbar-ink);
    text-decoration: none;
    padding: .44rem .52rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    transition: color .22s ease, background .22s ease, border-color .22s ease;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}
.mobile-topbar__nav-link:hover {
    color: #f5efe4;
    background: rgba(197, 160, 89, .09);
    border-color: rgba(197, 160, 89, .14);
    text-decoration: none;
}

/* Hamburger button */
#hamburgerBtn {
    flex-shrink: 0;
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 22px;
    cursor: pointer;
}
#hamburgerBtn span {
    display: block;
    height: 3px;
    width: 100%;
    background: var(--gold);
    border-radius: 2px;
    transition: .35s;
}
#hamburgerBtn.open span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}
#hamburgerBtn.open span:nth-child(2) {
    opacity: 0;
}
#hamburgerBtn.open span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ==========================================
   Content area offset for fixed topbar
   ========================================== */
body.hera-topbar-active {
    padding-top: var(--topbar-h);
}

/* ==========================================
   Footer override for dark theme
   ========================================== */
.footer-hera {
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .3));
    border-top: 1px solid rgba(197, 160, 89, .15);
    padding: 1.5rem 0;
}
.footer-hera .footer-card {
    background: rgba(20, 16, 12, .55);
    border: 1px solid rgba(197, 160, 89, .25);
    border-radius: 12px;
    padding: 1.5rem;
}
.footer-hera a {
    color: var(--topbar-ink);
    transition: color .2s;
}
.footer-hera a:hover {
    color: var(--gold-soft);
    text-decoration: none;
}
.footer-hera p, .footer-hera .text-gray {
    color: rgba(232, 220, 196, .6) !important;
}

/* ==========================================
   Responsive
   ========================================== */
@media (min-width: 901px) {
    .site-topbar { display: flex; }
    #mobileHeader { display: none !important; }
    body.hera-topbar-active { padding-top: var(--topbar-h); }
}
@media (max-width: 900px) {
    :root { --mobile-topbar-h: 56px; }
    body.hera-topbar-active { padding-top: var(--mobile-topbar-h) !important; }
    .site-topbar { display: none !important; }
    #mobileHeader { display: flex !important; }
}

/* ==========================================
   Override Neumorphism cards for dark theme
   ========================================== */
.bg-primary {
    background: transparent !important;
}
.card.bg-primary {
    background: rgba(20, 16, 12, .55) !important;
    border-color: rgba(197, 160, 89, .25) !important;
    color: #e8dcc4;
}
.shadow-soft {
    box-shadow: 0 4px 16px rgba(0, 0, 0, .3) !important;
}
.border-light {
    border-color: rgba(197, 160, 89, .2) !important;
}
.text-gray, .text-muted {
    color: rgba(232, 220, 196, .65) !important;
}

/* Dark theme table overrides */
.table {
    color: #e8dcc4;
}
.table thead th {
    border-color: rgba(197, 160, 89, .25);
    color: var(--gold-soft);
}
.table td, .table th {
    border-color: rgba(197, 160, 89, .12);
}

/* Dark theme form overrides */
.form-control, .custom-select {
    background: rgba(0, 0, 0, .35);
    border-color: rgba(197, 160, 89, .3);
    color: #e8dcc4;
}
.form-control:focus {
    background: rgba(0, 0, 0, .45);
    border-color: var(--gold);
    color: #e8dcc4;
    box-shadow: 0 0 0 .2rem rgba(197, 160, 89, .15);
}
.form-control::placeholder {
    color: rgba(197, 160, 89, .45);
}

/* Dark theme for alerts / badges */
.badge-primary, .btn-primary {
    background: linear-gradient(165deg, #c5a059, #9a7a3d) !important;
    color: #1c1612 !important;
    border-color: rgba(197, 160, 89, .5) !important;
}
.btn-primary:hover {
    filter: brightness(1.1);
}

/* ==========================================
   Ember Particles Overlay
   ========================================== */
.hera-embers-overlay,
.hera-embers-overlay * {
    pointer-events: none;
}
.hera-embers-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    overflow: hidden;
}
.hera-hero__ember {
    position: absolute;
    bottom: -5%;
    left: var(--hera-ember-x, 50%);
    width: var(--hera-ember-s, 5px);
    height: var(--hera-ember-s, 5px);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%,
        #fff8e8 0%,
        rgba(255, 200, 120, .95) 35%,
        rgba(197, 160, 89, .35) 70%,
        transparent 100%);
    box-shadow:
        0 0 11px rgba(255, 210, 140, .65),
        0 0 24px rgba(197, 160, 89, .34);
    opacity: 0;
    animation: hera-ember-rise var(--hera-ember-dur, 14s) ease-in infinite;
    animation-delay: var(--hera-ember-delay, 0s);
    animation-fill-mode: backwards;
    will-change: transform, opacity;
}
@keyframes hera-ember-rise {
    0%   { transform: translate3d(0, 0, 0) scale(.75); opacity: .5; }
    4%   { opacity: .6; }
    50%  { transform: translate3d(var(--hera-ember-drift, 12px), -50vh, 0) scale(1); opacity: .48; }
    100% { transform: translate3d(calc(var(--hera-ember-drift, 12px) * -.4), -118vh, 0) scale(.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .hera-hero__ember {
        animation: none;
        opacity: 0;
        display: none;
    }
}
.btn-secondary {
    background: rgba(0, 0, 0, .4) !important;
    border-color: rgba(197, 160, 89, .35) !important;
    color: var(--gold-soft) !important;
}
.btn-secondary:hover {
    background: rgba(197, 160, 89, .15) !important;
    border-color: var(--gold) !important;
    color: #fff !important;
}

/* Links in dark theme */
a {
    color: var(--gold);
}
a:hover {
    color: var(--gold-soft);
}

/* Nav pills/tabs dark override */
.nav-link {
    color: var(--topbar-ink);
}
.nav-link:hover {
    color: var(--gold-soft);
}
