/* 
 * بوصلة كلينك - Modern UI Design System
 * تصميم حديث وعصري للواجهة
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --primary: #059669;
    --primary-dark: #047857;
    --primary-light: #d1fae5;
    --primary-gradient: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
    
    --secondary: #6366f1;
    --secondary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --sidebar-bg: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    --sidebar-width: 280px;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Seamless Navigation — بدون View Transitions
   السايدبار والهيدر ثابتين عبر الكاش في sidebar-preload.js
   التنقل فوري — لا bitmap snapshots — صفر وميض
   ============================================ */

/* الصفحة ظاهرة دائمًا */
body:has(#sidebar),
body:has(#sidebar).page-ready,
body:has(#sidebar):not(.page-ready) {
    opacity: 1;
}

/* المحتوى يظهر فورًا بدون animation */
body:has(#sidebar) main > *:not(#shared-header) {
    opacity: 1;
    transform: none;
}

/* تثبيت الهيدر دائمًا أثناء التنقل */
body:has(#sidebar) #shared-header {
    opacity: 1 !important;
    transform: none !important;
}

/* قفل مرئي نهائي لعناصر الهيكل المشترك — فقط قبل تفعيل التفاعل */
body:has(#sidebar) #sidebar:not(.sidebar-interactive),
body:has(#sidebar) #shared-header,
body:has(#sidebar) #sidebar:not(.sidebar-interactive) .sidebar-logo-icon,
body:has(#sidebar) #sidebar:not(.sidebar-interactive) .sidebar-logo-icon img,
body:has(#sidebar) #sidebar:not(.sidebar-interactive) nav,
body:has(#sidebar) #sidebar:not(.sidebar-interactive) .sidebar-group,
body:has(#sidebar) #sidebar:not(.sidebar-interactive) .sidebar-group-items,
body:has(#sidebar) #sidebar:not(.sidebar-interactive) .sidebar-link {
    transition: none !important;
    animation: none !important;
}

/* تأمين اللوجو: مقاس ثابت + خلفية احتياطية لتفادي الوميض */
#sidebar .sidebar-logo-icon {
    min-width: 2.5rem;
    min-height: 2.5rem;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    background: var(--sidebar-accent, #10b981);
}
#sidebar .sidebar-logo-icon img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* لا ينكمش أو يختفي أثناء التنقل */
}

/* ============================================
   Shared Header Styles
   ============================================ */
.shared-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.shared-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .shared-header-inner {
        padding: 0.75rem 1.5rem;
    }
}

.shared-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.shared-header-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.shared-header-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 768px) {
    .shared-header-title {
        font-size: 1.25rem;
    }
}

.shared-header-subtitle {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 768px) {
    .shared-header-subtitle {
        font-size: 0.8125rem;
    }
}

.shared-header-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .shared-header-actions {
        gap: 0.625rem;
    }
}

/* Header Buttons */
.header-menu-btn {
    padding: 0.5rem;
    color: #6b7280;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    border: none;
    background: none;
    cursor: pointer;
}

.header-menu-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.header-icon-btn {
    position: relative;
    padding: 0.5rem;
    color: #6b7280;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
}

.header-icon-btn:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #e5e7eb;
}

.header-action-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 600;
    transition: all var(--transition-fast);
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .header-action-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

.header-btn-primary {
    background: var(--primary);
    color: #fff;
}

.header-btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.header-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.header-btn-secondary:hover {
    background: #e5e7eb;
}

.header-btn-warning {
    background: #f59e0b;
    color: #fff;
}

.header-btn-warning:hover {
    background: #d97706;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.header-btn-danger {
    background: #fee2e2;
    color: #dc2626;
}

.header-btn-danger:hover {
    background: #fecaca;
}

/* ============================================
   Modern Sidebar Styles
   ============================================ */
.sidebar {
    background: var(--sidebar-bg);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    min-height: 0 !important;
    position: sticky;
    top: 0;
    align-self: flex-start;
    overflow: hidden;
}

.sidebar-link {
    transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
    border-radius: var(--radius-md);
    margin: 2px 4px;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent; /* مساحة ثابتة — لا يتغير حجم العنصر عند التفعيل */
}

.sidebar-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.sidebar-link:hover::before {
    transform: translateX(100%);
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.08);
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(var(--sidebar-accent-rgb, 16, 185, 129), 0.2) 0%, rgba(var(--sidebar-accent-rgb, 16, 185, 129), 0.08) 100%);
    color: white;
    border: 1px solid rgba(var(--sidebar-accent-rgb, 16, 185, 129), 0.3);
}

.sidebar-group {
    margin: 0 8px 8px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.sidebar-group:hover {
    border-color: rgba(var(--sidebar-accent-rgb, 16, 185, 129), 0.24);
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-group-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.sidebar-group-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-group-icon {
    color: var(--sidebar-icon-color, inherit);
}

.sidebar-group-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-group-arrow {
    color: var(--sidebar-text-color, #94a3b8);
    transition: transform var(--transition-normal), color var(--transition-fast);
}

.sidebar-group.open .sidebar-group-arrow {
    transform: rotate(180deg);
    color: var(--sidebar-accent, #10b981);
}

.sidebar-group-items {
    max-height: 0;
    opacity: 0;
    transform: translateY(-4px);
    overflow: hidden;
    padding: 0 6px;
    transition: max-height 0.28s ease, opacity 0.2s ease, transform 0.2s ease, padding 0.2s ease;
}

.sidebar-group.open .sidebar-group-items {
    max-height: 2000px;
    opacity: 1;
    transform: translateY(0);
    padding: 4px 6px 8px;
}

.sidebar-group .sidebar-link {
    margin: 2px 0;
}

/* Sidebar header wrapper */
.sidebar-header-wrap {
    position: relative;
    overflow: hidden;
}

/* Language toggle button - absolute in header corner */
.lang-toggle-btn {
    cursor: pointer;
    height: 24px;
    padding: 0 6px !important;
    flex-direction: row !important;
    white-space: nowrap;
}
.sidebar-lang-abs {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    z-index: 2;
}
.lang-toggle-label {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.sidebar-user-icon-wrap {
    position: relative;
}

.sidebar-user-edit-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(15, 23, 42, 0.8);
    color: #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
    transform: translateY(2px);
}

.sidebar-user-icon-wrap:hover .sidebar-user-edit-btn,
.sidebar-user-edit-btn:focus-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.sidebar-user-edit-btn:hover {
    background: rgba(15, 23, 42, 0.96);
}

/* On touch/mobile keep UI clean: actions open by tapping avatar area (JS), so hide persistent edit badge */
@media (hover: none), (max-width: 768px) {
    .sidebar-user-edit-btn {
        display: none;
    }
}

.sidebar-user-photo-actions {
    position: absolute;
    top: auto;
    bottom: calc(100% + 8px);
    inset-inline-start: 0;
    min-width: 132px;
    padding: 6px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(15, 23, 42, 0.96);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.34);
    z-index: 60;
}

.sidebar-user-photo-action-btn {
    width: 100%;
    border: 0;
    background: transparent;
    color: #e2e8f0;
    text-align: start;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.sidebar-user-photo-action-btn:hover {
    background: rgba(148, 163, 184, 0.14);
}

.sidebar-user-photo-action-btn.danger {
    color: #fca5a5;
}

.sidebar-user-photo-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Mobile Sidebar */
@media (max-width: 768px) {
    .sidebar {
        opacity: 0.96;
        transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.24s ease;
        will-change: transform;
    }
    [dir="rtl"] .sidebar,
    .sidebar {
        transform: translateX(104%);
    }
    [dir="ltr"] .sidebar {
        transform: translateX(-104%);
    }
    .sidebar.open {
        transform: translateX(0) !important;
        opacity: 1;
    }

    #sidebar-overlay {
        transition: opacity 0.2s ease;
        opacity: 1;
        backdrop-filter: blur(1.5px);
    }

    #sidebar-overlay.hidden {
        opacity: 0;
        pointer-events: none;
    }
}

/* Custom Scrollbar for Sidebar */
.custom-scroll::-webkit-scrollbar { width: 4px; }
.custom-scroll::-webkit-scrollbar-track { background: transparent; }
.custom-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.custom-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ============================================
   Modern Card Styles
   ============================================ */
.modern-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 24px;
    transition: all var(--transition-normal);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.modern-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.modern-card:hover::before {
    opacity: 1;
}

.modern-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

/* Stat Cards */
.stat-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 24px;
    transition: all var(--transition-normal);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-normal);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1);
}

/* ============================================
   Modern Button Styles
   ============================================ */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn-modern::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.btn-modern:hover::before {
    transform: translateX(100%);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb, 16, 185, 129), 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(var(--primary-rgb, 16, 185, 129), 0.45);
}

.btn-secondary {
    background: var(--secondary-gradient);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.45);
}

/* ============================================
   Modern Input Styles
   ============================================ */
.input-modern {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-md);
    background: #f9fafb;
    transition: all var(--transition-fast);
    font-size: 14px;
}

.input-modern:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb, 16, 185, 129), 0.1);
}

.input-modern::placeholder {
    color: #9ca3af;
}

/* ============================================
   Modern Table Styles
   ============================================ */
.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-modern thead {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-modern th {
    padding: 14px 16px;
    text-align: right;
    font-weight: 600;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
}

.table-modern td {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    transition: all var(--transition-fast);
}

.table-modern tbody tr {
    transition: all var(--transition-fast);
}

.table-modern tbody tr:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.table-modern tbody tr:hover td {
    border-color: rgba(var(--primary-rgb, 16, 185, 129), 0.2);
}

/* ============================================
   Modern Modal Styles
   ============================================ */
.modal-modern {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    max-width: 600px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1000;
    overflow-y: auto;
}
.modal-overlay.hidden {
    display: none !important;
}

/* ============================================
   Modern Badge Styles
   ============================================ */
.badge-modern {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
}

.badge-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.badge-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.badge-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

/* ============================================
   Quick Actions
   ============================================ */
.quick-action {
    background: white;
    border-radius: var(--radius-xl);
    padding: 28px;
    text-align: center;
    transition: all var(--transition-normal);
    border: 2px solid transparent;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.quick-action::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(var(--primary-rgb, 16, 185, 129), 0.05) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.quick-action:hover::after {
    opacity: 1;
}

.quick-action:hover {
    border-color: var(--primary);
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 16px 32px rgba(5, 150, 105, 0.2);
}

.quick-action-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    position: relative;
    z-index: 1;
    transition: transform var(--transition-normal);
}

.quick-action:hover .quick-action-icon {
    transform: scale(1.15);
}

/* ============================================
   Modern Header
   ============================================ */
.header-modern {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.95); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.animate-fade-in {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide-in {
    animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-scale-in {
    animation: scaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Staggered Animation Delays */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* ============================================
   Loading States
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

/* ============================================
   Main Content Scrollbar
   ============================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f8fafc; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #cbd5e1, #94a3b8); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #94a3b8, #64748b); }

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        transition: transform 0.3s ease;
        width: 100%;
        max-width: 320px;
    }
    [dir="rtl"] .sidebar,
    .sidebar {
        transform: translateX(100%);
    }
    [dir="ltr"] .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0) !important;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .quick-action {
        padding: 20px;
    }
    
    .quick-action-icon {
        width: 56px;
        height: 56px;
    }
}

/* ============================================
   Glass Morphism Effect
   ============================================ */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.glass-dark {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   Gradient Text
   ============================================ */
.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   Hover Effects
   ============================================ */
.hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(var(--primary-rgb, 16, 185, 129), 0.4);
}

/* ============================================
   Focus States
   ============================================ */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 16, 185, 129), 0.3);
}

/* ============================================
   Activity Items
   ============================================ */
.activity-item {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.activity-item:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-color: rgba(var(--primary-rgb, 16, 185, 129), 0.2);
    transform: translateX(-4px);
}

/* ============================================
   Live Indicator
   ============================================ */
.live-dot {
    width: 8px;
    height: 8px;
    background: var(--sidebar-accent, #10b981);
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 8px rgba(var(--sidebar-accent-rgb, 16, 185, 129), 0.6);
}

/* ============================================
   Dashboard Welcome Banner
   ============================================ */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary, #059669) 0%, #14b8a6 50%, #0ea5e9 100%);
    border-radius: var(--radius-2xl);
    padding: 28px 32px;
    position: relative;
    overflow: hidden;
    color: white;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: welcomeFloat 8s ease-in-out infinite;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: welcomeFloat 6s ease-in-out infinite reverse;
}

@keyframes welcomeFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(20px, -20px) scale(1.05); }
    66% { transform: translate(-10px, 15px) scale(0.95); }
}

.welcome-banner .welcome-content {
    position: relative;
    z-index: 1;
}

/* ============================================
   Enhanced Stat Cards (Dashboard)
   ============================================ */
.stat-card-enhanced {
    background: white;
    border-radius: var(--radius-xl);
    padding: 24px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.06);
    position: relative;
    overflow: hidden;
    cursor: default;
}

.stat-card-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    transition: height 0.4s ease, opacity 0.3s ease;
    opacity: 0.7;
}

.stat-card-enhanced:hover::before {
    height: 100%;
    opacity: 0.04;
}

.stat-card-enhanced:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px -8px rgba(0,0,0,0.12);
    border-color: transparent;
}

.stat-card-enhanced .stat-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.stat-card-enhanced .stat-icon-wrap::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card-enhanced:hover .stat-icon-wrap {
    transform: scale(1.1) rotate(-5deg);
}

.stat-card-enhanced:hover .stat-icon-wrap::after {
    opacity: 0.15;
}

.stat-card-enhanced .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card-enhanced .stat-label {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-top: 2px;
}

.stat-card-enhanced .stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    margin-top: 8px;
}

.stat-trend.up {
    color: #059669;
    background: #ecfdf5;
}

.stat-trend.down {
    color: #dc2626;
    background: #fef2f2;
}

/* Sparkline in stat cards */
.stat-sparkline {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    opacity: 0.08;
    transition: opacity 0.3s ease;
}

.stat-card-enhanced:hover .stat-sparkline {
    opacity: 0.15;
}

/* ============================================
   Enhanced Quick Actions (Dashboard)
   ============================================ */
.quick-action-enhanced {
    background: white;
    border-radius: var(--radius-xl);
    padding: 24px 20px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.06);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.quick-action-enhanced::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.quick-action-enhanced:hover::before {
    opacity: 1;
}

.quick-action-enhanced:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 16px 32px -8px rgba(0,0,0,0.15);
    border-color: transparent;
}

.quick-action-enhanced:active {
    transform: translateY(-2px) scale(0.98);
}

.quick-action-enhanced .qa-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    position: relative;
    z-index: 1;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-action-enhanced:hover .qa-icon {
    transform: scale(1.12) rotate(-3deg);
    box-shadow: 0 8px 24px -4px currentColor;
}

.quick-action-enhanced .qa-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #1f2937;
    transition: color 0.3s ease;
    position: relative;
    z-index: 1;
}

.quick-action-enhanced .qa-desc {
    font-size: 0.8125rem;
    color: #9ca3af;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}

/* Ripple effect on quick action click */
.quick-action-enhanced .ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 0.6s linear;
    background: rgba(255,255,255,0.5);
    pointer-events: none;
}

@keyframes ripple {
    to { transform: scale(4); opacity: 0; }
}

/* ============================================
   Dashboard Section Headers
   ============================================ */
.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.section-header .section-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-header .section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
}

/* ============================================
   Chart Containers (Dashboard)
   ============================================ */
.chart-container {
    background: white;
    border-radius: var(--radius-xl);
    padding: 24px;
    border: 1px solid rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chart-container:hover::before {
    opacity: 1;
}

.chart-container:hover {
    box-shadow: 0 8px 24px -4px rgba(0,0,0,0.08);
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.chart-header h2 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #1f2937;
}

.chart-period-selector {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 2px;
    border-radius: 8px;
}

.chart-period-btn {
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #64748b;
}

.chart-period-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ============================================
   List Containers (Dashboard)
   ============================================ */
.list-container {
    background: white;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(0,0,0,0.06);
    overflow: hidden;
    transition: all 0.3s ease;
}

.list-container:hover {
    box-shadow: 0 8px 24px -4px rgba(0,0,0,0.08);
}

.list-header {
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #fafbfc 0%, #ffffff 100%);
}

.list-header h2 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #1f2937;
}

.list-body {
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
}

/* ============================================
   Dashboard Grid Responsive
   ============================================ */
.dashboard-grid {
    display: grid;
    gap: 20px;
}

@media (min-width: 640px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .dashboard-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================
   Micro Interactions
   ============================================ */
@keyframes countPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.count-pop {
    animation: countPop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-slide-up {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes breathe {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb, 16, 185, 129), 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(var(--primary-rgb, 16, 185, 129), 0); }
}

.animate-breathe {
    animation: breathe 3s ease-in-out infinite;
}

/* ============================================
   Enhanced Scrollbar for Lists
   ============================================ */
.scroll-thin::-webkit-scrollbar { width: 4px; }
.scroll-thin::-webkit-scrollbar-track { background: transparent; }
.scroll-thin::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }
.scroll-thin::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.empty-state-text {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #6b7280;
}

.empty-state-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.empty-state-action:hover {
    color: var(--primary-dark);
    transform: translateY(-1px);
}
