/* ===================================================
   site.css — Global + Sidebar + Dark Mode
   =================================================== */

html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 16px; } }

html { position: relative; min-height: 100%; }
body { margin-bottom: 60px; background: #f8f9fa; color: #212529; transition: background .3s, color .3s; }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed; top: 0; left: -260px; width: 260px; height: 100vh;
    background-color: #212529; transition: all .4s ease; z-index: 1050;
    padding-top: 70px; box-shadow: 2px 0 10px rgba(0,0,0,.5); border-right: 1px solid #343a40;
}
.sidebar.show { left: 0; }
.sidebar-menu li { border-bottom: 1px solid #343a40; }
.sidebar-menu a {
    display: flex; align-items: center; padding: 15px 20px; color: #ced4da;
    text-decoration: none; font-size: 1rem; transition: background .3s, color .3s;
}
.sidebar-menu a i { width: 25px; }
.sidebar-menu a:hover { background-color: #343a40; color: #fff; }

.sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: rgba(0,0,0,.4); z-index: 1040; display: none; transition: all .3s;
}
.sidebar-overlay.show { display: block; }

.hamburger-btn {
    position: fixed; top: 15px; left: 15px; z-index: 1060;
    background-color: #212529; border: none; border-radius: .375rem;
    width: 48px; height: 48px; color: #fff;
    display: flex; align-items: center; justify-content: center;
    transition: background .3s, left .4s; box-shadow: 0 4px 8px rgba(0,0,0,.3);
}
.hamburger-btn:hover { background-color: #343a40; }
.hamburger-btn.open { left: 275px; }
.hamburger-icon { width: 24px; height: 18px; position: relative; display: flex; flex-direction: column; justify-content: space-between; }
.hamburger-icon span { display: block; height: 3px; background-color: white; border-radius: 2px; transition: all .3s; }
.hamburger-btn.open .hamburger-icon span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.hamburger-btn.open .hamburger-icon span:nth-child(2) { opacity: 0; }
.hamburger-btn.open .hamburger-icon span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

/* Submenu */
.sidebar-submenu { list-style: none; padding: 0; margin: 0; overflow: hidden; max-height: 0; transition: max-height .35s; }
.sidebar-submenu.open { max-height: 300px; }
.sidebar-submenu li { border-bottom: 1px solid #2a2f35; }
.sidebar-submenu a { padding: 12px 20px 12px 44px; font-size: .875rem; color: #adb5bd; }
.sidebar-submenu a:hover { background-color: #2d3238; color: #fff; }
.sidebar-submenu a.active-link, .sidebar-menu a.active-link { color: #4d9eff; background-color: #1a2236; }
.submenu-arrow { margin-left: auto; transition: transform .3s; font-size: .75rem; }
.submenu-toggle.open .submenu-arrow { transform: rotate(180deg); }

/* Theme toggle in sidebar */
.sidebar-theme-toggle {
    display: flex; align-items: center; padding: 15px 20px; color: #ced4da;
    font-size: .875rem; cursor: pointer; border-bottom: 1px solid #343a40;
    transition: background .3s, color .3s; user-select: none;
}
.sidebar-theme-toggle:hover { background-color: #343a40; color: #fff; }
.sidebar-theme-toggle i { width: 25px; }

/* Footer */
.footer { transition: background .3s, color .3s, border-color .3s; }

/* ============================================
   DARK MODE GLOBAL (.dark-mode on body)
   ============================================ */
body.dark-mode {
    background: #0d1117 !important;
    color: #e6edf3;
    --bs-body-bg: #0d1117;
    --bs-body-color: #e6edf3;
    --bs-card-bg: #161b22;
    --bs-card-border-color: #30363d;
    --bs-border-color: #30363d;
    color-scheme: dark;
}

/* Footer dark */
body.dark-mode .footer { background: #161b22 !important; border-color: #30363d !important; color: #8b949e !important; }
body.dark-mode .footer .container { color: #8b949e; }

/* Container bg kill */
body.dark-mode .main-content { background: transparent; }

/* Common form controls in dark */
body.dark-mode .form-control,
body.dark-mode .form-select {
    background: #2d333b !important; border-color: #30363d !important;
    color: #e6edf3 !important;
}
body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
    background: #2d333b !important; border-color: #0d6efd !important;
    color: #e6edf3 !important; box-shadow: 0 0 0 3px rgba(13,110,253,.25);
}
body.dark-mode .form-control::placeholder { color: #6e7681 !important; }
body.dark-mode .form-select option { background: #2d333b; }
body.dark-mode .form-label { color: #c9d1d9 !important; }
body.dark-mode .input-group-text {
    background: #21262d !important; border-color: #30363d !important; color: #8b949e !important;
}
body.dark-mode .form-check-input { background-color: #21262d; border-color: #30363d; }
body.dark-mode .form-check-input:checked { background-color: #0d6efd; border-color: #0d6efd; }

/* Links & text */
body.dark-mode a { color: #79c0ff; }
body.dark-mode .text-muted { color: #8b949e !important; }
body.dark-mode .text-primary { color: #79c0ff !important; }

/* Generic cards */
body.dark-mode .card,
body.dark-mode .card-body,
body.dark-mode .card-header {
    background-color: #161b22 !important;
    --bs-card-bg: #161b22;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

/* Tables */
body.dark-mode .table {
    color: #c9d1d9 !important; --bs-table-bg: transparent;
    --bs-table-color: #c9d1d9; --bs-table-border-color: #21262d;
}
body.dark-mode .table-dark, body.dark-mode .table-dark th,
body.dark-mode thead.table-dark th {
    background-color: #161b22 !important; --bs-table-bg: #161b22;
    color: #8b949e !important; border-bottom-color: #30363d !important;
}
body.dark-mode .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(30,37,48,.5) !important;
    --bs-table-bg-type: transparent !important;
    --bs-table-accent-bg: transparent !important;
    color: #c9d1d9 !important;
}
body.dark-mode .table-striped > tbody > tr:nth-of-type(even) > * {
    background-color: transparent !important;
    --bs-table-bg-type: transparent !important;
    color: #c9d1d9 !important;
}
body.dark-mode .table td, body.dark-mode .table th { border-color: #21262d !important; }
body.dark-mode .table tbody tr:hover td { background-color: rgba(13,110,253,.06) !important; }

/* Badges */
body.dark-mode .badge.bg-light { background: #21262d !important; color: #79c0ff !important; border: 1px solid #30363d; }
body.dark-mode .badge.bg-primary { background: #0d6efd !important; }
body.dark-mode .badge.bg-info { background: #1a4731 !important; color: #3fb950 !important; }
body.dark-mode .badge.bg-success { background: #1a4731 !important; color: #3fb950 !important; border: 1px solid #2ea043; }
body.dark-mode .badge.bg-danger { background: #3b2e1a !important; color: #d29922 !important; border: 1px solid #bb8009; }
body.dark-mode .badge.bg-secondary { background: #21262d !important; color: #8b949e !important; }

/* Shadow */
body.dark-mode .shadow-sm { box-shadow: 0 2px 12px rgba(0,0,0,.3) !important; }

/* Buttons */
body.dark-mode .btn-outline-light { border-color: #30363d; color: #e6edf3; }
body.dark-mode .btn-outline-light:hover { background: #21262d; color: #fff; border-color: #484f58; }
