/**
 * ILMLI Professional Theme - "Classic Navy Enterprise"
 * Built entirely around deep, cohesive Navy Blue shades.
 */

/* ==========================================================================
   1. GLOBAL COLOR VARIABLES (Pure Navy Palette)
   ========================================================================== */
:root {
    /* THE NAVY PALETTE */
    --primary-dark: #040169c4;       /* Deepest Navy - For Sidebar & Top Banners */
    --primary-main: #003366;       /* YOUR THEME COLOR - Classic Navy for Buttons & Links */
    --primary-medium: #004C99;     /* Medium Navy - For hover states */
    --primary-light: #b2c9fbfd;      /* Soft Slate-Blue - For visible borders */
    --primary-lighter: #E6F0FA;    /* Crisp Icy Navy - Distinct color for Table Headers */
    --primary-lightest: #F5F9FD;   /* Barely-there Navy tint - For table row hovers */
    
    /* TEXT COLORS */
    --text-dark: #0A192F;          /* Deepest blue-black for highest text readability */
    --text-muted: #5C7080;         /* Navy-tinted gray for secondary text */
    --text-white: #FFFFFF;
    
    /* NEUTRAL BACKGROUNDS */
    --bg-light: #F8FAFC;           /* Page background (slightly cool off-white) */
    --border-color: #D5E1EA;
    --border-light: #EBF0F5;

    --sidebar-width: 280px; 
    --header-height: 70px;
}

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

/* ==========================================================================
   2. GLOBAL OVERRIDES (Replacing Black with Deep Navy)
   ========================================================================== */

.bg-dark {
    background-color: var(--primary-dark) !important;
    color: var(--text-white) !important;
    border-color: var(--primary-dark) !important;
}

.sidebar-wrapper {
    background-color: var(--primary-dark) !important;
    border-right: 1px solid rgba(255,255,255,0.08);
}

.card-header {
    background-color: var(--primary-light) !important;
    color: var(--primary-dark) !important;
}

.btn-primary {
    background-color: var(--primary-main) !important;
    border-color: var(--primary-main) !important;
    box-shadow: 0 2px 4px rgba(0, 51, 102, 0.2) !important;
}

.btn-primary:hover {
    background-color: var(--primary-medium) !important;
    border-color: var(--primary-medium) !important;
}

.btn-outline-primary {
    color: var(--primary-main) !important;
    border-color: var(--primary-main) !important;
}

.btn-outline-primary:hover {
    background-color: var(--primary-main) !important;
    color: var(--text-white) !important;
}

/* ==========================================================================
   3. TABLE ENHANCEMENTS (Crisp Icy Navy Headers)
   ========================================================================== */

.card > .table-responsive > .table { margin-bottom: 0; }

.table-light, 
.table-light > th, 
.table-light > td,
thead.table-light th,
thead.table-light tr th {
    background-color: var(--primary-lighter) !important;
    color: var(--primary-dark) !important;
    border-bottom: 2px solid var(--primary-light) !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

.empty-state-cell {
    background-color: #ffffff !important;
    color: var(--text-muted) !important;
    border-bottom: none !important;
}

.table-hover > tbody > tr:hover > td,
.table-hover > tbody > tr:hover > th {
    background-color: var(--primary-lightest) !important;
    color: var(--primary-dark) !important;
    transition: background-color 0.2s ease;
}

tfoot.bg-light, tfoot.table-light {
    background-color: var(--primary-lightest) !important;
    border-top: 2px solid var(--primary-light) !important;
}

/* ==========================================================================
   4. MOBILE RESPONSIVENESS & TABS
   ========================================================================== */

.main-wrapper {
    width: 100%;
}

#financeTabs, .swipe-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    border-bottom: 2px solid var(--border-color);
    scrollbar-width: none;
}
#financeTabs::-webkit-scrollbar, .swipe-tabs::-webkit-scrollbar {
    display: none;
}
.swipe-tabs .nav-link {
    white-space: nowrap;
    padding: 12px 20px;
    color: var(--text-white);
}
.swipe-tabs .nav-link.active {
    color: var(--primary-medium);
    border-bottom: 3px solid var(--primary-light);
}

@media (max-width: 576px) {
    .container-fluid.px-4 { padding-left: 10px !important; padding-right: 10px !important; }
    .tab-content.p-4 { padding: 15px !important; }
    .row { margin-left: 0; margin-right: 0; }
    .col-md-8, .col-md-6 { padding-left: 0; padding-right: 0; }
}

/* Mobile Table-to-Card Logic */
@media (max-width: 768px) {
    .responsive-card-table thead { display: none; }
    
    .responsive-card-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background-color: #fff;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    
    .responsive-card-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        border-bottom: 1px solid var(--border-light);
        padding: 12px 15px;
    }
    
    .responsive-card-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--primary-main);
        text-align: left;
        flex: 1;
    }
    
    .responsive-card-table td:last-child {
        border-bottom: none;
        background-color: var(--bg-light);
        justify-content: center;
        border-radius: 0 0 8px 8px;
    }
}

/* ==========================================================================
   5. PRINT OVERRIDES (Specific fixes for ERP reports)
   ========================================================================== */
@media print {
    body { 
        background-color: #fff !important; 
        zoom: 100% !important; 
        transform: none !important;
    }
    
    .table th, .table td { 
        border: 1px solid #000 !important; 
        padding: 3px 4px !important; 
        color: #000 !important; 
        font-size: 10pt !important; 
    }
    
    .table-light, .bg-dark, thead { 
        background-color: #f2f2f2 !important; 
        color: #000 !important; 
    }
    
    .text-success, .text-danger, .text-primary { 
        color: #000 !important; 
    } 
}


/* ==========================================================================
   9. COMPACT MOBILE VIEW (Scale down fonts, icons, and UI elements)
   ========================================================================== */
@media (max-width: 575.98px) {
    /* 1. Reduce root font size (automatically shrinks all 'rem' based elements) */
    html {
        font-size: 14px !important; /* Browsers default to 16px */
    }

    /* 2. Scale down base body text and tables */
    body, p, .table, .nav-link {
        font-size: 0.875rem !important; /* Equates to roughly 12.25px */
    }

    /* 3. Reduce heading hierarchies */
    h1 { font-size: 1.5rem !important; }
    h2 { font-size: 1.3rem !important; }
    h3 { font-size: 1.15rem !important; }
    h4 { font-size: 1.05rem !important; }
    h5, h6 { font-size: 0.95rem !important; }

    /* 4. Shrink form inputs, buttons, and their padding */
    .form-control, .form-select, .btn, .input-group-text {
        font-size: 0.85rem !important;
        padding: 0.4rem 0.75rem !important; /* Tighter padding */
    }

    /* 5. Reduce Icon Sizes (Targets Bootstrap Icons & FontAwesome) */
    i.bi, i.fa, i.fas, i.far, .icon {
        font-size: 1.1em !important;
    }

    /* 6. Tighter spacing inside cards */
    .card-header {
        padding: 0.75rem 1rem !important;
    }
    .card-body {
        padding: 1rem !important;
    }
    
    /* 7. Make the brand logo slightly smaller */
    .brand-logo-circle {
        width: 65px !important;
        height: 65px !important;
        padding: 6px !important;
    }
}