/* ============================================
   SturdyTrack360 — Global Styles
   ============================================ */

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

body { margin: 0; overflow-x: hidden; }

/* ---- Sidebar ---- */
#app-wrapper { min-height: 100vh; }

.sidebar-nav {
    width: 260px;
    transition: width 0.25s ease;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

/* Logo/brand link — must not shrink */
.sidebar-nav > a:first-child {
    flex-shrink: 0;
}

/* User footer — must not shrink */
.sidebar-nav > div:last-child {
    flex-shrink: 0;
}

/* Scrollable nav list — takes all remaining space, scrolls vertically */
.sidebar-nav > ul.nav {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    flex-wrap: nowrap;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
}
.sidebar-nav > ul.nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav > ul.nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav > ul.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 3px; }
.sidebar-nav > ul.nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

/* Collapsed state */
.sidebar-nav.collapsed { width: 60px; }
.sidebar-nav.collapsed .nav-link span,
.sidebar-nav.collapsed .nav-section-toggle span,
.sidebar-nav.collapsed .nav-chevron,
.sidebar-nav.collapsed .lh-1 { display: none; }
.sidebar-nav.collapsed .nav-link { justify-content: center; padding: 0.6rem; }
.sidebar-nav.collapsed .avatar-circle { margin: 0 auto; }
.sidebar-nav.collapsed .nav-section-list { display: none; }

/* Section toggle button (replaces plain label) */
.nav-section-toggle {
    width: 100%;
    background: none;
    border: none;
    color: #6c757d;
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 0.75rem 0.75rem 0.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    line-height: 1;
}
.nav-section-toggle:hover { color: #adb5bd; }

.nav-chevron {
    font-size: 9px;
    transition: transform 0.2s ease;
}
.nav-section-toggle[aria-expanded="false"] .nav-chevron {
    transform: rotate(-90deg);
}

/* Nested section list */
.nav-section-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-link { border-radius: 6px; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-link:hover { background: rgba(255,255,255,0.08) !important; }
.nav-link.active { background: #0d6efd !important; }

/* ---- Avatar ---- */
.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

/* ---- KPI Cards ---- */
.kpi-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s;
}
.kpi-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

/* ---- Tables ---- */
.table-hover tbody tr:hover { background: rgba(13,110,253,0.04); }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: #6c757d; }

/* ---- Badges ---- */
.badge-expiry-critical { background: #dc3545; }
.badge-expiry-warning  { background: #fd7e14; }
.badge-expiry-near     { background: #ffc107; color: #000; }
.badge-expiry-ok       { background: #198754; }

/* ---- Status pills ---- */
.status-active    { background: #d1f2eb; color: #0e6655; }
.status-suspended { background: #fde8d8; color: #b85c00; }
.status-expired   { background: #fadbd8; color: #922b21; }
.status-pending   { background: #eaecee; color: #566573; }

/* ---- Forms ---- */
.form-label { font-weight: 500; font-size: 0.875rem; }
.required::after { content: ' *'; color: #dc3545; }

/* ---- Auth pages ---- */
.auth-card {
    max-width: 440px;
    margin: auto;
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}
.auth-brand { font-size: 1.5rem; font-weight: 700; color: #0d6efd; }

/* ---- Stock count progress ---- */
.consumption-formula {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    font-family: monospace;
}

/* ---- Expiry traffic light ---- */
.expiry-critical  { color: #dc3545; font-weight: 600; }
.expiry-warning   { color: #fd7e14; font-weight: 600; }
.expiry-near      { color: #ffc107; font-weight: 600; }
.expiry-ok        { color: #198754; }

/* ---- Notification toast ---- */
.notification-toast { min-width: 300px; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar-nav {
        position: fixed;
        top: 0;
        left: -260px;
        height: 100vh;
        z-index: 1050;
        transition: left 0.25s ease;
    }
    .sidebar-nav.open { left: 0; }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 1049;
    }
    .sidebar-overlay.show { display: block; }

    body.sidebar-open { overflow: hidden; }
}

@media (min-width: 769px) {
    .sidebar-overlay { display: none !important; }
}

@media (max-width: 575px) {
    main.flex-grow-1 { padding: 1rem !important; }
    .navbar.bg-white nav[aria-label="breadcrumb"] { display: none; }
}

/* ---- Utility ---- */
.cursor-pointer { cursor: pointer; }
.text-naira::before { content: '₦'; }
.fw-500 { font-weight: 500; }
