/* style.css - Premium Light Theme ERP Styling System */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    /* HSL Palette Archetypes for Clean Light Theme */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #ffffff;
    --border-glass: rgba(15, 23, 42, 0.08);
    
    --primary: hsl(198, 100%, 45%);
    --primary-glow: hsla(198, 100%, 45%, 0.08);
    --primary-dark: hsl(225, 63%, 36%);
    
    --success: hsl(150, 75%, 35%);
    --success-glow: hsla(150, 75%, 45%, 0.1);
    --warning: hsl(38, 90%, 40%);
    --warning-glow: hsla(38, 90%, 55%, 0.1);
    --danger: hsl(355, 80%, 45%);
    --danger-glow: hsla(355, 80%, 55%, 0.1);
    --info: hsl(190, 80%, 40%);
    --info-glow: hsla(190, 80%, 50%, 0.1);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --sidebar-bg: #ffffff;
    --sidebar-border: rgba(15, 23, 42, 0.06);
    --sidebar-link: #64748b;
    --sidebar-link-active: hsl(198, 100%, 45%);
    --sidebar-link-hover: #0f172a;
    
    --header-bg: rgba(255, 255, 255, 0.85);
    
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --input-focus-border: hsl(198, 100%, 45%);
    --input-focus-shadow: hsla(198, 100%, 45%, 0.15);
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --sidebar-width: 260px;
    --header-height: 70px;
    
    --shadow-soft: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 2px 8px -1px rgba(15, 23, 42, 0.03);
    --shadow-card: 0 10px 30px -5px rgba(15, 23, 42, 0.05), 0 4px 12px -2px rgba(15, 23, 42, 0.02);
}

/* Global Elements styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Panel Containers */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.08);
}

/* Layout Shell */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar navigation */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand {
    font-size: 1.15rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 12px;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-item {
    margin-bottom: 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--sidebar-link);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.sidebar-link i {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-link:hover {
    color: var(--sidebar-link-hover);
    background: #f1f5f9;
}

.sidebar-item.active .sidebar-link {
    color: var(--sidebar-link-active);
    background: var(--primary-glow);
}

/* Top Header */
.app-header {
    height: var(--header-height);
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    z-index: 1020;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    transition: var(--transition-smooth);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
}

.main-content {
    margin-left: var(--sidebar-width);
    padding-top: calc(var(--header-height) + 24px);
    padding-right: 24px;
    padding-left: 24px;
    padding-bottom: 40px;
    width: calc(100% - var(--sidebar-width));
    transition: var(--transition-smooth);
}

/* Inputs & Form Fields */
.form-control, .form-select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary) !important;
    border-radius: 8px;
    padding: 10px 14px;
    transition: var(--transition-smooth);
}

.form-control:focus, .form-select:focus {
    background: var(--input-bg-focus);
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.8;
}

/* Table overrides */
.table {
    color: var(--text-primary);
    border-color: var(--border-glass);
    vertical-align: middle;
}

.table th {
    font-weight: 700;
    color: var(--text-secondary);
    background: #f1f5f9;
    border-bottom: 2px solid var(--border-glass);
    padding: 12px 16px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 16px;
    background: transparent;
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.9rem;
}

/* Dynamic health badges */
.health-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.health-green { background: var(--success-glow); color: var(--success); border: 1px solid var(--success); }
.health-yellow { background: var(--warning-glow); color: var(--warning); border: 1px solid var(--warning); }
.health-orange { background: rgba(249, 115, 22, 0.15); color: #f97316; border: 1px solid #f97316; }
.health-red { background: var(--danger-glow); color: var(--danger); border: 1px solid var(--danger); }

/* Custom Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    border: none;
    box-shadow: 0 4px 14px 0 var(--primary-glow);
    transition: var(--transition-smooth);
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 var(--primary-glow);
}

/* Dynamic Dashboard Cards */
.stat-card {
    position: relative;
    overflow: hidden;
}

/* Notification counter bubble */
.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
}

/* Overriding white text hardcoded in PHP views to preserve clean light mode visibility */
.text-white, 
a.text-white, 
.table td a.text-white,
.table td .text-white,
.dropdown-menu a.text-white {
    color: var(--text-primary) !important;
}

a.text-white:hover {
    color: var(--primary) !important;
}

/* Pre-filled styles for dropdown lists and modal dialogs (forcing them to stay light and modern) */
.dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
}

.dropdown-item {
    color: var(--text-primary) !important;
    transition: var(--transition-smooth);
}

.dropdown-item:hover {
    background-color: #f1f5f9 !important;
    color: var(--primary) !important;
}

.dropdown-item .text-secondary {
    color: var(--text-secondary) !important;
}

.modal-content {
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15) !important;
    color: var(--text-primary) !important;
}

.modal-header, .modal-footer {
    border-color: #e2e8f0 !important;
}

.modal-title {
    color: var(--text-primary) !important;
}

.btn-close {
    filter: none !important; /* Keep default dark close icon */
}

/* Hover link styles */
.hover-link:hover {
    color: var(--primary) !important;
    text-decoration: underline !important;
}

/* Print CSS Configurations */
@media print {
    .app-sidebar, .app-header, .no-print, .btn, form {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding-top: 0 !important;
        width: 100% !important;
    }
    body {
        background: #fff !important;
        color: #000 !important;
    }
    .glass-panel {
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }
    .table {
        color: #000 !important;
    }
    .table th {
        background: #f1f5f9 !important;
        border-bottom: 2px solid #000 !important;
    }
    /* Invoice sheet print color correction overrides */
    .invoice-sheet {
        color: #000000 !important;
        background: transparent !important;
        padding: 0 !important;
    }
    .invoice-sheet .text-white, 
    .invoice-sheet .text-secondary, 
    .invoice-sheet .fw-bold, 
    .invoice-sheet h3, 
    .invoice-sheet h4, 
    .invoice-sheet h6, 
    .invoice-sheet td, 
    .invoice-sheet th, 
    .invoice-sheet div, 
    .invoice-sheet span {
        color: #000000 !important;
    }
    .invoice-sheet .table {
        border-color: #000000 !important;
    }
    .invoice-sheet .table td, 
    .invoice-sheet .table th {
        border: 1px solid #000000 !important;
        color: #000000 !important;
    }
    .invoice-sheet .border-top, 
    .invoice-sheet .border-bottom {
        border-color: #000000 !important;
    }
}

/* Responsive configurations */
@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-header {
        left: 0;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
}

/* Real-Time Live Updates Pulse & Indicators */
@keyframes kpiPulse {
    0% { transform: scale(1); filter: brightness(1.2); }
    50% { transform: scale(1.1); filter: brightness(1.5); }
    100% { transform: scale(1); filter: brightness(1); }
}
.kpi-updated {
    animation: kpiPulse 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-block;
}
.live-dot {
    width: 8px;
    height: 8px;
    background-color: hsl(150, 75%, 35%);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px hsl(150, 75%, 45%);
    animation: liveIndicator 2s infinite ease-in-out;
}
@keyframes liveIndicator {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

