/* assets/css/style.css */
:root {
    /* Color Palette - Deeper, more vibrant */
    --primary: #1B4332;
    --primary-light: #2D6A4F;
    --primary-hover: #081c15;
    
    --secondary: #E9C46A;
    --secondary-hover: #F4A261;
    
    /* Backgrounds - Moving away from flat gray to soft tinted */
    --bg-app: #F0F4F2;
    --surface: #FFFFFF;
    --surface-glass: rgba(255, 255, 255, 0.75);
    
    /* Semantic Colors */
    --success: #2A9D8F;
    --warning: #E9C46A;
    --danger: #E76F51;
    --info: #457B9D;
    
    /* Text Colors */
    --text-main: #1D3557;
    --text-muted: #6C757D;
    --text-invert: #FFFFFF;

    /* Status Backgrounds with modern opacity */
    --green-light: rgba(42, 157, 143, 0.1);
    --yellow-light: rgba(233, 196, 106, 0.1);
    --orange-light: rgba(244, 162, 97, 0.1);
    --blue-light: rgba(69, 123, 157, 0.1);
    --red-light: rgba(231, 111, 81, 0.1);

    /* Metrics */
    --sidebar-width: 260px;
    --sidebar-collapsed: 80px;
    --topbar-height: 80px; /* Slightly taller */
    --radius-sm: 8px;
    --radius-md: 16px; /* Rounder corners */
    --radius-lg: 24px;
    
    /* Shadows - softer, colored */
    --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.025);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --shadow-primary: 0 10px 20px -5px rgba(45,106,79,0.3);
    
    /* Transitions */
    --trans-fast: 0.2s ease-out;
    --trans-md: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.6;
    overflow: hidden; /* Prevent body scroll, container scrolls instead */
}

/* Layout */
.app-layout {
    display: flex;
    height: 100vh;
    height: 100dvh; /* For mobile PWA correct height */
    width: 100%;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.2);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: white;
    box-shadow: 4px 0 24px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    transition: width var(--trans-md), transform var(--trans-md);
    z-index: 100;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--secondary);
    letter-spacing: -0.5px;
}

.logo-icon-wrap {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-hover));
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(233, 196, 106, 0.3);
}

.sidebar.collapsed .logo-text { display: none; }

.toggle-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    color: white;
    transition: all var(--trans-fast);
}
.toggle-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); }

.sidebar-nav {
    flex: 1;
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(233,196,106,0.1), transparent);
    transition: width 0.3s ease;
    z-index: 0;
}

.nav-item:hover::before, .nav-item.active::before {
    width: 100%;
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    z-index: 1;
    transition: transform var(--trans-fast);
}

.nav-item .nav-text {
    z-index: 1;
}

.nav-item:hover {
    color: white;
    transform: translateX(4px);
}

.nav-item:hover i { transform: scale(1.1); color: var(--secondary); }

.nav-item.active {
    background: rgba(255,255,255,0.08);
    color: white;
    border-left: 4px solid var(--secondary);
}
.nav-item.active i { color: var(--secondary); }

.sidebar.collapsed .nav-text { display: none; }
.sidebar.collapsed .nav-item { padding: 14px; justify-content: center; }
.sidebar.collapsed .nav-item i { margin: 0; }

.sidebar-footer {
    padding: 24px 12px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.logout-btn {
    color: #ff9999;
}
.logout-btn:hover {
    color: #ffcccc;
    background: rgba(255,0,0,0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    box-shadow: var(--shadow-sm);
    z-index: 90;
    border-bottom: 1px solid rgba(255,255,255,0.5);
}

.topbar-left-mobile {
    display: none;
    align-items: center;
    gap: 16px;
}

.mobile-toggle-btn {
    background: var(--white);
    border: 1px solid rgba(0,0,0,0.1);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: var(--primary);
    font-size: 1.1rem;
    box-shadow: var(--shadow-sm);
}
.mobile-logo {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary);
}

.topbar-search {
    display: flex;
    align-items: center;
    background-color: var(--surface);
    border-radius: 16px;
    padding: 10px 20px;
    width: 350px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    transition: all var(--trans-fast);
}
.topbar-search:focus-within {
    box-shadow: 0 0 0 3px rgba(45,106,79,0.1);
    border-color: var(--primary-light);
}

.topbar-search i { color: var(--text-muted); margin-right: 12px; }
.topbar-search input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
}

.search-shortcut {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-app);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.action-btn-circle {
    background: var(--surface);
    border: 1px solid rgba(0,0,0,0.05);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: all var(--trans-fast);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.action-btn-circle:hover { 
    color: var(--primary); 
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--surface);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px;
    border-radius: 24px;
    transition: background var(--trans-fast);
}
.user-profile:hover {
    background: rgba(0,0,0,0.05);
}

.avatar img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: var(--shadow-sm);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name { font-weight: 600; font-size: 0.95rem; color: var(--text-main); }
.user-role { font-size: 0.75rem; color: var(--text-muted); font-weight: 500;}

/* View Container */
.view-container {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.view-panel {
    display: none;
}
.view-panel.active { 
    display: block; 
}

/* Animations classes for JS to trigger */
.slide-up { animation: slideUp 0.4s ease forwards; }
.stagger-in > * { opacity: 0; animation: fadeUp 0.5s ease forwards; }
.stagger-in > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.4s; }
.fade-in-delayed { opacity: 0; animation: fadeIn 0.5s ease 0.5s forwards; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Common Page Elements */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 2rem;
    color: var(--text-main);
    margin-bottom: 4px;
    letter-spacing: -0.5px;
    font-weight: 700;
}
.page-header .subtitle { color: var(--text-muted); font-size: 1rem;}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--trans-fast);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-invert);
    box-shadow: var(--shadow-primary);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 14px 24px -6px rgba(45,106,79,0.4);
}
.btn-primary:active {
    transform: translateY(0);
}

.pulse-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.2);
    border-radius: inherit;
    z-index: 1;
    opacity: 0;
    transition: 0.3s;
}
.pulse-btn:active::after {
    width: 150%;
    height: 150%;
    opacity: 1;
    transition: 0s;
}


/* KPI Cards - Modern Glass & Gradients */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.kpi-card {
    padding: 24px;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-glass);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255,255,255,0.3);
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.kpi-glow {
    position: absolute;
    width: 150px;
    height: 150px;
    background: white;
    filter: blur(50px);
    border-radius: 50%;
    opacity: 0.1;
    top: -50px;
    right: -50px;
}

.dark-green-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}
.gold-card {
    background: linear-gradient(135deg, #F4A261 0%, #E9C46A 100%);
    color: white;
}
.orange-card {
    background: linear-gradient(135deg, #E76F51 0%, #F4A261 100%);
    color: white;
}
.light-card {
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

.kpi-header h3 {
    font-size: 1.05rem;
    font-weight: 500;
    opacity: 0.9;
}

.kpi-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    backdrop-filter: blur(5px);
}

.kpi-body {
    position: relative;
    z-index: 2;
}

.kpi-value {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 8px;
}

.kpi-value .unit {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.8;
}

.kpi-trend {
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255,255,255,0.2);
    display: inline-flex;
}

.text-dark { color: var(--text-main) !important; }
.light-card .kpi-icon-wrap { background: var(--bg-app); color: var(--primary); }
.light-card .kpi-trend.positive { background: var(--green-light); color: var(--success); }

/* Dashboard Grids */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.premium-card {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255,255,255,0.8);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-header {
    padding: 24px 30px;
    border-bottom: 1px solid rgba(0,0,0,0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.4);
}
.card-header h2 {
    font-size: 1.25rem;
    color: var(--text-main);
    font-weight: 700;
}

.card-actions {
    display: flex;
    background: var(--bg-app);
    border-radius: 8px;
    padding: 4px;
}
.btn-sm {
    padding: 6px 14px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
}
.btn-sm.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.btn-icon-small {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
}
.btn-icon-small:hover { background: rgba(0,0,0,0.05); color: var(--text-main);}

.card-body {
    padding: 30px;
    flex: 1;
}
.p-0 { padding: 0; }

/* Mock Chart Redesign */
.chart-placeholder { height: 320px; position: relative; }
.mock-chart {
    display: flex;
    height: 100%;
    padding-bottom: 20px;
    position: relative;
}

.chart-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-right: 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-right: 1px dashed rgba(0,0,0,0.1);
    height: calc(100% - 30px);
}

.chart-bars {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding-left: 10px;
    height: calc(100% - 30px);
}

.bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    width: 10%;
    position: relative;
}

.bar-group:hover .bar {
    opacity: 0.8;
}

.bar {
    width: 100%;
    background: linear-gradient(180deg, var(--secondary) 0%, #F4A261 100%);
    border-radius: 8px 8px 0 0;
    transition: height 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: inset -2px 0 4px rgba(0,0,0,0.05);
}

.day-label {
    position: absolute;
    bottom: -30px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Modern Alerts List */
.alert-list-modern {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 30px;
    border-bottom: 1px solid rgba(0,0,0,0.03);
    transition: background 0.2s;
}
.alert-item:hover { background: rgba(0,0,0,0.01); }
.alert-item:last-child { border-bottom: none; }

.alert-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.alert-item.warning .alert-icon { background: var(--yellow-light); color: #D4A373; }
.alert-item.danger .alert-icon { background: var(--red-light); color: var(--danger); }
.alert-item.info .alert-icon { background: var(--blue-light); color: var(--info); }

.alert-content {
    flex: 1;
}

.alert-content strong { 
    display: block; 
    font-size: 1rem; 
    color: var(--text-main); 
    font-weight: 600;
}
.alert-content span { 
    display: block; 
    font-size: 0.85rem; 
    color: var(--text-muted); 
    margin-top: 4px; 
}

.btn-action {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.1);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: 0.2s;
}

.alert-item.warning .btn-action:hover { background: var(--warning); color: white; border-color: var(--warning); }
.alert-item.danger .btn-action:hover { background: var(--danger); color: white; border-color: var(--danger); }

/* Empty States */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 4rem;
    color: rgba(0,0,0,0.05);
    margin-bottom: 20px;
}
.empty-state h3 {
    color: var(--text-main);
    font-size: 1.5rem;
    margin-bottom: 8px;
}


/* Responsive - PWA focuses */
@media (max-width: 1200px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { 
        position: fixed; 
        left: -300px; /* Hide completely */
        height: 100vh; 
        height: 100dvh;
        width: 280px; 
        z-index: 1000;
    }
    .sidebar.mobile-open { 
        left: 0; 
        box-shadow: 100px 0 0 rgba(0,0,0,0.3); /* Dim background effect */
    }
    
    .topbar {
        padding: 0 20px;
        justify-content: space-between;
    }
    
    .topbar-left-mobile { display: flex; }
    .topbar-search { display: none; }
    
    .view-container { padding: 20px; }
    
    .kpi-grid { grid-template-columns: 1fr; gap: 16px; }
    
    .page-header { flex-direction: column; gap: 16px; }
    .page-header .btn { width: 100%; }
}

