/* ===================================
   Modern Base Styles - LegalAligned
   =================================== */

/* CSS Variables - Design System */
:root {
    /* Brand Colors - From Logo */
    --brand-navy: #0A0965;
    --brand-teal: #0FB9B3;

    /* Primary Palette */
    --primary-color: #0A0965;
    --primary-light: #1a1575;
    --primary-dark: #050433;
    --primary-50: #e8e7f5;
    --primary-100: #c5c3e6;

    /* Accent Colors */
    --accent-color: #0FB9B3;
    --accent-light: #2fd4ce;
    --accent-dark: #0a8a85;

    /* Neutral Colors */
    --gray-50: #fafbfc;
    --gray-100: #f4f6f8;
    --gray-200: #e5e9ed;
    --gray-300: #d1d7dd;
    --gray-400: #9aa5b1;
    --gray-500: #697386;
    --gray-600: #4f5d70;
    --gray-700: #3c4858;
    --gray-800: #2a3342;
    --gray-900: #1a202c;

    /* Semantic Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #fafbfc;
    --bg-tertiary: #f4f6f8;

    /* Border Colors */
    --border-light: #e5e9ed;
    --border-medium: #d1d7dd;
    --border-dark: #9aa5b1;

    /* Text Colors */
    --text-primary: #1a202c;
    --text-secondary: #4f5d70;
    --text-tertiary: #697386;
    --text-muted: #9aa5b1;

    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --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.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Spacing (8px base grid) */
    --space-1: 0.25rem;  /* 4px */
    --space-2: 0.5rem;   /* 8px */
    --space-3: 0.75rem;  /* 12px */
    --space-4: 1rem;     /* 16px */
    --space-5: 1.25rem;  /* 20px */
    --space-6: 1.5rem;   /* 24px */
    --space-8: 2rem;     /* 32px */
    --space-10: 2.5rem;  /* 40px */
    --space-12: 3rem;    /* 48px */
    --space-16: 4rem;    /* 64px */
}

/* ===================================
   Base Elements
   =================================== */

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-secondary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 0.9375rem;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===================================
   Typography
   =================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-4);
}

h1 { font-size: 2.25rem; font-weight: 700; }
h2 { font-size: 1.875rem; font-weight: 700; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted) !important;
}

/* ===================================
   Navbar
   =================================== */

.navbar {
    background: var(--bg-primary);
    padding: var(--space-4) 0;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.navbar-brand {
    color: var(--primary-color) !important;
    font-weight: 700;
    font-size: 1.375rem;
    letter-spacing: -0.02em;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.navbar-brand:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.navbar-brand img {
    filter: drop-shadow(0 2px 4px rgba(10, 9, 101, 0.1));
}

.user-dropdown {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.user-dropdown:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.user-dropdown::before {
    content: "";
    display: inline-block;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    margin-right: var(--space-2);
}

/* ===================================
   Layout
   =================================== */

.container-fluid {
    flex: 1 0 auto;
}

/* ===================================
   Sidebar
   =================================== */

.sidebar {
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-right: 1px solid var(--border-light);
    padding: var(--space-6) 0;
    min-height: calc(100vh - 73px);
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-5);
    margin: var(--space-1) var(--space-4);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-base);
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    position: relative;
}

.sidebar-link svg {
    transition: transform var(--transition-base);
    flex-shrink: 0;
}

.sidebar-link:hover {
    background: var(--primary-50);
    color: var(--primary-color);
    transform: translateX(2px);
}

.sidebar-link:hover svg {
    transform: scale(1.05);
}

.sidebar-link.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: var(--shadow-md);
}

.sidebar-link.active svg {
    filter: brightness(0) invert(1);
}

.sidebar-divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-5) var(--space-4);
}

.sidebar-section-title {
    padding: var(--space-2) var(--space-5);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    margin-top: var(--space-4);
    margin-bottom: var(--space-2);
}

/* ===================================
   Main Content
   =================================== */

.main-content {
    padding: var(--space-10);
    background: var(--bg-secondary);
    max-width: 1600px;
}

/* ===================================
   Cards
   =================================== */

.card {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-6);
    transition: all var(--transition-base);
    overflow: hidden;
    background: var(--bg-primary);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--border-medium);
}

.card-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-5) var(--space-6);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.card-header.bg-light {
    background: var(--bg-secondary) !important;
}

.card-body {
    padding: var(--space-6);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    letter-spacing: -0.01em;
}

/* Welcome Card */
.welcome-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 50%, var(--accent-dark) 100%);
    color: white;
    border-radius: var(--radius-xl);
    padding: var(--space-10);
    margin-bottom: var(--space-8);
    box-shadow: var(--shadow-lg);
    border: none;
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(15, 185, 179, 0.2) 0%, transparent 70%);
    border-radius: 50%;
}

.welcome-card h1,
.welcome-card .h4 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-3);
    color: white;
    letter-spacing: -0.02em;
}

.welcome-card p {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.0625rem;
}

.info-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-2) var(--space-4);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-right: var(--space-3);
    margin-top: var(--space-3);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-base);
}

.info-badge:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* Stat Card */
.stat-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-6);
    transition: all var(--transition-base);
    border: 1px solid var(--border-light);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--accent-color);
}

.stat-card h3 {
    font-size: 2.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-2);
    line-height: 1;
}

.stat-card p {
    color: var(--text-tertiary);
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 500;
}

/* Quick Actions */
.quick-actions {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.quick-actions h4 {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-6);
    letter-spacing: -0.01em;
}

/* ===================================
   Buttons
   =================================== */

.btn {
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-5);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all var(--transition-base);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: white;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline-primary {
    border: 1.5px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    color: white;
}

.btn-secondary {
    background: var(--gray-500);
    color: white;
}

.btn-secondary:hover {
    background: var(--gray-600);
    transform: translateY(-2px);
}

.btn-outline-secondary {
    border: 1.5px solid var(--border-medium);
    color: var(--text-secondary);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--gray-400);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: 0.875rem;
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: 1.0625rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===================================
   Forms
   =================================== */

.form-control, .form-select {
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    font-size: 0.9375rem;
    transition: all var(--transition-base);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-control:hover {
    border-color: var(--border-medium);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(10, 9, 101, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    font-size: 0.875rem;
    letter-spacing: -0.01em;
}

/* ===================================
   Tables
   =================================== */

.table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table thead th {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: var(--space-4);
    white-space: nowrap;
}

.table tbody td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--bg-secondary);
}

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

.table-hover tbody tr {
    cursor: pointer;
}

/* ===================================
   Badges
   =================================== */

.badge {
    padding: var(--space-2) var(--space-3);
    font-weight: 500;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-color);
}

.bg-success {
    background: #d1fae5;
    color: #065f46;
}

.bg-warning {
    background: #fed7aa;
    color: #92400e;
}

.bg-danger {
    background: #fee2e2;
    color: #991b1b;
}

.bg-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ===================================
   List Groups
   =================================== */

.list-group-item {
    border: 1px solid var(--border-light);
    padding: var(--space-4) var(--space-5);
    transition: all var(--transition-base);
    background: var(--bg-primary);
    border-radius: var(--radius-md) !important;
    margin-bottom: var(--space-2);
}

.list-group-item:hover {
    background: var(--bg-secondary);
    border-color: var(--border-medium);
    transform: translateX(2px);
}

.list-group-item.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.list-group-item.active h6 {
    color: white;
}

.list-group-item.active .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* ===================================
   Alerts
   =================================== */

.alert {
    border-radius: var(--radius-md);
    border: 1px solid;
    padding: var(--space-5) var(--space-6);
    margin-bottom: var(--space-6);
    font-size: 0.9375rem;
}

.alert-info {
    background: #dbeafe;
    color: #1e3a8a;
    border-color: #93c5fd;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-color: #6ee7b7;
}

.alert-warning {
    background: #fed7aa;
    color: #92400e;
    border-color: #fbbf24;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

/* ===================================
   Dropdown Menus
   =================================== */

.dropdown-menu {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-2);
    margin-top: var(--space-2);
}

.dropdown-item {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

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

.dropdown-divider {
    border-color: var(--border-light);
    margin: var(--space-2) 0;
}

/* ===================================
   Modals
   =================================== */

.modal-content {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-2xl);
}

.modal-header {
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-6);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    border-top: 1px solid var(--border-light);
    padding: var(--space-6);
}

.modal-backdrop {
    backdrop-filter: blur(4px);
}

/* ===================================
   Footer
   =================================== */

.footer {
    flex-shrink: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    padding: var(--space-8) 0;
    margin-top: auto;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.footer p {
    margin: 0;
}

.footer-link {
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color var(--transition-base);
    font-weight: 500;
}

.footer-link:hover {
    color: var(--primary-color);
}

/* ===================================
   Utilities
   =================================== */

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }

/* Focus visible styles for accessibility */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Mobile status badge - hidden on desktop */
.mobile-status-badge {
    display: none !important;
}

@media (max-width: 767.98px) {
    .mobile-status-badge {
        display: inline-flex !important;
    }
}

/* Task Complete Button */
.task-complete-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-full);
    background: transparent;
    border: 1.5px solid var(--border-light);
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

.task-complete-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: scale(1.05);
}

.task-complete-btn:active {
    transform: scale(0.95);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-full);
}

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

/* ===================================
   Desktop Sidebar Collapse (≥992px only)
   =================================== */

/* Apply collapsed layout instantly on page load (when html has class) */
@media (min-width: 992px) {
    html.sidebar-collapsed-layout .sidebar,
    html.sidebar-collapsed-layout #sidebar {
        width: 70px !important;
        min-width: 70px !important;
        max-width: 70px !important;
        flex: 0 0 70px !important;
        overflow-x: hidden !important;
    }

    html.sidebar-collapsed-layout .sidebar-text {
        display: none !important;
    }

    html.sidebar-collapsed-layout .sidebar-section-title {
        display: none !important;
    }

    html.sidebar-collapsed-layout .sidebar-link {
        justify-content: center !important;
        padding: var(--space-3) 0 !important;
        margin: var(--space-1) var(--space-2) !important;
    }

    html.sidebar-collapsed-layout .sidebar-link svg {
        margin: 0 !important;
    }

    html.sidebar-collapsed-layout .main-content {
        flex: 0 0 calc(100% - 70px) !important;
        max-width: calc(100% - 70px) !important;
    }

    /* Also expand containers inside main content when sidebar is collapsed */
    html.sidebar-collapsed-layout .main-content .container,
    html.sidebar-collapsed-layout .col-md-10 .container {
        max-width: 100% !important;
    }

    html.sidebar-collapsed-layout .sidebar-toggle-btn i {
        transform: rotate(180deg);
    }
}

/* Desktop only - sidebar toggle button */
@media (min-width: 992px) {
    .sidebar-toggle-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
        border: none;
        border-radius: var(--radius-md);
        background: transparent;
        color: var(--text-primary);
        cursor: pointer;
        transition: all var(--transition-base);
        font-size: 1.25rem;
    }

    .sidebar-toggle-btn:hover {
        background: var(--bg-secondary);
        color: var(--primary-color);
    }

    .sidebar-toggle-btn:active {
        background: var(--bg-tertiary);
        transform: scale(0.95);
    }

    .sidebar-toggle-btn i {
        transition: transform var(--transition-base);
    }

    /* When sidebar is collapsed, flip the chevron to point right */
    body:has(.sidebar.collapsed) .sidebar-toggle-btn i,
    .sidebar.collapsed ~ * .sidebar-toggle-btn i {
        transform: rotate(180deg);
    }

    /* Collapsed sidebar state - using !important to override Bootstrap grid */
    .col-md-2.sidebar.collapsed {
        width: 70px !important;
        min-width: 70px !important;
        max-width: 70px !important;
        flex: 0 0 70px !important;
        overflow-x: hidden !important;
    }

    /* Alternative: target by ID for even higher specificity */
    #sidebar.collapsed {
        width: 70px !important;
        min-width: 70px !important;
        max-width: 70px !important;
        flex: 0 0 70px !important;
        overflow-x: hidden !important;
    }

    /* Hide text in collapsed state */
    .sidebar.collapsed .sidebar-text {
        display: none !important;
    }

    /* Hide section titles and dividers when collapsed */
    .sidebar.collapsed .sidebar-section-title {
        display: none !important;
    }

    .sidebar.collapsed .sidebar-divider {
        margin: var(--space-3) var(--space-4);
    }

    /* Center icons when collapsed */
    .sidebar.collapsed .sidebar-link {
        justify-content: center !important;
        padding: var(--space-3) 0 !important;
        margin: var(--space-1) var(--space-2) !important;
    }

    .sidebar.collapsed .sidebar-link svg {
        margin: 0 !important;
    }

    /* Add tooltips for collapsed state */
    .sidebar.collapsed .sidebar-link {
        position: relative;
    }

    .sidebar.collapsed .sidebar-link::after {
        content: attr(title);
        position: absolute;
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        margin-left: var(--space-3);
        padding: var(--space-2) var(--space-3);
        background: var(--gray-800);
        color: white;
        border-radius: var(--radius-sm);
        font-size: 0.875rem;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition-base);
        z-index: 1000;
    }

    .sidebar.collapsed .sidebar-link:hover::after {
        opacity: 1;
    }

    /* Smooth transitions for all elements */
    .sidebar {
        transition: all var(--transition-slow);
    }

    .sidebar-text {
        transition: opacity var(--transition-base), width var(--transition-base);
    }

    .sidebar-section-title {
        transition: opacity var(--transition-base), height var(--transition-base), margin var(--transition-base), padding var(--transition-base);
    }

    /* Expand main content when sidebar is collapsed */
    .main-content {
        transition: all var(--transition-slow);
    }

    .col-md-10.main-content.sidebar-collapsed {
        flex: 0 0 calc(100% - 70px) !important;
        max-width: calc(100% - 70px) !important;
        width: calc(100% - 70px) !important;
    }
}

/* Hide toggle button on mobile/tablet */
@media (max-width: 991.98px) {
    .sidebar-toggle-btn {
        display: none !important;
    }
}

/* ===================================
   Request Manage Page
   =================================== */

/* Ensure sticky sidebar doesn't overlap navbar */
.request-manage-sidebar .sticky-top {
    z-index: 100;
}

/* Clickable status badges */
.status-badge-link {
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-block;
}

.status-badge-link:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    filter: brightness(0.95);
}

/* ===================================
   Mobile Optimizations
   =================================== */

/* Hamburger Menu Button */
.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-base);
}

.mobile-menu-toggle:hover {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.mobile-menu-toggle i {
    font-size: 1.5rem;
}

/* Tablet and below (< 992px) */
@media (max-width: 991.98px) {
    /* Show hamburger menu */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Hide sidebar by default on tablet/mobile */
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        z-index: 1050;
        transition: left var(--transition-slow);
        overflow-y: auto;
        padding-top: var(--space-8);
        box-shadow: var(--shadow-2xl);
    }

    .sidebar.show {
        left: 0;
    }

    /* Backdrop overlay */
    .mobile-sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        backdrop-filter: blur(4px);
    }

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

    /* Main content takes full width */
    .main-content {
        padding: var(--space-6);
    }

    /* Adjust navbar */
    .navbar-brand {
        font-size: 1.25rem;
    }

    .navbar-brand img {
        height: 32px;
    }

    /* Footer stacking */
    .footer .row > div {
        text-align: center !important;
        margin-bottom: var(--space-4);
    }

    .footer .row > div:last-child {
        margin-bottom: 0;
    }

    .footer span.mx-2 {
        display: none;
    }

    .footer-link {
        display: inline-block;
        margin: var(--space-2);
    }
}

/* Mobile phones (< 768px) */
@media (max-width: 767.98px) {
    /* Reduce spacing further */
    .main-content {
        padding: var(--space-4);
    }

    /* Smaller navbar */
    .navbar {
        padding: var(--space-3) 0;
    }

    .navbar-brand {
        font-size: 1.125rem;
    }

    .navbar-brand img {
        height: 28px;
    }

    /* User dropdown compact */
    .user-dropdown {
        padding: var(--space-2) var(--space-3);
        font-size: 0.8125rem;
    }

    .user-dropdown::before {
        width: 28px;
        height: 28px;
    }

    /* Card spacing */
    .card {
        margin-bottom: var(--space-4);
    }

    .card-body {
        padding: var(--space-4);
    }

    .card-header {
        padding: var(--space-4);
    }

    /* Welcome card */
    .welcome-card {
        padding: var(--space-6);
        margin-bottom: var(--space-6);
    }

    .welcome-card h1,
    .welcome-card .h4 {
        font-size: 1.5rem;
    }

    /* Buttons - larger tap targets */
    .btn {
        min-height: 44px;
        padding: var(--space-3) var(--space-4);
    }

    .btn-sm {
        min-height: 36px;
    }

    /* Table responsiveness */
    .table {
        font-size: 0.875rem;
    }

    .table thead th {
        font-size: 0.6875rem;
        padding: var(--space-3);
    }

    .table tbody td {
        padding: var(--space-3);
    }

    /* Stat cards */
    .stat-card {
        padding: var(--space-5);
    }

    .stat-card h3 {
        font-size: 2.25rem;
    }

    /* Modal adjustments */
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--space-4);
    }

    /* Footer */
    .footer {
        padding: var(--space-6) 0;
        font-size: 0.8125rem;
    }

    .footer-link {
        display: block;
        margin: var(--space-2) 0;
    }
}

/* Extra small phones (< 576px) */
@media (max-width: 575.98px) {
    /* Even more compact */
    .main-content {
        padding: var(--space-3);
    }

    /* Hide brand text, keep logo only */
    .navbar-brand {
        font-size: 0;
    }

    .navbar-brand img {
        margin-right: 0 !important;
    }

    /* Compact user dropdown */
    .user-dropdown {
        font-size: 0;
        padding: var(--space-2);
    }

    .user-dropdown::before {
        margin-right: 0;
    }

    /* Typography adjustments */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.125rem; }

    /* Welcome card */
    .welcome-card {
        padding: var(--space-5);
    }

    .welcome-card h1,
    .welcome-card .h4 {
        font-size: 1.25rem;
    }

    .welcome-card p {
        font-size: 0.9375rem;
    }

    .info-badge {
        font-size: 0.8125rem;
        padding: var(--space-1) var(--space-3);
    }

    /* Sidebar narrower on very small screens */
    .sidebar {
        width: 260px;
    }
}

/* Remove hover effects on touch devices */
@media (hover: none) {
    .card:hover {
        transform: none;
    }

    .sidebar-link:hover {
        transform: none;
    }

    .btn:hover {
        transform: none;
    }

    .stat-card:hover {
        transform: none;
    }
}

/* ===================================
   Request Manage Page Mobile
   =================================== */

/* Mobile tab navigation dropdown */
.mobile-tab-selector {
    display: none;
}

@media (max-width: 767.98px) {
    /* Hide left sidebar navigation on mobile */
    .request-manage-sidebar {
        display: none;
    }

    /* Show mobile dropdown instead */
    .mobile-tab-selector {
        display: block;
        margin-bottom: var(--space-4);
    }

    .mobile-tab-dropdown {
        width: 100%;
        padding: var(--space-3) var(--space-4);
        border: 1.5px solid var(--border-light);
        border-radius: var(--radius-md);
        background: var(--bg-primary);
        color: var(--text-primary);
        font-size: 0.9375rem;
        font-weight: 500;
        cursor: pointer;
        transition: all var(--transition-base);
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23697386' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right var(--space-4) center;
        background-size: 16px 12px;
        padding-right: 3rem;
        appearance: none;
    }

    .mobile-tab-dropdown:focus {
        border-color: var(--primary-color);
        outline: none;
        box-shadow: 0 0 0 3px rgba(10, 9, 101, 0.1);
    }

    /* Request header card mobile optimizations */
    .request-manage-header {
        padding: var(--space-4) !important;
    }

    .request-manage-header h2 {
        font-size: 1.25rem;
        margin-bottom: var(--space-3);
    }

    .request-manage-header .d-flex {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: var(--space-3);
    }

    .request-manage-header .text-muted {
        font-size: 0.8125rem;
        line-height: 1.8;
    }

    .request-manage-header .badge {
        font-size: 0.6875rem;
        padding: 0.25rem 0.5rem;
    }

    /* Mobile button group */
    .request-manage-buttons {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        gap: var(--space-2);
    }

    .request-manage-buttons .btn-outline-secondary {
        display: none;
    }

    .request-manage-buttons .btn-primary {
        font-size: 0.8125rem;
        padding: var(--space-2) var(--space-3);
    }

    .request-manage-buttons svg {
        display: none;
    }

    /* Add spacing between cards on mobile */
    .card {
        margin-bottom: var(--space-4) !important;
    }

    /* Dashboard mobile optimizations */
    .welcome-card {
        padding: var(--space-4) !important;
    }

    .welcome-card .h4 {
        font-size: 1.25rem !important;
    }

    .welcome-card p:not(.h4) {
        font-size: 0.875rem;
    }

    .info-badge {
        font-size: 0.75rem !important;
        padding: 0.25rem 0.5rem !important;
        display: inline-block;
        margin-bottom: 0.25rem;
    }

    .info-badge.desktop-only {
        display: none !important;
    }

    /* Hide workflow sidebar on mobile, show as dropdown */
    #workflow-list {
        display: none;
    }

    .workflows-mobile-selector {
        display: block !important;
        margin-bottom: var(--space-4);
    }

    .workflows-mobile-dropdown {
        width: 100%;
        padding: var(--space-3);
        border: 1.5px solid var(--border-light);
        border-radius: var(--radius-md);
        background: white;
        font-size: 0.9375rem;
        color: var(--text-primary);
        transition: all var(--transition-base);
    }

    .workflows-mobile-dropdown:focus {
        outline: none;
        border-color: var(--accent-color);
        box-shadow: 0 0 0 3px rgba(15, 185, 179, 0.1);
    }

    /* Workflow header on mobile */
    .workflow-content .d-flex.justify-content-between {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: var(--space-3);
    }

    .workflow-header-info {
        display: none !important;
    }

    .workflow-content .btn-primary {
        width: 100%;
    }

    /* Active requests table on mobile */
    .table-responsive {
        max-height: none !important;
    }

    .table thead {
        display: none !important;
    }

    .table tbody td {
        font-size: 0.8125rem;
        padding: var(--space-3);
        display: block;
        width: 100% !important;
    }

    .table tbody td strong {
        font-size: 0.875rem;
    }

    .table tbody td small {
        font-size: 0.6875rem;
    }

    .desktop-status-col,
    .desktop-last-action-col {
        display: none !important;
    }

    .mobile-status-badge {
        display: inline-flex !important;
        align-items: center;
    }

    .mobile-status-badge .badge {
        font-size: 0.6875rem;
        padding: 0.25rem 0.5rem;
    }

    .table tbody td .d-flex {
        align-items: center !important;
    }
}
