/**
 * WMTMS — Working Productivity Theme
 * Clean, professional green/teal palette with soft shadows and rounded corners
 */

:root {
    /* Primary — green/teal progression (from reference) */
    --primary: #2D8A7F;
    --primary-rgb: 45, 138, 127;
    --primary-light: #6BCB7C;
    --primary-lighter: #A7D94D;
    --primary-pale: #DAF7A6;
    --primary-dark: #1C6C5E;
    --secondary: #4CAF50;
    --accent: #2D8A7F;
    
    /* Background Colors — clean off-white canvas */
    --bg-primary: #F9FAFC;
    --bg-secondary: #F1F3F5;
    --bg-glass: rgba(255, 255, 255, 0.92);
    --bg-glass-hover: rgba(255, 255, 255, 0.98);
    
    /* Text Colors */
    --text-primary: #333333;
    --text-secondary: #6C757D;
    --text-light: #888888;
    
    /* Glass / borders */
    --glass-border: rgba(0, 0, 0, 0.06);
    --glass-shadow: rgba(45, 138, 127, 0.06);
    
    /* Gradients — productivity greens/teals */
    --gradient-primary: linear-gradient(135deg, #2D8A7F 0%, #1C6C5E 100%);
    --gradient-primary-soft: linear-gradient(135deg, #6BCB7C 0%, #4CAF50 100%);
    --gradient-primary-pale: linear-gradient(135deg, #A7D94D 0%, #6BCB7C 100%);
    --gradient-secondary: linear-gradient(135deg, #6BCB7C 0%, #4CAF50 100%);
    --gradient-accent: linear-gradient(135deg, #2D8A7F 0%, #1C6C5E 100%);
    --gradient-bg: linear-gradient(180deg, #F9FAFC 0%, #F1F3F5 100%);
    
    /* Shadows — soft, subtle */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-glass: 0 4px 20px rgba(45, 138, 127, 0.08);
    
    /* Border Radius — rounded, modern */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    background-image: 
        radial-gradient(ellipse 80% 50% at 0% 0%, rgba(167, 217, 77, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(107, 203, 124, 0.05) 0%, transparent 50%);
    min-height: 100vh;
}

/* Glassmorphic Card */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    transition: all var(--transition-base);
}

.glass-card:hover {
    background: var(--bg-glass-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}


/* ============================================================
   Sidebar — Modern, accessible, responsive navigation
   ============================================================ */

:root {
    --sidebar-width: 272px;
    --sidebar-width-collapsed: 76px;
    --sidebar-border: rgba(0, 0, 0, 0.07);
    --sidebar-item-radius: 10px;
    --sidebar-icon-w: 20px;
    --sidebar-text-size: 0.875rem;
    --sidebar-section-size: 0.6875rem;
    --sidebar-transition: 300ms ease-in-out;
}

/* Overlay used on mobile drawer */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--sidebar-transition), visibility var(--sidebar-transition);
    z-index: 890;
}
body.sidebar-mobile-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
}
body.sidebar-mobile-open {
    overflow: hidden;
}

/* Base sidebar shell */
.modern-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 900;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-right: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition:
        width var(--sidebar-transition),
        transform var(--sidebar-transition);
}
.modern-sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
}

/* Header */
.sidebar-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0.875rem 1rem 0.875rem;
    padding-right: 2.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}
.sidebar-logo {
    position: relative;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    background: var(--gradient-primary);
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(45, 138, 127, 0.3);
}
.sidebar-logo-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sidebar-logo-fallback {
    position: relative;
    z-index: 1;
    font-weight: 700;
    font-size: 0.8125rem;
}

.sidebar-brand {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    transition: opacity var(--sidebar-transition);
}
.sidebar-brand-text {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.sidebar-brand-tagline {
    font-size: 0.625rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-collapse-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 10;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.sidebar-collapse-btn:hover {
    background: #eef2f7;
    border-color: rgba(0, 0, 0, 0.14);
    color: #0f172a;
}
.sidebar-collapse-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.sidebar-collapse-icon {
    font-size: 0.6875rem;
    transition: transform var(--sidebar-transition);
    pointer-events: none;
}
.modern-sidebar.collapsed .sidebar-collapse-icon {
    transform: rotate(180deg);
}

/* User chip */
.sidebar-user {
    margin: 0.75rem 0.75rem 0;
    padding: 0.625rem 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 12px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
    transition: margin var(--sidebar-transition), padding var(--sidebar-transition);
}
.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    color: #ffffff;
    font-size: 0.8125rem;
    font-weight: 700;
}
.sidebar-user-info {
    min-width: 0;
    flex: 1;
    transition: opacity var(--sidebar-transition);
}
.sidebar-user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-sub {
    font-size: 0.6875rem;
    color: #94a3b8;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Notification bell button inside the user chip */
.sidebar-notif-btn {
    position: relative;
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.09);
    background: #ffffff;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    flex-shrink: 0;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.sidebar-notif-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: rgba(0, 0, 0, 0.14);
}
.sidebar-notif-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.sidebar-notif-btn[aria-expanded="true"] {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.28);
}
.sidebar-notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 13px;
    height: 13px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    border: 1.5px solid #ffffff;
}

/* Notification panel (sits between user chip and search) */
.sidebar-notif-panel {
    margin: 0.5rem 0.75rem 0;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #f8fafc;
    overflow: hidden;
}
.sidebar-notif-panel:not([hidden]) {
    animation: sidebarSlideDown 200ms ease-out;
}
@keyframes sidebarSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.sidebar-notif-panel-title {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 0.625rem 0.875rem 0.25rem;
}
.sidebar-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.4rem 0.875rem;
    text-decoration: none;
    color: #475569;
    font-size: 0.8125rem;
    transition: background 150ms ease;
}
.sidebar-notif-item:hover {
    background: #eef2f7;
    color: #0f172a;
}
.sidebar-notif-icon {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
    margin-top: 1px;
}
.sidebar-notif-icon.warn    { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.sidebar-notif-icon.success { background: rgba(45, 138, 127, 0.12); color: var(--primary-dark); }
.sidebar-notif-icon.info    { background: rgba(45, 138, 127, 0.12);  color: var(--primary); }
.sidebar-notif-name {
    font-weight: 600;
    font-size: 0.8rem;
    color: #1e293b;
    line-height: 1.3;
}
.sidebar-notif-sub {
    font-size: 0.7375rem;
    color: #94a3b8;
    line-height: 1.3;
}
.sidebar-notif-footer {
    display: block;
    text-align: center;
    padding: 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    transition: background 150ms ease;
}
.sidebar-notif-footer:hover { background: #eff6ff; }

/* Search */
.sidebar-search-wrap {
    position: relative;
    padding: 0.75rem 0.75rem 0;
    flex-shrink: 0;
}
.sidebar-search-icon {
    position: absolute;
    left: 1.375rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: #94a3b8;
    pointer-events: none;
}
.sidebar-search-input {
    width: 100%;
    height: 34px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: #ffffff;
    color: #1e293b;
    font-size: 0.8125rem;
    padding: 0 0.75rem 0 2rem;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.sidebar-search-input::placeholder {
    color: #94a3b8;
}
.sidebar-search-input:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

/* Scroll body */
.sidebar-nav-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.625rem 0 0.5rem;
}
.sidebar-nav-scroll::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav-scroll::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.35);
    border-radius: 999px;
}

/* Menu */
.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0 0.625rem;
}
.sidebar-menu > li {
    margin-bottom: 2px;
}
.sidebar-section-label {
    font-size: var(--sidebar-section-size);
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1rem 0.625rem 0.375rem;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--sidebar-transition);
}

.sidebar-menu > li > a,
.sidebar-submenu-toggle,
.sidebar-bottom-link,
.sidebar-dark-mode {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    border-radius: var(--sidebar-item-radius);
    color: #475569;
    font-size: var(--sidebar-text-size);
    font-weight: 500;
    padding: 0.55rem 0.75rem;
    transition: background 150ms ease, color 150ms ease;
}

.sidebar-submenu-toggle {
    border: 0;
    background: transparent;
    cursor: pointer;
    justify-content: space-between;
    text-align: left;
    font-family: inherit;
}
.sidebar-submenu-toggle .submenu-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
.sidebar-menu > li > a i:first-child,
.sidebar-submenu-toggle .submenu-label i,
.sidebar-bottom-link i,
.sidebar-dark-mode i {
    width: var(--sidebar-icon-w);
    min-width: var(--sidebar-icon-w);
    text-align: center;
    font-size: 0.95rem;
}

.sidebar-menu-text {
    min-width: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--sidebar-transition);
}

.sidebar-menu > li > a:hover,
.sidebar-submenu-toggle:hover,
.sidebar-bottom-link:hover,
.sidebar-dark-mode:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.sidebar-menu > li > a.active,
.sidebar-has-submenu.has-active > .sidebar-submenu-toggle {
    background: #eef2ff;
    color: #1d4ed8;
    font-weight: 600;
}
.sidebar-menu > li > a.active i:first-child,
.sidebar-has-submenu.has-active > .sidebar-submenu-toggle .submenu-label i {
    color: #1d4ed8;
}

/* Focus styles for WCAG 2.1 AA keyboard users */
.sidebar-menu > li > a:focus-visible,
.sidebar-submenu-toggle:focus-visible,
.sidebar-submenu a:focus-visible,
.sidebar-bottom-link:focus-visible,
.sidebar-dark-mode:focus-within {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Submenu */
.sidebar-submenu-toggle .submenu-chevron {
    font-size: 0.625rem;
    color: #94a3b8;
    transition: transform var(--sidebar-transition), color var(--sidebar-transition);
    margin-left: auto;
}
.sidebar-has-submenu.open > .sidebar-submenu-toggle .submenu-chevron {
    transform: rotate(90deg);
    color: #1d4ed8;
}

.sidebar-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--sidebar-transition);
}
.sidebar-has-submenu.open > .sidebar-submenu {
    max-height: 520px;
}
.sidebar-submenu li {
    margin-bottom: 1px;
}
.sidebar-submenu a {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: #64748b;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.45rem 0.75rem;
    margin-left: calc(var(--sidebar-icon-w) + 0.5rem);
    transition: background 150ms ease, color 150ms ease;
}
.sidebar-submenu a:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.sidebar-submenu a.active {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}

/* Sidebar date & time */
.sidebar-datetime {
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    padding: 0.5rem 0.75rem 0.625rem;
    flex-shrink: 0;
    transition: opacity var(--sidebar-transition);
}
.sidebar-datetime-label {
    font-size: 0.625rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.25rem;
}
.sidebar-datetime-gregorian,
.sidebar-datetime-islamic {
    font-size: 0.75rem;
    color: #475569;
    line-height: 1.35;
}
.sidebar-datetime-islamic {
    color: #64748b;
    font-size: 0.6875rem;
}

/* Bottom area */
.sidebar-bottom {
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    padding: 0.625rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}
.sidebar-bottom-label {
    font-size: 0.625rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.4rem 0.75rem 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--sidebar-transition);
}

.sidebar-toggle-switch {
    margin-left: auto;
    width: 36px;
    height: 20px;
    border-radius: 999px;
    border: none;
    padding: 0;
    cursor: pointer;
    background: #cbd5e1;
    position: relative;
    transition: background 150ms ease;
}
.sidebar-toggle-switch[aria-checked="true"] {
    background: var(--primary);
}
.sidebar-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 150ms ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.sidebar-toggle-switch[aria-checked="true"] .sidebar-toggle-thumb {
    transform: translateX(16px);
}

/* Collapsed desktop/tablet state */
.modern-sidebar.collapsed .sidebar-header {
    padding: 0.5rem;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
    justify-content: center;
    min-height: 44px;
}
.modern-sidebar.collapsed .sidebar-logo {
    width: 0 !important;
    min-width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    visibility: hidden;
}
.modern-sidebar.collapsed .sidebar-collapse-btn {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    transform: none;
    margin: 0 auto;
}
.modern-sidebar.collapsed .sidebar-brand,
.modern-sidebar.collapsed .sidebar-menu-text,
.modern-sidebar.collapsed .sidebar-section-label,
.modern-sidebar.collapsed .sidebar-bottom-label,
.modern-sidebar.collapsed .sidebar-datetime,
.modern-sidebar.collapsed .submenu-chevron,
.modern-sidebar.collapsed .sidebar-user-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
}
.modern-sidebar.collapsed .sidebar-notif-btn,
.modern-sidebar.collapsed .sidebar-notif-panel {
    display: none;
}
.modern-sidebar.collapsed .sidebar-lang-row {
    justify-content: center;
    padding: 0.45rem 0.35rem;
}
.modern-sidebar.collapsed .sidebar-lang-row > i,
.modern-sidebar.collapsed .sidebar-lang-row > .sidebar-menu-text {
    display: none;
}
.modern-sidebar.collapsed .sidebar-lang-switch {
    margin-inline-start: 0;
    width: 100%;
    justify-content: center;
}
.modern-sidebar.collapsed .sidebar-lang-long {
    display: none !important;
}
.modern-sidebar.collapsed .sidebar-lang-short {
    display: inline !important;
}
.modern-sidebar.collapsed .sidebar-user {
    margin: 0.625rem 0.5rem 0;
    justify-content: center;
    padding: 0.5rem;
}
.modern-sidebar.collapsed .sidebar-search-input {
    display: none;
}
.modern-sidebar.collapsed .sidebar-search-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.625rem 0.5rem 0;
}
.modern-sidebar.collapsed .sidebar-search-icon {
    position: static;
    transform: none;
}
.modern-sidebar.collapsed .sidebar-menu > li > a,
.modern-sidebar.collapsed .sidebar-submenu-toggle,
.modern-sidebar.collapsed .sidebar-bottom-link,
.modern-sidebar.collapsed .sidebar-dark-mode {
    justify-content: center;
    padding: 0.55rem;
}
.modern-sidebar.collapsed .sidebar-submenu {
    max-height: 0 !important;
}
.modern-sidebar.collapsed .sidebar-toggle-switch {
    display: none;
}

/* Main content offset (desktop default) */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: 100vh;
    transition: margin-left var(--sidebar-transition);
}
body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-width-collapsed);
}

/* Tablet: still fixed, just slimmer layout */
@media (min-width: 768px) and (max-width: 1023px) {
    :root {
        --sidebar-width: 244px;
        --sidebar-width-collapsed: 72px;
    }
    .main-content {
        padding: 1.5rem;
    }
}

/* Mobile drawer */
@media (max-width: 767px) {
    .modern-sidebar {
        transform: translateX(-100%);
        width: min(86vw, 320px);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.18);
    }
    .modern-sidebar.open {
        transform: translateX(0);
    }
    .modern-sidebar.collapsed {
        width: min(86vw, 320px);
    }
    .main-content,
    body.sidebar-collapsed .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .modern-sidebar,
    .sidebar-submenu,
    .submenu-chevron,
    .sidebar-overlay,
    .main-content {
        transition: none !important;
    }
}

/* Language row — pill toggle aligned with login page */
.sidebar-lang-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: var(--sidebar-item-radius);
    color: #475569;
    font-size: var(--sidebar-text-size);
    font-weight: 500;
    padding: 0.55rem 0.75rem;
    transition: background 150ms ease, color 150ms ease;
}
.sidebar-lang-row > i {
    width: var(--sidebar-icon-w);
    min-width: var(--sidebar-icon-w);
    text-align: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    color: var(--primary);
    opacity: 0.9;
}
.sidebar-lang-switch {
    display: inline-flex;
    align-items: center;
    padding: 3px;
    margin-inline-start: auto;
    flex-shrink: 0;
    justify-content: flex-end;
    gap: 0;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    transition: opacity var(--sidebar-transition);
}
.sidebar-lang-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.38rem 0.85rem;
    border-radius: 999px;
    font-family: inherit;
    line-height: 1.2;
    transition: color 0.2s ease, background 0.2s ease;
    min-height: 0;
}
.sidebar-lang-short {
    display: none;
}
.sidebar-lang-btn:hover {
    color: var(--primary-dark);
}
.sidebar-lang-btn.is-active,
.sidebar-lang-btn[aria-current="true"] {
    background: var(--gradient-primary);
    color: #ffffff;
    box-shadow: none;
}
.sidebar-lang-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Sign-out link — subtle red accent */
.sidebar-signout-link              { color: #dc2626 !important; }
.sidebar-signout-link:hover        { background: rgba(220, 38, 38, 0.08) !important; color: #b91c1c !important; }

/* ── Mobile topbar ── */
/* Hidden on desktop and tablet; shown only on mobile (<768 px) */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 950;
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    gap: 0.75rem;
}
.mobile-topbar-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #f8fafc;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 150ms ease, color 150ms ease;
    flex-shrink: 0;
}
.mobile-topbar-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.mobile-topbar-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.mobile-topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    flex: 1;
    min-width: 0;
}
.mobile-topbar-logo {
    height: 28px;
    width: auto;
    flex-shrink: 0;
}
.mobile-topbar-title {
    font-size: 0.9375rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #0f172a;
}
.mobile-topbar-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    min-width: 13px;
    height: 13px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 1.5px solid #ffffff;
}

@media (max-width: 767px) {
    .mobile-topbar { display: flex; }
    /* Push content below the topbar */
    .main-content,
    body.sidebar-collapsed .main-content {
        padding-top: calc(56px + 1rem);
    }
}

/* Dark mode */
html.dark-mode .modern-sidebar {
    background: #0f172a;
    border-right-color: rgba(255, 255, 255, 0.08);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35);
}
html.dark-mode .sidebar-header,
html.dark-mode .sidebar-bottom {
    border-color: rgba(255, 255, 255, 0.08);
}
html.dark-mode .sidebar-datetime {
    border-color: rgba(255, 255, 255, 0.08);
}
html.dark-mode .sidebar-datetime-label {
    color: #64748b;
}
html.dark-mode .sidebar-datetime-gregorian,
html.dark-mode .sidebar-datetime-islamic {
    color: #94a3b8;
}
html.dark-mode .sidebar-datetime-islamic {
    color: #64748b;
}
html.dark-mode .sidebar-brand-text,
html.dark-mode .sidebar-user-name {
    color: #e2e8f0;
}
html.dark-mode .sidebar-brand-tagline,
html.dark-mode .sidebar-user-sub,
html.dark-mode .sidebar-section-label,
html.dark-mode .sidebar-bottom-label {
    color: #64748b;
}
html.dark-mode .sidebar-collapse-btn,
html.dark-mode .sidebar-search-input,
html.dark-mode .sidebar-user {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}
html.dark-mode .sidebar-search-input {
    color: #e2e8f0;
}
html.dark-mode .sidebar-search-input::placeholder,
html.dark-mode .sidebar-search-icon {
    color: #64748b;
}
html.dark-mode .sidebar-menu > li > a,
html.dark-mode .sidebar-submenu-toggle,
html.dark-mode .sidebar-submenu a,
html.dark-mode .sidebar-bottom-link,
html.dark-mode .sidebar-dark-mode {
    color: #94a3b8;
}
html.dark-mode .sidebar-menu > li > a:hover,
html.dark-mode .sidebar-submenu-toggle:hover,
html.dark-mode .sidebar-submenu a:hover,
html.dark-mode .sidebar-bottom-link:hover,
html.dark-mode .sidebar-dark-mode:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
}
html.dark-mode .sidebar-menu > li > a.active,
html.dark-mode .sidebar-has-submenu.has-active > .sidebar-submenu-toggle,
html.dark-mode .sidebar-submenu a.active {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd !important;
}
html.dark-mode .sidebar-toggle-switch {
    background: rgba(148, 163, 184, 0.4);
}
html.dark-mode .sidebar-toggle-switch[aria-checked="true"] {
    background: #3b82f6;
}

/* Dark mode — new sidebar components */
html.dark-mode .sidebar-user-sub { color: #64748b; }

html.dark-mode .sidebar-notif-btn {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}
html.dark-mode .sidebar-notif-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}
html.dark-mode .sidebar-notif-btn[aria-expanded="true"] {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}
html.dark-mode .sidebar-notif-badge  { border-color: #0f172a; }
html.dark-mode .sidebar-notif-panel  {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.08);
}
html.dark-mode .sidebar-notif-panel-title { color: #64748b; }
html.dark-mode .sidebar-notif-item        { color: #94a3b8; }
html.dark-mode .sidebar-notif-item:hover  { background: rgba(255, 255, 255, 0.06); color: #e2e8f0; }
html.dark-mode .sidebar-notif-name        { color: #e2e8f0; }
html.dark-mode .sidebar-notif-sub         { color: #64748b; }
html.dark-mode .sidebar-notif-footer      { border-top-color: rgba(255, 255, 255, 0.08); color: #93c5fd; }
html.dark-mode .sidebar-notif-footer:hover { background: rgba(59, 130, 246, 0.12); }

html.dark-mode .sidebar-lang-row    { color: #94a3b8; }
html.dark-mode .sidebar-lang-switch {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}
html.dark-mode .sidebar-lang-btn    { color: #94a3b8; }
html.dark-mode .sidebar-lang-btn:hover { color: #e2e8f0; }
html.dark-mode .sidebar-lang-btn.is-active,
html.dark-mode .sidebar-lang-btn[aria-current="true"] {
    background: var(--gradient-primary);
    color: #ffffff;
}

html.dark-mode .sidebar-signout-link       { color: #f87171 !important; }
html.dark-mode .sidebar-signout-link:hover { background: rgba(239, 68, 68, 0.12) !important; color: #fca5a5 !important; }

html.dark-mode .mobile-topbar {
    background: #0f172a;
    border-bottom-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
html.dark-mode .mobile-topbar-btn {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}
html.dark-mode .mobile-topbar-btn:hover  { background: rgba(255, 255, 255, 0.08); color: #e2e8f0; }
html.dark-mode .mobile-topbar-title      { color: #e2e8f0; }
html.dark-mode .mobile-topbar-badge      { border-color: #0f172a; }

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header h1 i {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Coming Soon page */
.coming-soon-page {
    min-height: calc(100vh - 4rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}
.coming-soon-card {
    max-width: 480px;
    width: 100%;
    padding: 3rem 2rem;
    text-align: center;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
}
.coming-soon-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    color: #fff;
    font-size: 2.25rem;
    box-shadow: 0 8px 24px rgba(45, 138, 127, 0.3);
}
.coming-soon-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}
.coming-soon-subtitle {
    font-size: 1.0625rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}
.coming-soon-phases {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}
.coming-soon-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary-dark);
    background: rgba(45, 138, 127, 0.12);
    border: 1px solid rgba(45, 138, 127, 0.25);
    border-radius: 999px;
}
.coming-soon-message {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 1.75rem;
    line-height: 1.6;
}
.coming-soon-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}
.coming-soon-actions .btn-modern {
    min-width: 200px;
    justify-content: center;
}
html.dark-mode .coming-soon-icon {
    box-shadow: 0 8px 24px rgba(45, 138, 127, 0.22);
}
html.dark-mode .coming-soon-badge {
    color: #34d399;
    background: rgba(45, 138, 127, 0.15);
    border-color: rgba(45, 138, 127, 0.3);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-glass);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-base);
}

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

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

.stat-card:hover .stat-card-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    line-height: 1;
}

.stat-card-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-card-trend {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.stat-card-trend.up {
    color: var(--primary-dark);
    background: rgba(45, 138, 127, 0.1);
}

.stat-card-trend.down {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.1);
}

/* Modern Button */
.btn-modern {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9375rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width var(--transition-base), height var(--transition-base);
}

.btn-modern:hover::before {
    width: 300px;
    height: 300px;
}

.btn-modern span {
    position: relative;
    z-index: 1;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(45, 138, 127, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(45, 138, 127, 0.35);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--gradient-secondary);
    color: white;
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

.btn-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-glass:hover {
    background: var(--bg-glass-hover);
    transform: translateY(-2px);
}

/* Modern Table */
.table-container {
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-glass);
}

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

.table-modern thead {
    background: rgba(45, 138, 127, 0.08);
}

.table-modern th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
}

.table-modern td {
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

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

.table-modern tbody tr:hover {
    background: rgba(45, 138, 127, 0.06);
    transform: scale(1.01);
}

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

/* Badge */
.badge-modern {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success {
    background: rgba(45, 138, 127, 0.15);
    color: var(--primary-dark);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.badge-info {
    background: rgba(96, 165, 250, 0.15);
    color: var(--primary);
}

/* Form Elements */
.form-group-modern {
    margin-bottom: 1.5rem;
}

.form-label-modern {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.form-control-modern {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-control-modern:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45, 138, 127, 0.12);
    background: rgba(255, 255, 255, 0.9);
}

.form-control-modern::placeholder {
    color: var(--text-light);
}

/* Alert */
.alert-modern {
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid;
    transition: all var(--transition-base);
}

.alert-modern:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.alert-success {
    background: rgba(45, 138, 127, 0.1);
    border-color: rgba(45, 138, 127, 0.3);
    color: #065f46;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #991b1b;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #92400e;
}

.alert-info {
    background: rgba(96, 165, 250, 0.1);
    border-color: rgba(96, 165, 250, 0.3);
    color: #1e40af;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .modern-navbar {
        padding: 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
}

/* Loading Animation */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(45, 138, 127, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Smooth Page Transitions */
.page-transition {
    animation: fadeInUp var(--transition-base);
}

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

/* User Dropdown */
.user-dropdown {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    min-width: 200px;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-weight: 500;
}

.user-dropdown-item:hover {
    background: rgba(45, 138, 127, 0.1);
    color: var(--primary);
}

.user-dropdown-item i {
    font-size: 1.1rem;
}

.dropdown-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 0.5rem 0;
}
