/* dashboard_modern.css - Dual Theme V4 */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --font-main: 'Outfit', sans-serif;
    --sidebar-width: 310px;
    /* Increased to fix overflow */

    /* --- DARK THEME (DEFAULT) --- */
    --bg-body: #0f172a;
    /* Slate 900 */
    --bg-sidebar: #1e293b;
    /* Slate 800 */
    --bg-card: #1e293b;
    --bg-hover: rgba(255, 255, 255, 0.05);

    --text-main: #f8fafc;
    /* Slate 50 */
    --text-muted: #94a3b8;
    /* Slate 400 */

    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.3);

    --primary: #3b82f6;
    /* Blue 500 */
    --primary-light: rgba(59, 130, 246, 0.2);
    --accent: #06b6d4;

    --radius-main: 16px;
}

/* --- LIGHT THEME OVERRIDES --- */
body.light-theme {
    --bg-body: #f1f5f9;
    /* Slate 100 */
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f8fafc;

    --text-main: #0f172a;
    /* Slate 900 */
    --text-muted: #64748b;
    /* Slate 500 */

    --border-color: #e2e8f0;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05);

    --primary: #0284c7;
    /* Sky 600 */
    --primary-light: #e0f2fe;
    --accent: #0ea5e9;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 50;
    box-sizing: border-box;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Smoother width transition */
    overflow-x: hidden;
    white-space: nowrap;
    /* 3D Glass Effect for Sidebar (Subtle) */
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
}

.sidebar.collapsed {
    width: 80px;
    padding: 24px 12px;
}

.brand {
    display: flex;
    flex-direction: column;
    /* Stack logo and text */
    align-items: center;
    /* Center align */
    justify-content: center;
    gap: 8px;
    /* Space between logo and text */
    margin-bottom: 40px;
    padding-left: 0;
    /* Reset padding */
    height: auto;
    /* Allow dynamic height */
    min-height: 60px;
    overflow: hidden;
    width: 100%;
    /* MAX WIDTH of left pane */
    text-align: center;
}

/* Logo handling for collapse */
.brand img {
    height: 90px;
    /* 2X Size requested */
    max-width: 90%;
    /* Ensure it fits nicely but uses space */
    object-fit: contain;
    transition: all 0.3s ease;
    /* Invert logo for light theme if it's white */
    filter: var(--logo-filter, none);
}

.brand-text-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center the text stack */
    opacity: 1;
    transition: opacity 0.3s ease;
    width: 100%;
}

.brand h2 {
    font-size: 1.5rem;
    /* Slightly larger */
    font-weight: 700;
    color: var(--text-main);
    margin: 5px 0 0 0;
    line-height: 1.2;
    white-space: nowrap;
}

.brand-subtitle {
    font-size: 1.6rem;
    /* 2X size (was 0.85rem) */
    background: linear-gradient(90deg, #0ea5e9, #a855f7);
    /* Gradient Text */
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    /* Extra bold for visibility */
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;

    /* Request: Use Max Width */
    width: 100%;
    display: block;
    text-align: center;
    line-height: 1.2;
    margin-top: 5px;
}

.sidebar.collapsed .brand {
    align-items: center;
    /* Center logo when collapsed */
    padding-left: 0;
    gap: 0;
}

.sidebar.collapsed .brand img {
    height: 40px;
    /* Adjust for icon mode */
}

/* Hide text when collapsed */
.sidebar.collapsed .brand-text-container {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    visibility: hidden;
    transform: translateX(10px);
}

.sidebar.collapsed .brand h2 {
    display: none;
    /* Ensure h2 is gone */
}


.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    /* Prepare for border hover */
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-main);
    /* 3D Hover Effect */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
    border-color: var(--border-color);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    /* Active 3D Pressed Look */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.nav-link i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px 0;
}

.sidebar-footer {
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}


.collapse-btn {
    background: transparent;
    border: none;
    width: 100%;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-main);
}

/* --- MAIN CONTENT --- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 0 40px 40px 40px;
    width: calc(100% - var(--sidebar-width));
    box-sizing: border-box;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.expanded {
    margin-left: 80px;
    width: calc(100% - 80px);
}

/* --- TOP BAR --- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 30px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ef4444;
    color: white;
    font-size: 0.6rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.separator {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

/* User Profile with Dropdown */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    position: relative;
    padding: 6px 12px;
    border-radius: 12px;
    transition: background 0.2s;
}

.user-profile:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.user-info {
    text-align: right;
}

.user-info .name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
}

.user-info .role {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 100;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 8px 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-item {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.dropdown-item i {
    width: 18px;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

.text-danger {
    color: #ef4444 !important;
}

.text-danger i {
    color: #ef4444 !important;
}

/* --- HERO CARD 3D --- */
.hero-card {
    /* Default Dark Theme Background */
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9)),
        url('../img/modern_tech_hero_bg.png');
    background-size: cover;
    background-position: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-main);
    padding: 32px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
    /* 3D Dept Effect */
    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.2),
        0 4px 6px -2px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    /* Top Highlight */
    transition: transform 0.3s ease;
}

/* Light Theme Hero Override - Clean & Bright */
body.light-theme .hero-card {
    background: linear-gradient(120deg, #ffffff 0%, #f0f9ff 100%);
    --hero-bg: linear-gradient(135deg, #e0f2fe, #f0f9ff);
    --hero-text: #0f172a;
    /* Light Theme Logo Visibility: White logo with strong dark outline (stroke effect) */
    --logo-filter: drop-shadow(0 1px 0 #000) drop-shadow(-1px -1px 0 #000) drop-shadow(1px -1px 0 #000) drop-shadow(-1px 1px 0 #000) drop-shadow(1px 1px 0 #000);
    box-shadow:
        0 10px 25px -5px rgba(14, 165, 233, 0.15),
        0 4px 6px -2px rgba(14, 165, 233, 0.05),
        inset 0 0 0 1px #ffffff;
    border: 1px solid #e0f2fe;
}

body.light-theme .hero-card h1 {
    color: #0f172a;
}

body.light-theme .hero-card p {
    color: #64748b;
}

.hero-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.hero-card::after {
    content: '';
    position: absolute;
    left: 0;
    /* Changed to left accent for variety */
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
}

.hero-text h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 6px 0;
}

.hero-text p {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 0;
}

.live-clock-container {
    text-align: right;
}

.live-time {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.live-date {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 6px;
}

/* --- KPI GRID --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

/* --- KPI CARDS 3D --- */
.kpi-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-main);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Glass/3D base */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.kpi-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--primary);
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.15),
        0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* Colors for Icons (Dynamic with theme) */
.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

/* We simply use RGBA for these to look good on both dark/light */
.icon-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.icon-orange {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.icon-red {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.icon-green {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.kpi-info h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 4px 0;
}

.kpi-info .value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
}

.kpi-info .sub-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- QUICK ACTIONS --- */
.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--primary);
    border-radius: 4px;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* --- ACTION CARDS 3D --- */
.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-main);
    padding: 24px 16px;
    text-align: center;
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    /* 3D Base */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.action-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: all 0.2s;
    /* 3D Icon Circle */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.action-card:hover .action-icon {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.action-card span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

/* --- RECENT ACTIVITY 3D --- */
.recent-activity-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-main);
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.activity-table {
    width: 100%;
    border-collapse: collapse;
}

.activity-table th {
    background: var(--bg-hover);
    text-align: left;
    padding: 16px 24px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

.activity-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.9rem;
}

.activity-table tr:last-child td {
    border-bottom: none;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    display: inline-block;
}

.status-approved {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.status-pending {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.status-rejected {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.status-validated {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .main-content {
        padding: 0 24px 24px 24px;
    }
}

@media (max-width: 900px) {
    .main-content {
        padding: 0 20px 20px 20px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 0;
        padding: 0;
        overflow: hidden;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 16px;
    }

    .hero-card {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .live-clock-container {
        text-align: center;
    }
}