/* =========================================================
   FarmSim Online – Light Mode Theme
   Bootstrap 5.3 base + custom overrides
   ========================================================= */

:root {
    /* Industrial Mining Palette */
    --copper:     #BF7001;
    --grey-olive: #8D8F91;
    --gold:       #E2CF42;
    --alabaster:  #DFE0DE;
    --black:      #ffffff;
    --stone:      #676257;
    --orange:     #E74600;
    --coffee:     #140702;
    --iron:       #444644;
    --yellow:     #FFC600;

    /* Semantic Mappings */
    --primary:    var(--copper);
    --primary-dark: var(--orange);
    --primary-lt: rgba(191, 112, 1, 0.1);
    --secondary:  var(--gold);
    --success:    var(--copper);
    --warning:    var(--yellow);
    --danger:     var(--orange);
    --info:       var(--grey-olive);
    
    --bg:         var(--alabaster);
    --surface:    #ffffff;
    --surface2:   #f1f1f1;
    --border:     var(--iron);
    --text:       var(--coffee);
    --muted:      var(--stone);
    
    --shadow-sm:  0 2px 4px rgba(20, 7, 2, 0.05);
    --shadow:     0 4px 12px rgba(20, 7, 2, 0.1);
    --shadow-md:  0 8px 24px rgba(20, 7, 2, 0.15);
    --radius:     12px;
}

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

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

img, svg, video, canvas {
    max-width: 100%;
    height: auto;
}

/* ── Typography ─────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--black);
}

/* ── Navbar ────────────────────────────────────────────── */
.navbar {
    background: rgba(223, 224, 222, 0.9) !important; /* Alabaster with transparency */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 2px solid var(--copper);
    padding: 0.5rem 0;
}
.top-nav {
    background: #0a0f1a !important;
    border-bottom: 1px solid rgba(251,191,36,0.1) !important;
    padding: 0.5rem 0 !important;
}
.top-nav-inner {
    gap: 1.5rem;
}
.top-nav-site-name {
    color: rgba(255,255,255,0.6);
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    margin-left: 0.5rem;
    display: none;
}
@media (min-width: 769px) {
    .top-nav-site-name {
        display: inline;
    }
}
.top-nav-brand img {
    filter: drop-shadow(0 3px 10px rgba(0,0,0,0.35));
    height: 24px;
    width: auto;
    display: block;
    transition: height 0.3s ease;
}

@media (max-width: 1200px) {
    .top-nav-brand img {
        height: 22px;
    }
}

@media (max-width: 768px) {
    .top-nav-brand img {
        height: 20px;
    }
}

@media (max-width: 480px) {
    .top-nav-brand img {
        height: 9px;
    }
}
.top-nav-toggle {
    background: rgba(255,255,255,0.08);
    padding: 8px 12px;
    border-radius: 10px;
    transition: all 0.3s ease;
}
.top-nav-toggle:hover {
    background: rgba(255,255,255,0.16);
    transform: scale(1.05);
}
.top-nav-status {
    flex: 1 1 auto;
    gap: 0.5rem !important;
}
.live-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}
.live-item:hover {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
}
.live-item i {
    font-size: 0.9rem;
}
.live-item-day i {
    color: #4ade80;
}
.live-item-time i {
    color: #60a5fa;
}
.live-item-weather i {
    color: #fbbf24;
}
.live-item-players i {
    color: #c4b5fd;
}
.top-nav-sep {
    display: none;
}
.top-nav-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: rgba(255,255,255,0.8);
    transition: all 0.2s ease;
    text-decoration: none;
}
.top-nav-user-btn:hover {
    color: #fff;
}
.top-nav-user {
    background: linear-gradient(135deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0.06) 100%);
    border: 1px solid rgba(255,255,255,0.18);
    color: #fff;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}
.top-nav-user:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.24) 0%, rgba(255,255,255,0.1) 100%);
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.top-nav-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border: 2px solid rgba(255,255,255,0.25);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(251,191,36,0.2);
    font-size: 12px;
}

.top-nav-user-btn:hover .top-nav-avatar {
    box-shadow: 0 4px 12px rgba(251,191,36,0.35);
    border-color: rgba(255,255,255,0.4);
}

.top-nav-user:hover .top-nav-avatar {
    box-shadow: 0 4px 12px rgba(251,191,36,0.35);
    border-color: rgba(255,255,255,0.4);
}
.top-nav-online {
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: #4ade80;
    border-radius: 50%;
    border: 2px solid #101726;
}
.top-nav-menu {
    background: linear-gradient(180deg, #1b2238 0%, #121826 100%);
    border: 1px solid rgba(255,255,255,0.1);
    min-width: 190px;
}
.top-nav-menu-item {
    color: rgba(255,255,255,0.85);
}
.top-nav-menu-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

/* ── Mobile/Responsive Improvements ──────────────────────── */
@media (max-width: 991px) {
    .navbar-toggler {
        display: block;
    }
    .navbar-brand {
        order: 2;
    }
    .d-flex.justify-content-end {
        order: 3;
    }
}

/* ── Live Dot in Nav ─────────────────────────────────────── */
.top-nav .live-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    box-shadow: 0 0 10px rgba(74,222,128,0.4);
    margin-right: 4px;
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 10px rgba(74,222,128,0.4); }
    50% { box-shadow: 0 0 20px rgba(74,222,128,0.6); }
}

/* ── Offcanvas / Mobile Nav ─────────────────────────────── */
#mobileNav.offcanvas {
    width: 85vw !important;
    max-width: 280px;
}
.navbar-brand img {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.nav-link {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--stone) !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s;
}
.nav-link:hover {
    color: var(--copper) !important;
}
.nav-link.active {
    color: var(--black) !important;
    background: var(--yellow);
    border-radius: 8px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: all 0.2s;
    border: 2px solid transparent;
}
.btn-landing-primary,
.btn-success,
.btn-primary {
    background: #ffc500 !important;
    color: #000 !important;
    border: 2px solid #ffc500 !important;
}
.btn-landing-primary:hover,
.btn-success:hover,
.btn-primary:hover {
    background: #000 !important;
    color: #ffc500 !important;
    border-color: #ffc500 !important;
    box-shadow: 0 0 20px rgba(255, 198, 0, 0.3);
    transform: translateY(-2px);
}
.btn-landing-outline {
    background: #000 !important;
    border: 2px solid #000 !important;
    color: #ffc500 !important;
}
.btn-landing-outline:hover {
    background: #ffc500 !important;
    color: #000 !important;
    border-color: #ffc500 !important;
}

/* ── Stat boxes & Pills ──────────────────────────────────── */
.stat-box, .stat-pill {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
}
.stat-box .val, .stat-pill .val {
    color: #ffffff !important;
}
.stat-box .lbl, .stat-pill .lbl {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
    border: 1px solid var(--iron);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.card-header {
    background: var(--iron);
    color: var(--alabaster);
    border-bottom: none;
}
.card-header h5 {
    color: var(--yellow) !important;
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.bg-success-subtle { background-color: var(--primary-lt) !important; color: var(--copper) !important; }
.bg-blue-lt { background-color: var(--grey-olive) !important; color: #fff !important; }

/* ── Progress ───────────────────────────────────────────── */
.progress { background: var(--iron); }
.text-success { color: var(--copper) !important; }
.bg-success   { background-color: var(--copper) !important; color: #fff !important; }
.text-warning { color: var(--yellow) !important; }
.bg-warning   { background-color: var(--yellow) !important; color: var(--black) !important; }
.text-danger  { color: var(--orange) !important; }
.bg-danger    { background-color: var(--orange) !important; color: #fff !important; }

/* ── Progress ───────────────────────────────────────────── */
.table th {
    background: var(--stone);
    color: var(--alabaster);
}
.table-hover tbody tr:hover {
    background-color: var(--primary-lt);
}

/* ── Modals ──────────────────────────────────────────────── */
.modal-content {
    background: rgba(223, 224, 222, 0.98); /* Alabaster with slight transparency */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 2px solid var(--copper);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
}

.modal-header {
    border-bottom: 1px solid var(--iron);
    padding: 1.5rem 2rem;
}

.modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(0); /* Black close button */
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    border-top: 1px solid var(--iron);
    padding: 1.5rem 2rem;
}

.modal-backdrop.show {
    opacity: 0.8;
    background-color: var(--black);
}

/* Modal Form Specifics */
.modal .form-control {
    background: var(--alabaster);
    border: 1px solid var(--iron);
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.modal .form-control:focus {
    border-color: var(--copper);
    box-shadow: 0 0 0 3px var(--primary-lt);
}

.modal .input-group-text {
    background: var(--alabaster);
    border: 1px solid var(--iron);
    border-right: none;
    color: var(--stone);
}

.modal .form-label {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--stone);
    margin-bottom: 0.5rem;
}

/* Modal Logo */
.modal-logo {
    max-height: 80px;
    margin-bottom: 1rem;
}

/* Mobile adjustments for modals */
@media (max-width: 576px) {
    .modal-body {
        padding: 1.5rem;
    }
}

.auth-page::before {
    background: linear-gradient(rgba(20, 7, 2, 0.8), rgba(20, 7, 2, 0.8)), url('/assets/images/site/background.jpg') center/cover no-repeat fixed;
}
.auth-card .card {
    background: rgba(223, 224, 222, 0.95);
    border: 2px solid var(--copper);
}


/* ── Badges ─────────────────────────────────────────────── */
.badge-crop   { background: var(--primary-lt); color: var(--copper); padding: 3px 9px; border-radius: 20px; font-size: .72rem; font-weight: 700; }
.badge-fallow { background: rgba(226, 207, 66, 0.1); color: var(--gold); padding: 3px 9px; border-radius: 20px; font-size: .72rem; font-weight: 700; }
.badge-mod-type {
    padding: 3px 9px; border-radius: 20px;
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.badge-vehicle  { background: var(--blue-lt);  color: var(--blue); }
.badge-placeable { background: var(--amber-lt); color: var(--amber); }
.badge-script   { background: #f3e8ff; color: #7c3aed; }

/* ── Weather badges ─────────────────────────────────────── */
.wb { display: inline-flex; align-items: center; gap: 5px; padding: 5px 14px; border-radius: 20px; font-size: .8rem; font-weight: 700; }
.wb-sun   { background: #fef9c3; color: #92400e; }
.wb-cloud { background: #f1f5f9; color: #475569; }
.wb-rain  { background: #dbeafe; color: #1d4ed8; }
.wb-snow  { background: #e0f2fe; color: #0369a1; }

/* ── Progress ───────────────────────────────────────────── */
.progress { background: var(--border); border-radius: 99px; }
.progress-bar { border-radius: 99px; }

/* ── Auth pages ─────────────────────────────────────────── */
.auth-card { max-width: 480px; margin: 4rem auto; }

@media (max-width: 768px) {
    .auth-card { margin: 2rem auto; }
    .auth-card .card-body { padding: 2rem !important; }
}

@media (max-width: 576px) {
    .auth-card { margin: 1.5rem auto; }
    .auth-card .card-body { padding: 1.5rem !important; }
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert-success { background: var(--primary-lt); border-color: var(--copper); color: var(--coffee); }
.alert-danger  { background: var(--red-lt);   border-color: #fecaca; color: #7f1d1d; }
.alert-warning { background: var(--amber-lt); border-color: #fde68a; color: #78350f; }
.alert-info    { background: var(--blue-lt);  border-color: #bfdbfe; color: #1e3a8a; }

/* ── Status indicators ───────────────────────────────────── */
.status-pending  { color: var(--yellow); }
.status-active   { color: var(--copper); }
.status-rejected { color: var(--orange); }

/* ── Option cards (register page) ───────────────────────── */
.option-card { cursor: pointer; }
.option-card input[type=radio] { display: none; }
.option-card .option-box {
    border: 2px solid var(--iron);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    transition: border-color .2s, background .2s;
    background: var(--surface);
}
.option-card input[type=radio]:checked + .option-box {
    border-color: var(--yellow);
    background: var(--primary-lt);
}
.option-card .option-box:hover { border-color: var(--yellow); }

/* ── Rules agreement ─────────────────────────────────────── */
.rules-agreement-box {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
}
.rules-agreement-box ol li + li { margin-top: .4rem; }

/* ── Mod image thumbnail ─────────────────────────────────── */
.mod-thumb {
    width: 56px; height: 56px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
}
.mod-thumb-sm {
    width: 36px; height: 36px;
    object-fit: contain;
    border-radius: 6px;
    background: var(--surface2);
    border: 1px solid var(--border);
}
.vehicle-img {
    width: 64px; height: 42px;
    object-fit: contain;
    border-radius: 6px;
    background: var(--surface2);
    border: 1px solid var(--border);
}

/* ── Mod showcase grid ───────────────────────────────────── */
.mod-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .85rem 1rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: .75rem;
    transition: box-shadow .2s, transform .15s;
    overflow: hidden;
}
.mod-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.mod-card-name { font-size: .8rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod-card-meta { font-size: .68rem; color: var(--muted); }

/* ── Farm color dot ──────────────────────────────────────── */
.farm-dot {
    width: 12px; height: 12px; border-radius: 50%;
    display: inline-block; flex-shrink: 0;
}

/* ── Section heading ─────────────────────────────────────── */
.section-heading {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 1rem;
}

/* ── Leaderboard rank badge ──────────────────────────────── */
.rank-badge {
    width: 28px; height: 28px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 800;
}
.rank-1 { background: #fef3c7; color: #92400e; }
.rank-2 { background: #f1f5f9; color: #475569; }
.rank-3 { background: #fef2f2; color: #92400e; }
.rank-n { background: var(--surface2); color: var(--muted); }

/* ── Scrollable containers ───────────────────────────────── */
.scroll-y { overflow-y: auto; }

/* ── Landing Page (index.php) ───────────────────────── */
.hero-landing {
    position: relative;
    height: 100vh;
    height: 100dvh; /* Modern mobile viewport unit */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    padding: 1.5rem;
    text-align: center;
    overflow: hidden;
}

.hero-landing::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('/assets/images/site/background.jpg') center/cover no-repeat fixed;
    filter: blur(4px) grayscale(40%);
    transform: scale(1.1); /* Prevents blur edges from showing */
    z-index: -1;
}

.glass-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    max-width: 480px;
    width: 100%;
    margin-bottom: 2rem;
}

.landing-logo {
    max-width: 380px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
}

.landing-subtitle {
    font-size: 1.1rem;
    font-weight: 400;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.landing-stats {
    width: 100%;
    max-width: 900px;
}

.stat-pill {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 0.75rem 1rem;
    transition: transform 0.2s, background 0.2s;
}

.stat-pill .val {
    font-size: 1.25rem;
    font-weight: 700;
}

@media (max-width: 768px) {
    .hero-landing {
        justify-content: flex-start;
        padding-top: 3rem;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }
    .landing-logo {
        max-width: 280px;
    }
    .glass-card {
        padding: 1.5rem;
        margin-bottom: 1.25rem;
    }
    .stat-pill .val {
        font-size: 1.1rem;
    }
}

.landing-btns .btn {
    padding: 0.75rem 2rem;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
}

/* ── Footer ──────────────────────────────────────────────── */

footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 4rem;
    padding: 1.25rem 0;
    color: var(--muted);
    font-size: .83rem;
}
footer .brand { color: var(--copper); font-weight: 700; }

/* ── Admin overrides ─────────────────────────────────────── */
.text-xs {
    font-size: 0.75rem;
}
.font-weight-bold {
    font-weight: 700 !important;
}

/* ── Responsive tweaks ───────────────────────────────────── */
@media (max-width: 576px) {
    .hero h1 { font-size: 1.5rem; }
    .stat-box .val { font-size: 1.4rem; }
    .mod-card { padding: .65rem .85rem; }
    .hero-landing { padding-top: 2rem; }
    .landing-logo { max-width: 220px; }
    .glass-card { padding: 1.1rem; margin-bottom: 1rem; }
    .landing-btns .btn {
        padding: 0.65rem 1.5rem;
        font-size: 0.82rem;
        letter-spacing: 0.04em;
    }
    .stat-pill { padding: 0.6rem 0.85rem; }
    .stat-pill .val { font-size: 1rem; }
}

/* ── Dashboard Polling & Utilities ───────────────────────── */
.text-blue { color: var(--grey-olive) !important; }
.bg-blue-lt { background-color: rgba(141, 143, 145, 0.15) !important; }

@keyframes poll-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.poll-flash { animation: poll-flash 0.6s ease; }

#last-updated {
    font-size: 0.75rem;
    color: var(--muted);
}

.animate__spin {
    animation: spin 1s linear infinite !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
