/* ============================================================
   Horse Nation – Game Stylesheet
   Nature-themed, earthy greens and warm tones
   ============================================================ */

:root {
    --hn-green-dark:  #2d5016;
    --hn-green:       #4a7c2f;
    --hn-green-light: #6aad3d;
    --hn-brown:       #7b4f2e;
    --hn-brown-light: #c49a6c;
    --hn-gold:        #d4a017;
    --hn-cream:       #f5f0e8;
    --hn-text:        #2c2416;
    --hn-border:      #c8b99a;
    --hn-sidebar-bg:  #3a6421;
    --hn-header-h:    56px;
    color-scheme: light;
}

/* ── Base ─────────────────────────────────────────────────── */
body {
    background-color: #e8e0d0;
    color: var(--hn-text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.88rem;
    min-height: 100vh;
}

a { color: var(--hn-green); text-decoration: none; }
a:hover { color: var(--hn-green-dark); text-decoration: underline; }

/* ── Header / Top Bar ─────────────────────────────────────── */
#hn-header {
    background: linear-gradient(135deg, var(--hn-green-dark) 0%, var(--hn-green) 60%, var(--hn-green-light) 100%);
    color: #fff;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--hn-header-h);
    display: flex;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0,0,0,.4);
}

#hn-header .hn-logo {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
    text-shadow: 1px 1px 3px rgba(0,0,0,.4);
    white-space: nowrap;
}
#hn-header .hn-logo:hover { color: var(--hn-gold); text-decoration: none; }

.hn-topbar-stat {
    background: rgba(0,0,0,.25);
    border-radius: 4px;
    padding: 2px 10px;
    font-size: 0.82rem;
    white-space: nowrap;
}
.hn-topbar-stat strong { color: var(--hn-gold); }

/* ── Banner ───────────────────────────────────────────────── */
#hn-banner {
    position: relative;
    width: 100%;
    height: 110px;
    overflow: visible;
    background:
        url('../images/banner-grass.png') bottom left / 800px 80px repeat-x,
        linear-gradient(to bottom,
            #3aace0  0%,
            #5cc8f5 65%,
            #48b21c 68%,
            #2f8a10 100%
        );
}
.hn-bhead {
    position: absolute;
    left: 24px;
    bottom: 6px;
    height: 88px;
    width: auto;
    transform: scaleX(-1);
}
.hn-btext {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    height: 90px;
    width: auto;
}
.hn-btext img { height: 90px; width: auto; display: block; }
.hn-bsil {
    position: absolute;
    right: 24px;
    bottom: 6px;
    height: 88px;
    width: auto;
}
#hn-banner a { line-height: 0; }

/* ── Layout Wrapper ───────────────────────────────────────── */
#hn-body {
    display: flex;
    min-height: calc(100vh - var(--hn-header-h));
}

/* ── Left Sidebar ─────────────────────────────────────────── */
#hn-sidebar-left {
    width: 160px;
    min-width: 160px;
    background: var(--hn-sidebar-bg);
    color: #dde;
    padding: 0.5rem 0;
    flex-shrink: 0;
}

.hn-nav-section {
    padding: 0.4rem 0.75rem 0.1rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--hn-brown-light);
    border-top: 1px solid rgba(255,255,255,.1);
    margin-top: 0.4rem;
}
.hn-nav-section:first-child { border-top: none; margin-top: 0; }

#hn-sidebar-left a {
    display: block;
    color: #cde;
    padding: 3px 0.75rem;
    font-size: 0.82rem;
    transition: background .15s, color .15s;
}
#hn-sidebar-left a:hover,
#hn-sidebar-left a.active {
    background: rgba(255,255,255,.12);
    color: #fff;
    text-decoration: none;
}

/* ── Center Content ───────────────────────────────────────── */
#hn-content {
    flex: 1;
    padding: 1rem;
    min-width: 0;
    background: var(--hn-cream);
}

/* ── Right Sidebar ────────────────────────────────────────── */
#hn-sidebar-right {
    width: 150px;
    min-width: 150px;
    background: #f0e8d6;
    border-left: 1px solid var(--hn-border);
    padding: 0.5rem 0;
    flex-shrink: 0;
}

.hn-action-section {
    padding: 0.4rem 0.75rem 0.1rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--hn-brown);
    border-top: 1px solid var(--hn-border);
    margin-top: 0.4rem;
}
.hn-action-section:first-child { border-top: none; margin-top: 0; }

#hn-sidebar-right a {
    display: block;
    color: var(--hn-green-dark);
    padding: 3px 0.75rem;
    font-size: 0.82rem;
    transition: background .15s;
}
#hn-sidebar-right a:hover {
    background: rgba(74,124,47,.12);
    text-decoration: none;
}

/* ── Page Cards ───────────────────────────────────────────── */
.hn-card {
    background: #fff;
    border: 1px solid var(--hn-border);
    border-radius: 6px;
    margin-bottom: 1rem;
    overflow: hidden;
}
.hn-card-header {
    background: var(--hn-green);
    color: #fff;
    padding: 0.4rem 0.75rem;
    font-weight: 700;
    font-size: 0.9rem;
}
.hn-card-body { padding: 0.75rem; }

/* ── Tables ───────────────────────────────────────────────── */
.hn-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.hn-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.hn-table th {
    background: #f0e8d6;
    color: var(--hn-brown);
    padding: 0.4rem 0.6rem;
    text-align: left;
    border-bottom: 2px solid var(--hn-border);
    font-weight: 600;
    white-space: nowrap;
}
.hn-table td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid #e8dfcf;
    vertical-align: middle;
}
.hn-table tr:last-child td { border-bottom: none; }
.hn-table tr:hover td { background: #f9f4ec; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-hn {
    background: var(--hn-green);
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 4px 12px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background .15s;
}
.btn-hn:hover { background: var(--hn-green-dark); color: #fff; }
.btn-hn-gold {
    background: var(--hn-gold);
    color: #fff;
}
.btn-hn-gold:hover { background: #b8870f; }
.btn-hn-sm { padding: 2px 8px; font-size: 0.78rem; }

/* ── Stat Bars ────────────────────────────────────────────── */
.stat-bar-wrap { min-width: 80px; }
.stat-bar {
    height: 8px;
    border-radius: 4px;
    background: #e0d8c8;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}
.stat-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .3s;
}
.stat-bar-fill.good    { background: #4a7c2f; }
.stat-bar-fill.ok      { background: #d4a017; }
.stat-bar-fill.bad     { background: #c0392b; }

/* ── Flash Messages ───────────────────────────────────────── */
.hn-flash {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}
.hn-flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.hn-flash-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.hn-flash-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ── Badge / Rarity ───────────────────────────────────────── */
.rarity-common    { color: #555; }
.rarity-uncommon  { color: #1a7abf; }
.rarity-rare      { color: #7b2fbe; }
.rarity-legendary { color: #c07a00; font-weight: 700; }
.badge-exclusive  {
    background: var(--hn-gold);
    color: #fff;
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 3px;
    vertical-align: middle;
}

/* ── Gender icons ─────────────────────────────────────────── */
.gender-male   { color: #5b8dd9; }
.gender-female { color: #c0396b; }

.gender-sym {
    font-size: 1.3em;
    line-height: 1;
    vertical-align: middle;
    -webkit-text-stroke: 0.6px currentColor;
    display: inline-block;
}

/* Keep gender labels white when shown on the green card header */
.hn-card-header .gender-male,
.hn-card-header .gender-female { color: #fff; opacity: .9; }

/* ── Progress XP bar ──────────────────────────────────────── */
.xp-bar {
    height: 12px;
    border-radius: 6px;
    background: #e0d8c8;
    overflow: hidden;
    position: relative;
}
.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--hn-green-light), var(--hn-green));
    border-radius: 6px;
    transition: width .4s;
}

/* ── Cooldown timer ───────────────────────────────────────── */
.cooldown-badge {
    background: #ffeaa7;
    color: #856404;
    font-size: 0.75rem;
    padding: 1px 6px;
    border-radius: 10px;
    border: 1px solid #ffc107;
}

/* ── Form inputs & selects ────────────────────────────────── */
select,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"] {
    background: #fff;
    color: var(--hn-text);
    border: 1px solid var(--hn-border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.85rem;
}
select { appearance: auto; }

/* ── Footer ───────────────────────────────────────────────── */
#hn-footer {
    background: var(--hn-green-dark);
    color: rgba(255,255,255,.6);
    text-align: center;
    font-size: 0.75rem;
    padding: 0.5rem;
}
#hn-footer a { color: rgba(255,255,255,.7); }

/* ── Auth pages ───────────────────────────────────────────── */
.auth-bg {
    min-height: 100vh;
    background: linear-gradient(160deg, var(--hn-green-dark) 0%, var(--hn-green) 50%, var(--hn-green-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.auth-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.3);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
}
.auth-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}
.auth-logo h1 {
    color: var(--hn-green-dark);
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0;
}
.auth-logo p { color: #777; font-size: 0.9rem; margin: 0.25rem 0 0; }

/* ── Mobile / Responsive ──────────────────────────────────── */
.hn-sidebar-mobile-only { display: none; }

@media (max-width: 991px) {
    #hn-sidebar-right { display: none; }
    .hn-sidebar-mobile-only { display: block; }
}

@media (max-width: 767px) {
    #hn-sidebar-left {
        position: fixed;
        left: -170px;
        top: var(--hn-header-h);
        bottom: 0;
        z-index: 1040;
        transition: left .25s ease;
        overflow-y: auto;
        width: 170px;
    }
    #hn-sidebar-left.open { left: 0; }
    #hn-body { flex-direction: column; }
    #hn-content { padding: 0.75rem; }
    .hn-topbar-stat { display: none; }
    .hn-topbar-stat.always-show { display: block; }
}

/* Shrink banner + horses on narrow viewports; both scale together so
   the bottom-anchored horses stay proportional to the centered logo text.
   Desktop baseline: banner 110px, logo 132px, horses 88px. */
@media (max-width: 540px) {
    #hn-banner { height: 88px; }
    .hn-bhead  { height: 60px; left: 24px; }
    .hn-bsil   { height: 60px; right: 24px; }
    .hn-btext  { height: 68px; }
    .hn-btext img { height: 68px; }
}
@media (max-width: 400px) {
    #hn-banner { height: 72px; }
    .hn-bhead  { height: 50px; left: 12px; }
    .hn-bsil   { height: 50px; right: 12px; }
    .hn-btext  { height: 56px; }
    .hn-btext img { height: 56px; }
}

/* ── Hamburger toggle ─────────────────────────────────────── */
#hn-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    padding: 0 0.5rem;
    cursor: pointer;
}
@media (max-width: 767px) { #hn-menu-toggle { display: block; } }

/* ── Roulette wheel visual ────────────────────────────────── */
.roulette-choice label {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    display: block;
    text-align: center;
    transition: border .15s, transform .1s;
}
.roulette-choice input:checked + label {
    border-color: var(--hn-green);
    transform: scale(1.05);
    font-weight: 700;
}
.choice-red   label { background: #fee2e2; color: #991b1b; }
.choice-black label { background: #1f2937; color: #fff; }
.choice-green label { background: #d1fae5; color: #065f46; }

/* ── Overlay for mobile sidebar ───────────────────────────── */
#hn-overlay {
    display: none;
    position: fixed;
    top: var(--hn-header-h); /* start below header so hamburger stays accessible */
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,.4);
    z-index: 1035;
}
@media (max-width: 767px) {
    #hn-overlay.active { display: block; }
}
