/* Core Design System Tokens */
:root {
    /* Fonts */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Theme-specific tokens (Dark Theme - Default) */
    --bg-app: #0b0f19;
    --bg-surface: rgba(20, 26, 42, 0.65);
    --bg-surface-opaque: #141a2a;
    --bg-sidebar: #0f1422;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    /* Semantic Accent Colors */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.15);
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    --info: #3b82f6;
    --info-light: rgba(59, 130, 246, 0.15);

    /* Shadows & Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --glass-blur: blur(12px);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* Light Theme overrides */
[data-theme="light"] {
    --bg-app: #f4f6fa;
    --bg-surface: rgba(255, 255, 255, 0.75);
    --bg-surface-opaque: #ffffff;
    --bg-sidebar: #ffffff;
    --border-color: rgba(0, 0, 0, 0.06);
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
}

/* Basic Resets & Document Setup */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-app);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-normal);
}

/* Layout Grid Structure */
.app-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Navigation */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 10;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    font-size: 28px;
    color: var(--primary);
    filter: drop-shadow(0 0 8px rgba(79, 70, 229, 0.3));
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.brand-text span {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-menu {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.nav-item {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.nav-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
    transition: transform var(--transition-fast);
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-item:hover i {
    transform: translateX(2px);
}

.nav-item.active {
    color: #ffffff;
    background-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

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

/* Theme Toggle Button styling */
.theme-btn {
    width: 100%;
    padding: 12px 16px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-weight: 500;
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

[data-theme="light"] .theme-btn {
    background-color: #f3f4f6;
}

.theme-btn:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.theme-btn i {
    font-size: 16px;
}

[data-theme="dark"] .light-icon,
[data-theme="light"] .dark-icon {
    display: none;
}

/* Main Content Wrapper */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.top-header {
    height: 80px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-surface-opaque);
    z-index: 5;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

#page-title {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
}

#page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-info {
    text-align: right;
    display: flex;
    flex-direction: column;
}

.profile-info strong {
    font-size: 14px;
    font-weight: 600;
}

.profile-info span {
    font-size: 11px;
    color: var(--text-muted);
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    font-family: var(--font-heading);
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.25);
}

.content-body {
    padding: 32px;
    overflow-y: auto;
    flex-grow: 1;
}

/* View Sections setup */
.view-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Stats Cards Grid Layout */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), border-color var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(79, 70, 229, 0.25);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ffffff;
}

.bg-primary { background-color: var(--primary); box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3); }
.bg-warning { background-color: var(--warning); box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3); }
.bg-info { background-color: var(--info); box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3); }
.bg-success { background-color: var(--success); box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3); }

.stat-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-details h3 {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
}

/* Cards & Styling Components */
.card {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
}

.card-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.card-body {
    padding: 24px;
}

/* Tables and Styling */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 16px 24px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background-color: rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 16px 24px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    white-space: nowrap;
}

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

tr:hover td {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.015);
}

/* Forms & UI Controls */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    width: 100%;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.15);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

[data-theme="light"] .form-control {
    background-color: #ffffff;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-control:disabled {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-row {
    display: flex;
    gap: 16px;
}

.flex-2 { flex: 2; }
.flex-3 { flex: 3; }
.items-center { align-items: center; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.1);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .btn-secondary {
    background-color: #ffffff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

/* Badges / Pill Tags */
.badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background-color: var(--success-light); color: var(--success); }
.badge-warning { background-color: var(--warning-light); color: var(--warning); }
.badge-danger { background-color: var(--danger-light); color: var(--danger); }
.badge-info { background-color: var(--info-light); color: var(--info); }
.badge-secondary { background-color: rgba(255, 255, 255, 0.05); color: var(--text-secondary); }

/* Upload Drag and Drop zone styling */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    cursor: pointer;
    transition: border-color var(--transition-normal), background-color var(--transition-normal);
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background-color: rgba(79, 70, 229, 0.02);
}

.dropzone-icon {
    font-size: 48px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.dropzone:hover .dropzone-icon {
    color: var(--primary);
}

.alert {
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    border-left: 4px solid transparent;
}

.alert-success { background-color: var(--success-light); color: var(--success); border-left-color: var(--success); }
.alert-danger { background-color: var(--danger-light); color: var(--danger); border-left-color: var(--danger); }
.alert-warning { background-color: var(--warning-light); color: var(--warning); border-left-color: var(--warning); }

/* Tabs Layout */
.tabs-report-view {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: #ffffff;
    background-color: var(--primary);
}

.report-content-panel {
    display: none;
}

.report-content-panel.active {
    display: block;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-surface-opaque);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
}

.close-modal {
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Empty states */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    text-align: center;
    gap: 16px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 40px;
}

/* Grid Layout helper */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .grid-2col {
        grid-template-columns: 1fr;
    }
}

/* Scroll and margin helpers */
.scrollable-y { overflow-y: auto; }
.max-h-400 { max-height: 400px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.flex-grow-1 { flex-grow: 1; }

.payroll-filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}
.form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}
.form-checkbox label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Sidebar Submenus Styling */
.submenu {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding-left: 16px;
    margin-top: 4px;
}
.submenu-item {
    font-size: 13.5px !important;
    padding: 10px 14px !important;
    font-weight: 500;
}
.submenu-item.active {
    background-color: var(--primary-light) !important;
    color: var(--primary) !important;
    box-shadow: none !important;
    border-left: 3px solid var(--primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.submenu-indicator {
    margin-left: auto;
    font-size: 0.8rem;
    transition: transform 0.3s;
}
button.nav-item {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
}
