/* A.V.A Dashboard Custom Styles */

:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --danger-color: #dc3545;
    --sidebar-width: 260px;
    --topbar-height: 60px;

    /* Light theme colors */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --border-light: #f0f0f0;
    --card-shadow: rgba(0, 0, 0, 0.1);
    --hover-bg: #f8f9fa;
    --scrollbar-track: #f1f1f1;
    --scrollbar-thumb: #888;
    --scrollbar-thumb-hover: #555;
    --modal-bg: #ffffff;
    --modal-header-bg: #f8f9fa;
    --input-bg: #ffffff;
    --input-border: #ced4da;
    --table-header-bg: #f8f9fa;
    --sidebar-bg: #2c3e50;
    --sidebar-hover: #34495e;
    --sidebar-active: #3498db;
}

/* Dark theme colors */
[data-theme="dark"] {
    --bg-primary: #1a1d23;
    --bg-secondary: #242830;
    --bg-tertiary: #2d323e;
    --text-primary: #e9ecef;
    --text-secondary: #adb5bd;
    --text-muted: #868e96;
    --border-color: #3d4450;
    --border-light: #2d323e;
    --card-shadow: rgba(0, 0, 0, 0.3);
    --hover-bg: #2d323e;
    --scrollbar-track: #2d323e;
    --scrollbar-thumb: #495057;
    --scrollbar-thumb-hover: #6c757d;
    --modal-bg: #242830;
    --modal-header-bg: #2d323e;
    --input-bg: #2d323e;
    --input-border: #3d4450;
    --table-header-bg: #2d323e;
    --sidebar-bg: #1e2a38;
    --sidebar-hover: #2d3e50;
    --sidebar-active: #3498db;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Navbar */
.navbar-brand {
    font-weight: 600;
    font-size: 1.5rem;
}

.navbar-brand i {
    margin-right: 8px;
}

/* Cards */
.card {
    border-radius: 10px;
    box-shadow: 0 2px 4px var(--card-shadow);
    margin-bottom: 20px;
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
    transition: all 0.3s ease;
}

.card-header {
    background-color: var(--modal-header-bg);
    border-bottom: 2px solid var(--border-light);
    font-weight: 600;
    color: var(--text-primary);
}

/* KPI Cards */
.card.text-white h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 10px 0;
}

.card.text-white .card-title {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.card.text-white .card-text {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-bottom: 0;
}

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
}

.btn i {
    margin-right: 5px;
}

.btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.btn-outline-light.active {
    background-color: rgba(255, 255, 255, 0.3);
}

/* DataTables customization */
.dataTables_wrapper {
    padding: 20px 0;
    color: var(--text-primary);
}

.dataTables_filter input {
    border-radius: 6px;
    border: 1px solid var(--input-border);
    padding: 5px 10px;
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.dataTables_length select {
    border-radius: 6px;
    border: 1px solid var(--input-border);
    padding: 5px 10px;
    background-color: var(--input-bg);
    color: var(--text-primary);
}

#movements-table {
    font-size: 0.9rem;
    color: var(--text-primary);
}

#movements-table thead th {
    background-color: var(--table-header-bg);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    padding: 12px;
    color: var(--text-primary);
}

#movements-table tbody tr:hover {
    background-color: var(--hover-bg);
}

#movements-table tbody td {
    vertical-align: middle;
    padding: 10px;
    border-color: var(--border-color);
}

/* Action buttons in table */
.btn-sm {
    padding: 4px 8px;
    font-size: 0.85rem;
}

.btn-edit {
    margin-right: 5px;
}

/* Badges */
.badge {
    padding: 6px 12px;
    font-weight: 500;
    font-size: 0.85rem;
}

/* Calendar styling */
#calendar {
    padding: 10px;
    min-height: 600px;
}

/* FullCalendar specific styling */
.fc {
    background-color: var(--bg-secondary);
}

.fc .fc-toolbar-title {
    color: var(--text-primary);
}

.fc .fc-button {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.fc .fc-button:hover {
    background-color: var(--primary-color);
    opacity: 0.9;
}

.fc .fc-button-active {
    background-color: var(--primary-color);
}

.fc .fc-col-header-cell {
    background-color: var(--table-header-bg);
    color: var(--text-primary);
}

.fc .fc-daygrid-day {
    color: var(--text-primary);
}

.fc .fc-daygrid-day-number {
    color: var(--text-primary);
}

.fc .fc-day-today {
    background-color: rgba(13, 110, 253, 0.1) !important;
}

.fc {
    font-size: 0.9rem;
}

.fc-event {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
}

.fc-event:hover {
    opacity: 0.8;
}

.fc-daygrid-event {
    white-space: normal;
}

.fc-toolbar-title {
    font-size: 1.5rem !important;
    font-weight: 600;
}

.fc-button {
    border-radius: 6px !important;
}

/* Modal customization */
.modal-content {
    background-color: var(--modal-bg);
    border-color: var(--border-color);
}

.modal-header {
    background-color: var(--modal-header-bg);
    border-bottom: 2px solid var(--border-color);
}

.modal-title {
    font-weight: 600;
    color: var(--primary-color);
}

.modal-body {
    padding: 20px;
    color: var(--text-primary);
}

.form-label {
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--text-secondary);
}

.form-control,
.form-select {
    border-radius: 6px;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    background-color: var(--input-bg);
    color: var(--text-primary);
}

/* Top locations table */
#locations-table {
    font-size: 0.9rem;
    color: var(--text-primary);
}

#locations-table thead th {
    background-color: var(--table-header-bg);
    font-weight: 600;
    color: var(--text-primary);
}

#locations-table tbody td {
    border-color: var(--border-color);
}

/* Charts */
canvas {
    max-height: 300px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.2rem;
    }

    .card.text-white h2 {
        font-size: 2rem;
    }

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

    #movements-table {
        font-size: 0.8rem;
    }

    .fc-toolbar {
        font-size: 0.8rem;
    }

    .fc-toolbar-title {
        font-size: 1.2rem !important;
    }
}

/* Loading spinner */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Alert customization */
.alert {
    border-radius: 8px;
    border: none;
}

/* Table export buttons */
.dt-buttons {
    margin-bottom: 15px;
}

.dt-button {
    margin-right: 5px !important;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .dataTables_filter,
    .dataTables_length,
    .dataTables_info,
    .dataTables_paginate,
    .dt-buttons {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
        page-break-inside: avoid;
    }
}

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

.card {
    animation: fadeIn 0.3s ease-in-out;
}

/* Category color indicators */
.category-official {
    border-left: 4px solid var(--success-color);
}

.category-leave {
    border-left: 4px solid var(--warning-color);
}

.category-timeoff {
    border-left: 4px solid var(--info-color);
}

/* Dark Mode Toggle Button */
.theme-toggle {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.theme-toggle i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.theme-toggle:hover i {
    transform: rotate(20deg);
}

/* DataTables dark mode adjustments */
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--hover-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_info {
    color: var(--text-secondary);
}

/* FullCalendar dark mode */
[data-theme="dark"] .fc {
    background-color: var(--bg-secondary);
}

[data-theme="dark"] .fc-theme-standard td,
[data-theme="dark"] .fc-theme-standard th {
    border-color: var(--border-color);
}

[data-theme="dark"] .fc-theme-standard .fc-scrollgrid {
    border-color: var(--border-color);
}

[data-theme="dark"] .fc-col-header-cell {
    background-color: var(--table-header-bg);
}

[data-theme="dark"] .fc-daygrid-day {
    background-color: var(--bg-secondary);
}

[data-theme="dark"] .fc-daygrid-day:hover {
    background-color: var(--hover-bg);
}

[data-theme="dark"] .fc-day-today {
    background-color: var(--bg-tertiary) !important;
}

/* Event count badges on calendar */
.event-count-badges {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 4px;
}

.event-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.event-count-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.event-count-badge.status-planned {
    background-color: #0d6efd;
}

.event-count-badge.status-confirmed {
    background-color: #198754;
}

.event-count-badge.status-cancelled {
    background-color: #6c757d;
}

.event-count-badge.status-converted {
    background-color: #6f42c1;
}

/* Make day cells with events more visible */
.fc-daygrid-day.fc-day-has-events {
    background-color: rgba(13, 110, 253, 0.05);
}

[data-theme="dark"] .fc-daygrid-day.fc-day-has-events {
    background-color: rgba(13, 110, 253, 0.1);
}

/* Adjust day cell padding for badges */
.fc-daygrid-day-frame {
    position: relative;
    min-height: 60px;
    display: flex;
    flex-direction: column;
}

.fc-daygrid-day-top {
    flex-shrink: 0;
}

/* Hide default event elements in month view only (handled by JS for week view) */
.fc-dayGridMonth-view .fc-daygrid-event-harness {
    /* Hidden via JS eventDidMount to allow conditional hiding */
}

/* List Week View Styling */
.fc-listWeek-view {
    background-color: var(--bg-secondary);
}

.fc-list-day-cushion {
    background-color: var(--table-header-bg) !important;
    color: var(--text-primary) !important;
    font-weight: 600;
    font-size: 1rem;
    padding: 12px 15px !important;
    border-bottom: 2px solid var(--border-color) !important;
}

.fc-list-event {
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--border-light) !important;
}

.fc-list-event:hover {
    background-color: var(--hover-bg) !important;
}

.fc-list-event-time {
    color: var(--text-secondary) !important;
    font-weight: 500;
    padding: 12px 15px !important;
    min-width: 100px;
}

.fc-list-event-dot {
    border-width: 6px !important;
    margin-right: 10px;
}

.fc-list-event-title {
    padding: 12px 15px !important;
}

/* Custom Takwim List Event Styling */
.takwim-list-event {
    width: 100%;
}

.takwim-event-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.takwim-event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
}

.takwim-meta-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.takwim-meta-item i {
    font-size: 0.75rem;
    opacity: 0.7;
    min-width: 14px;
}

/* List view responsive adjustments */
@media (max-width: 768px) {
    .fc-list-event-time {
        min-width: 80px;
        font-size: 0.85rem;
        padding: 10px !important;
    }

    .fc-list-event-title {
        padding: 10px !important;
    }

    .takwim-event-title {
        font-size: 0.95rem;
    }

    .takwim-event-meta {
        gap: 8px;
    }

    .takwim-meta-item {
        font-size: 0.8rem;
    }

    .fc-list-day-cushion {
        font-size: 0.9rem;
        padding: 10px !important;
    }
}

/* Empty state for list view */
.fc-list-empty {
    background-color: var(--bg-secondary);
    color: var(--text-muted);
    padding: 40px 20px;
    text-align: center;
    font-size: 1rem;
}

.fc-list-empty-cushion {
    padding: 0 !important;
}

/* Dark mode support for list view */
[data-theme="dark"] .fc-listWeek-view {
    background-color: var(--bg-secondary);
}

[data-theme="dark"] .fc-list-table {
    background-color: var(--bg-secondary);
}

[data-theme="dark"] .fc-list-event {
    background-color: var(--bg-secondary);
    border-bottom-color: var(--border-color) !important;
}

[data-theme="dark"] .fc-list-event:hover {
    background-color: var(--hover-bg) !important;
}

[data-theme="dark"] .fc-list-day-cushion {
    background-color: var(--table-header-bg) !important;
}

/* ============================
   FILTER TOGGLE (MOBILE)
   ============================ */

/* Hide filter toggle button on desktop */
.filter-toggle-btn {
    display: none;
}

/* Show filter section by default on desktop */
.filter-section {
    display: flex !important;
    transition: all 0.3s ease;
}

/* Event meta info (owner and unit) */
.event-meta-info {
    font-size: 0.7rem;
    opacity: 0.8;
}

.event-meta-info i {
    font-size: 0.65rem;
    margin-right: 3px;
}

/* Mobile responsive filter toggle */
@media (max-width: 768px) {
    /* Show filter toggle button on mobile */
    .filter-toggle-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        justify-content: center;
        font-weight: 500;
        padding: 10px 20px;
    }

    .filter-toggle-btn i {
        font-size: 1rem;
    }

    /* Hide filters by default on mobile */
    .filter-section {
        display: none !important;
        flex-direction: column;
        overflow: hidden;
        max-height: 0;
        opacity: 0;
        transition: max-height 0.4s ease, opacity 0.3s ease;
    }

    /* Show filters when toggled */
    .filter-section.show {
        display: flex !important;
        max-height: 1000px;
        opacity: 1;
        margin-bottom: 1rem;
    }

    /* Stack filter columns on mobile */
    .filter-section > div {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }

    /* Adjust button alignment on mobile */
    .filter-section .d-flex.align-items-end {
        display: flex !important;
        flex-direction: column;
        align-items: stretch !important;
    }

    .filter-section .d-flex.align-items-end button {
        width: 100%;
        margin-bottom: 10px;
    }

    .filter-section .d-flex.align-items-end button:last-child {
        margin-bottom: 0;
    }
}

/* Chart.js dark mode text */
[data-theme="dark"] canvas {
    filter: brightness(0.9);
}

/* ============================
   TAKWIM-SPECIFIC STYLES
   ============================ */

/* Purple color for converted status */
:root {
    --purple-color: #6f42c1;
}

/* Takwim Status Badges */
.status-planned,
.bg-planned {
    background-color: #0d6efd !important;
    color: white !important;
}

.status-confirmed,
.bg-confirmed {
    background-color: #198754 !important;
    color: white !important;
}

.status-cancelled,
.bg-cancelled {
    background-color: #6c757d !important;
    color: white !important;
}

.status-converted,
.bg-converted,
.bg-purple {
    background-color: #6f42c1 !important;
    color: white !important;
}

/* Text colors for purple */
.text-purple {
    color: #6f42c1 !important;
}

/* Cancelled items with strikethrough */
.status-cancelled .event-title {
    text-decoration: line-through;
}

/* Role Badges */
.role-badge-admin {
    background-color: #dc3545;
    color: white;
}

.role-badge-unit-head {
    background-color: #fd7e14;
    color: white;
}

.role-badge-staff {
    background-color: #0dcaf0;
    color: white;
}

/* Takwim Table Styling */
#takwim-table thead th {
    background-color: var(--table-header-bg);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    padding: 12px;
    color: var(--text-primary);
}

#takwim-table tbody tr:hover {
    background-color: var(--hover-bg);
}

#takwim-table tbody td {
    vertical-align: middle;
    padding: 10px;
    border-color: var(--border-color);
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 35px;
    max-width: 380px;
    width: 100%;
}

.login-card .card-title {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 10px;
}

.login-card .card-subtitle {
    color: #6c757d;
    margin-bottom: 30px;
}

.login-card .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 12px 20px;
    font-weight: 600;
}

.login-card .btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8c 100%);
}

.login-card .form-control {
    border-radius: 8px;
    padding: 12px 15px;
    border: 1px solid #ced4da;
}

.login-card .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.login-alert {
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Profile & Password Pages */
.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    margin: 0 auto 20px;
}

.password-strength {
    margin-top: 5px;
    font-size: 0.85rem;
}

/* Permission-based visibility */
.admin-only,
.unit-head-only {
    display: none !important;
}

/* Show when user has permission */
.has-admin .admin-only {
    display: block !important;
}

.has-unit-head .unit-head-only {
    display: block !important;
}

/* Dropdown menu improvements */
.dropdown-menu {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    background-color: var(--modal-bg);
}

.dropdown-item {
    padding: 10px 15px;
    color: var(--text-primary);
    transition: background-color 0.2s ease;
}

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

.dropdown-item.active {
    background-color: var(--primary-color);
    color: white;
}

.dropdown-item i {
    width: 20px;
    margin-right: 8px;
    text-align: center;
}

.dropdown-divider {
    border-top-color: var(--border-color);
}

/* Converted takwim indicator */
.converted-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* Year comparison styles */
.comparison-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.comparison-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px var(--card-shadow);
}

.difference-indicator {
    font-size: 1.2rem;
    font-weight: 600;
}

.difference-up {
    color: #198754;
}

.difference-down {
    color: #dc3545;
}

.difference-neutral {
    color: #6c757d;
}

/* Users management table */
#users-table thead th {
    background-color: var(--table-header-bg);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    padding: 12px;
    color: var(--text-primary);
}

#users-table tbody tr:hover {
    background-color: var(--hover-bg);
}

#users-table tbody td {
    vertical-align: middle;
    padding: 10px;
    border-color: var(--border-color);
}

/* Active/Inactive user indicators */
.user-active {
    color: #198754;
}

.user-inactive {
    color: #dc3545;
}

/* Toast notifications (if implemented) */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
}

.toast {
    min-width: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Dark mode adjustments for new components */
[data-theme="dark"] .dropdown-menu {
    background-color: var(--modal-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: var(--hover-bg);
}

/* Responsive adjustments for takwim pages */
@media (max-width: 768px) {
    .login-card {
        margin: 20px;
        padding: 30px;
    }

    .login-card .card-title {
        font-size: 1.5rem;
    }

    #takwim-table {
        font-size: 0.8rem;
    }

    .comparison-card h4 {
        font-size: 1.2rem;
    }

    .comparison-card h3 {
        font-size: 1.5rem;
    }
}

/* Print styles for reports */
@media print {
    .comparison-card {
        page-break-inside: avoid;
    }

    .filter-controls,
    .year-selector {
        display: none !important;
    }
}

/* ============================
   SIDEBAR LAYOUT STYLES
   ============================ */

/* Box sizing fix */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Main layout container */
.app-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 100;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand:hover {
    color: white;
    opacity: 0.9;
}

.sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 5px 10px;
}

.sidebar-toggle:hover {
    opacity: 0.8;
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 10px 0;
}

.sidebar-section {
    padding: 15px 20px 8px;
}

.sidebar-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
    font-weight: 600;
    margin-bottom: 8px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu-item {
    margin-bottom: 2px;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

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

.sidebar-menu-link:hover {
    background-color: var(--sidebar-hover);
    color: white;
}

.sidebar-menu-link.active {
    background-color: var(--sidebar-active);
    color: white;
    font-weight: 600;
}

.sidebar-menu-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background-color: white;
}

/* Sidebar submenu */
.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-submenu.show {
    max-height: 500px;
}

.sidebar-submenu-link {
    display: flex;
    align-items: center;
    padding: 10px 20px 10px 52px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.sidebar-submenu-link:hover {
    background-color: var(--sidebar-hover);
    color: white;
}

.sidebar-submenu-link.active {
    color: white;
    font-weight: 500;
}

.sidebar-menu-link .chevron {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.sidebar-menu-link.expanded .chevron {
    transform: rotate(90deg);
}

/* Sidebar footer (user info) */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(0, 0, 0, 0.2);
}

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

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-actions {
    display: flex;
    gap: 8px;
}

.sidebar-user-actions .btn {
    padding: 5px 10px;
    font-size: 0.85rem;
}

/* Main content area */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
}

/* Top bar */
.topbar {
    height: var(--topbar-height);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}

.topbar-menu-toggle:hover {
    opacity: 0.7;
}

.topbar-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Module Navigation Tabs */
.module-nav {
    display: flex;
    gap: 5px;
    padding: 0;
    margin: 0;
    margin-left: 30px;
    list-style: none;
}

.module-nav-item {
    margin: 0;
}

.module-nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
    background-color: transparent;
}

.module-nav-link:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

.module-nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

.module-nav-link i {
    font-size: 0.9rem;
}

/* Module header - combines title and nav */
.module-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Responsive module nav */
@media (max-width: 992px) {
    .module-nav {
        margin-left: 0;
        margin-top: 10px;
    }

    .topbar {
        flex-wrap: wrap;
        height: auto;
        min-height: var(--topbar-height);
    }

    .module-header {
        flex: 1 1 100%;
        flex-wrap: wrap;
    }

    .module-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .module-nav-link {
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

/* Content wrapper */
.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background-color: var(--bg-primary);
}

/* Fix for Bootstrap rows inside content-wrapper */
.content-wrapper .row {
    margin-left: 0;
    margin-right: 0;
}

.content-wrapper .row > * {
    padding-left: 12px;
    padding-right: 12px;
}

/* Home dashboard icon cards */
.function-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.function-card {
    background-color: var(--bg-secondary);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.function-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px var(--card-shadow);
    border-color: var(--primary-color);
    text-decoration: none;
    color: var(--text-primary);
}

.function-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2.5rem;
    color: white;
}

.function-icon.bg-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.function-icon.bg-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.function-icon.bg-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.function-icon.bg-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.function-icon.bg-danger {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.function-icon.bg-purple {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.function-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.function-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Responsive design */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-backdrop.show {
        display: block;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .topbar-menu-toggle {
        display: block;
    }

    .sidebar-toggle {
        display: block;
    }

    .function-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }

    .function-card {
        min-height: 160px;
        padding: 20px;
    }

    .function-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
        margin-bottom: 15px;
    }

    .function-title {
        font-size: 1.1rem;
    }

    .content-wrapper {
        padding: 20px;
    }
}

@media (max-width: 576px) {
    .function-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 0 15px;
    }

    .topbar-title {
        font-size: 1.2rem;
    }

    .content-wrapper {
        padding: 15px;
    }
}

/* Print styles - hide sidebar */
@media print {
    .sidebar,
    .topbar {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .content-wrapper {
        padding: 0 !important;
    }
}
