/* ============================================
   Components CSS - Sidebar, Buttons, Cards, Modals
   ============================================ */

/* --- Sidebar --- */
.sidebar {
    width: 320px;
    background: var(--bg-sidebar);
    border-inline-start: 2px solid var(--border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    position: fixed;
    inset-inline-end: 0;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(180deg, var(--bg-sidebar) 0%, var(--bg-card) 100%);
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-end: 0;
    width: 2px;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0.3;
}

/* Mobile Sidebar - Icons Only */
.sidebar.mobile-icons {
    width: 70px;
    padding: 15px 10px;
}

.sidebar.mobile-icons .logo {
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding-bottom: 15px;
    justify-content: center;
}

.sidebar.mobile-icons .brand-container span,
.sidebar.mobile-icons .brand-text,
.sidebar.mobile-icons .brand-title,
.sidebar.mobile-icons .brand-subtitle {
    display: none !important;
}

.sidebar.mobile-icons .nav-item {
    justify-content: center;
    padding: 12px;
    margin: 4px 0;
    position: relative;
}

.sidebar.mobile-icons .nav-item .nav-text {
    display: none;
}

.sidebar.mobile-icons .nav-item i {
    font-size: 1.3rem;
    width: auto;
}

.sidebar.mobile-icons .quota-box-new,
.sidebar.mobile-icons .user-info {
    display: none;
}

/* Mobile Menu Toggle - DELETED OLD CODES */
/* Handled by unified-layout.css floating toggle */

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Expanded Menu for Mobile Icons */
.nav-item-menu {
    display: none !important;
}

@media (max-width: 768px) {
    .nav-item-menu {
        display: none;
        position: absolute;
        inset-inline-end: 80px;
        top: 0;
        background: var(--card-bg);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 10px 0;
        min-width: 200px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
        z-index: 101;
        animation: slideIn 0.3s ease;
    }

    .nav-item-menu.active {
        display: block !important;
    }

    .nav-item-menu .nav-item {
        width: 100%;
        padding: 12px 20px;
        margin: 0;
        border-radius: 0;
        justify-content: flex-start;
    }

    .nav-item-menu .nav-item .nav-text {
        display: block;
    }
}

.logo {
    font-size: 1.4rem;
    font-weight: 900;
    color: white;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 20px;
    position: relative;
}

.logo::after {
    content: '';
    position: absolute;
    bottom: -2px;
    inset-inline-end: 0;
    width: 60px;
    height: 2px;
    background: var(--gradient-primary);
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    gap: 2px;
}

.logo-line1 {
    font-size: 1.3rem;
    font-weight: 900;
    color: white;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-line2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-top: -2px;
}

.logo span:not(.logo-line1):not(.logo-line2) {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo i {
    font-size: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.3));
}

.nav-item {
    padding: 14px 18px;
    margin: 5px 0;
    border-radius: 14px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border: none;
    background: rgba(99, 102, 241, 0.05);
    border: 2px solid transparent;
    width: 100%;
    text-align: start;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    inset-inline-end: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--gradient-primary);
    transform: scaleY(0);
    transform-origin: center;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 14px 14px 0;
}

.nav-item::after {
    content: '';
    position: absolute;
    inset-inline-end: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.nav-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-main);
    transform: translateX(-10px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: var(--shadow-md);
}

.nav-item:hover::before {
    transform: scaleY(1);
}

.nav-item:hover::after {
    opacity: 0.05;
}

.nav-item>* {
    position: relative;
    z-index: 1;
}

.nav-item.active {
    background: var(--gradient-primary);
    color: white;
    transform: translateX(-10px);
    border-color: var(--primary);
    box-shadow: var(--shadow-primary), var(--shadow-md);
}

.nav-item.active::before {
    transform: scaleY(1);
    background: rgba(255, 255, 255, 0.3);
}

.nav-item.active::after {
    opacity: 0;
}

.nav-item i {
    width: 22px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.nav-item:hover i,
.nav-item.active i {
    transform: scale(1.15);
    background: rgba(255, 255, 255, 0.15);
}

/* Navigation Groups */
.nav-group {
    margin: 8px 0;
}

.nav-group-header {
    padding: 14px 18px;
    margin: 8px 0;
    border-radius: 14px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 800;
    font-size: 0.95rem;
    user-select: none;
    background: rgba(99, 102, 241, 0.08);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.nav-group-header::before {
    content: '';
    position: absolute;
    inset-inline-end: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-primary);
    transform: scaleY(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 14px 14px 0;
}

.nav-group-header:hover {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    transform: translateX(-8px);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: var(--shadow-md);
}

.nav-group-header:hover::before {
    transform: scaleY(1);
}

.nav-group-header.active {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.4);
}

.nav-group-header.active::before {
    transform: scaleY(1);
}

.nav-group-header .nav-group-icon {
    margin-inline-start: auto;
    font-size: 0.8rem;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
}

.nav-group-header:hover .nav-group-icon {
    color: var(--primary);
}

.nav-group-header.active .nav-group-icon {
    transform: rotate(180deg);
    color: var(--primary);
}

.nav-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-inline-end: 20px;
}

.nav-group-items.expanded {
    max-height: 500px;
}

.nav-sub-item {
    padding-inline-end: 40px !important;
    font-size: 0.9rem !important;
    margin: 5px 0 !important;
    background: rgba(99, 102, 241, 0.03) !important;
    border: 1px solid transparent !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.nav-sub-item:hover {
    background: rgba(99, 102, 241, 0.12) !important;
    padding-inline-end: 45px !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
    transform: translateX(-5px) !important;
    box-shadow: var(--shadow-sm) !important;
}

.nav-sub-item i {
    font-size: 1rem !important;
    width: 20px !important;
    transition: all 0.3s ease !important;
}

.nav-sub-item:hover i {
    transform: scale(1.15) !important;
    color: var(--primary) !important;
}

.nav-sub-item.active {
    background: rgba(99, 102, 241, 0.2) !important;
    color: var(--text-main) !important;
    border-color: rgba(99, 102, 241, 0.5) !important;
    font-weight: 700 !important;
    box-shadow: var(--shadow-sm) !important;
}

/* ============================================
   التصميم القديم للرصيد الشهري - محذوف
   تم استبداله بالتصميم الجديد quota-box-new
   ============================================ */

/* ============================================
   تصميم جديد للرصيد الشهري - Monthly Quota New Design
   ============================================ */

.quota-box-new {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    /* Reduced padding for more space */
    margin: 20px 0;
    position: relative;
    overflow: visible;
    /* Changed to visible to ensure content is not clipped */
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

[data-theme="light"] .quota-box-new {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.08);
}

[data-theme="dark"] .quota-box-new {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(99, 102, 241, 0.05) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.quota-box-new::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    border-radius: 16px 16px 0 0;
}

/* Header */
.quota-header-new {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    /* Changed from center to flex-start for better alignment */
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
    /* Further reduced gap */
    min-width: 0;
    width: 100%;
    overflow: visible;
    /* Changed to visible to ensure title is fully visible */
}

.quota-title-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    /* Reduced gap between icon and text */
    flex: 1 1 0%;
    /* Changed to 0% for better flex distribution */
    min-width: 0;
    max-width: none;
    /* Removed max-width restriction */
    overflow: visible;
    /* Ensure text is visible */
    order: 1;
    /* Ensure title comes first */
}

.quota-icon {
    font-size: 0.85rem;
    /* Smaller icon */
    color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    padding: 5px;
    border-radius: 6px;
    width: 26px;
    /* Smaller icon box */
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.quota-title {
    font-size: 0.875rem;
    /* Slightly smaller font (14px) */
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.1px;
    white-space: nowrap;
    overflow: visible;
    /* Changed to visible */
    text-overflow: clip;
    /* Changed from ellipsis to clip to show full text */
    flex: 1 1 auto;
    min-width: fit-content;
    /* Allow text to take needed space */
    max-width: none;
    /* Remove max-width restriction */
    line-height: 1.3;
    /* Better line height */
}

.quota-badge-new {
    font-size: 0.875rem;
    /* Smaller font to match title */
    font-weight: 800;
    color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(139, 92, 246, 0.12) 100%);
    padding: 5px 10px;
    /* Reduced padding */
    border-radius: 8px;
    border: 1.5px solid rgba(99, 102, 241, 0.3);
    min-width: 60px;
    /* Smaller minimum width */
    flex-shrink: 0;
    white-space: nowrap;
    text-align: center;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
    letter-spacing: 0.3px;
    /* Reduced letter spacing */
    order: 2;
    /* Ensure badge comes after title */
    align-self: flex-start;
    /* Align to top */
    margin-top: 1px;
    /* Slight adjustment for alignment */
}

[data-theme="light"] .quota-badge-new {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] .quota-badge-new {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.2);
}

/* Progress Bar */
.quota-progress-wrapper {
    margin: 18px 0;
}

.quota-bar-bg-new {
    width: 100%;
    height: 10px;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .quota-bar-bg-new {
    background: rgba(99, 102, 241, 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .quota-bar-bg-new {
    background: rgba(99, 102, 241, 0.15);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.quota-bar-fill-new {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.quota-bar-fill-new::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Stats */
.quota-stats-new {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

[data-theme="light"] .quota-stats-new {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .quota-stats-new {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.2);
}

.quota-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.quota-stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quota-stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.quota-stat-value-remaining {
    color: #10b981;
}

[data-theme="light"] .quota-stat-value-remaining {
    color: #059669;
}

.quota-stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
    opacity: 0.5;
}

/* Warning */
.quota-warning-new {
    display: none;
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    color: var(--warning);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.quota-warning-new.show {
    display: flex;
}

.quota-warning-new i {
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .quota-box-new {
        padding: 14px;
        margin: 16px 0;
    }

    .quota-header-new {
        flex-direction: row;
        /* Keep horizontal layout on mobile too */
        align-items: flex-start;
        gap: 6px;
    }

    .quota-title-wrapper {
        width: auto;
        flex: 1 1 0%;
        min-width: 0;
        max-width: none;
    }

    .quota-title {
        white-space: nowrap;
        /* Keep single line */
        font-size: 0.8rem;
        /* Even smaller on mobile */
        overflow: visible;
        text-overflow: clip;
        max-width: none;
    }

    .quota-badge-new {
        width: auto;
        min-width: 55px;
        /* Smaller minimum on mobile */
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    .quota-stats-new {
        flex-direction: column;
        gap: 12px;
    }

    .quota-stat-divider {
        width: 100%;
        height: 1px;
    }
}

/* ============================================
   التصميم القديم للرصيد الشهري - محذوف بالكامل
   تم استبداله بالتصميم الجديد quota-box-new
   ============================================ */
.plan-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    visibility: visible !important;
    opacity: 1 !important;
    padding: 6px 14px;
    background: linear-gradient(135deg, #64748b, #475569) !important;
    /* Default to Slate */
    color: #ffffff !important;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    margin-inline-start: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    position: relative;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 60px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.plan-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

/* FREE badge styling - Slate/Gray (Standard/Basic) */
.plan-badge:not([data-is-admin="true"]):not([data-plan-type*="pro"]):not([data-plan-type*="PRO"]) {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%) !important;
    box-shadow: 0 3px 10px rgba(71, 85, 105, 0.4) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #f1f5f9 !important;
}

/* PRO badge styling - Amber/Gold (Premium) */
.plan-badge[style*="f59e0b"],
.plan-badge:contains("PRO"),
.plan-badge[data-plan-type*="pro"],
.plan-badge[data-plan-type*="PRO"]:not([data-is-admin="true"]) {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ADMIN badge styling - Rose/Red (Authority) */
.plan-badge[data-is-admin="true"],
.plan-badge:has-text("ADMIN"),
.plan-badge.admin-badge {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%) !important;
    box-shadow: 0 4px 15px rgba(225, 29, 72, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
    font-weight: 900 !important;
}

/* ============================================
   Tooltips - محسّنة
   ============================================ */
.custom-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    margin-inline-end: 8px;
    z-index: 10;
}

.custom-tooltip i {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.custom-tooltip:hover i {
    color: var(--primary);
    transform: scale(1.2);
}

.tooltip-content {
    position: absolute;
    bottom: 100%;
    inset-inline-end: 50%;
    transform: translateX(50%);
    margin-bottom: 8px;
    background: var(--bg-sidebar);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.6;
    width: 320px;
    max-width: 90vw;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--border);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    text-align: start;
    white-space: normal;
    word-wrap: break-word;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    inset-inline-end: 50%;
    transform: translateX(50%);
    border: 8px solid transparent;
    border-top-color: var(--bg-sidebar);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.custom-tooltip:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(50%) translateY(-4px);
}

/* Fix tooltip positioning to prevent clipping */
.stat-card {
    position: relative;
    overflow: visible !important;
}

.grid-stats {
    position: relative;
    overflow: visible !important;
}

.custom-tooltip {
    position: relative;
    z-index: 1;
}

.tooltip-content strong {
    display: block;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}

.tooltip-content p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Tooltip for Action Buttons (أدوات التحكم اليدوي) */
.action-btn .tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    margin-top: 8px;
}

.action-btn .tooltip i {
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.action-btn .tooltip:hover i {
    color: var(--primary);
    opacity: 1;
    transform: scale(1.15);
}

.action-btn .tooltiptext {
    visibility: hidden;
    opacity: 0;
    background: var(--bg-elevated);
    color: var(--text-main);
    text-align: end;
    border-radius: 12px;
    padding: 12px 16px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    inset-inline-end: 50%;
    transform: translateX(50%);
    min-width: 320px;
    max-width: 300px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--border);
    font-size: 0.85rem;
    line-height: 1.6;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    white-space: normal;
    word-wrap: break-word;
}

/* Tooltip arrow */
.action-btn .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    inset-inline-end: 50%;
    transform: translateX(50%);
    border-width: 8px;
    border-style: solid;
    border-color: var(--bg-elevated) transparent transparent transparent;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.action-btn .tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
    transform: translateX(50%) translateY(-8px);
}

/* Light mode adjustments for tooltips */
[data-theme="light"] .action-btn .tooltiptext {
    background: #ffffff;
    color: #1e293b;
    border-color: #e2e8f0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 4px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .action-btn .tooltiptext::after {
    border-color: #ffffff transparent transparent transparent;
}

/* Dark mode - ensure high contrast */
:root:not([data-theme="light"]) .action-btn .tooltiptext {
    background: #1e293b;
    color: #f0f4f8;
    border-color: #334155;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 4px 8px rgba(0, 0, 0, 0.4);
}

:root:not([data-theme="light"]) .action-btn .tooltiptext::after {
    border-color: #1e293b transparent transparent transparent;
}

/* Header Tooltips */
.header-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    margin-inline-end: 6px;
    vertical-align: middle;
}

.header-tooltip i {
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.header-tooltip:hover i {
    color: var(--primary);
    transform: scale(1.15);
}

.header-tooltip-text {
    position: absolute;
    bottom: calc(100% + 10px);
    inset-inline-end: 50%;
    transform: translateX(50%);
    margin-bottom: 0;
    background: var(--card-bg);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    line-height: 1.5;
    min-width: 200px;
    max-width: 300px;
    white-space: normal;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--border);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    text-align: start;
    word-wrap: break-word;
}

.header-tooltip-text::before {
    content: '';
    position: absolute;
    top: 100%;
    inset-inline-end: 50%;
    transform: translateX(50%);
    border: 6px solid transparent;
    border-top-color: var(--card-bg);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.header-tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    inset-inline-end: 50%;
    transform: translateX(50%);
    margin-top: -2px;
    border: 6px solid transparent;
    border-top-color: var(--border);
}

.header-tooltip:hover .header-tooltip-text {
    opacity: 1;
    visibility: visible;
    transform: translateX(50%) translateY(-4px);
}

/* Fix tooltip positioning in table headers */
th .header-tooltip {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}

th .header-tooltip-text {
    white-space: nowrap;
    min-width: auto;
    max-width: 250px;
}

/* Light mode adjustments */
[data-theme="light"] .header-tooltip-text {
    background: var(--bg-sidebar);
    border-color: var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .header-tooltip-text::before {
    border-top-color: var(--bg-sidebar);
}

/* Buttons */
.action-btn {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(99, 102, 241, 0.08) 100%);
    border: 2px solid var(--border);
    padding: 24px 20px;
    border-radius: 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 140px;
    justify-content: center;
    position: relative;
    overflow: visible;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

/* تحسين التباين للأزرار في الوضع الفاتح */
[data-theme="light"] .action-btn {
    background: linear-gradient(135deg, #ffffff 0%, rgba(99, 102, 241, 0.05) 100%);
    border: 2px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .action-btn {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(99, 102, 241, 0.12) 100%);
    border: 2px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.action-btn:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.12) 100%);
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.35), 0 8px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-width: 3px;
}

.action-btn:hover::before {
    opacity: 0.05;
}

.action-btn>* {
    position: relative;
    z-index: 1;
}

.action-btn i {
    font-size: 2.4rem;
    color: var(--primary);
    margin-bottom: 6px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    width: 72px;
    height: 72px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(99, 102, 241, 0.35);
}

/* تحسين الأيقونات في الوضع الفاتح */
[data-theme="light"] .action-btn i {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(139, 92, 246, 0.12) 100%);
    border: 2px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    color: var(--primary);
}

[data-theme="dark"] .action-btn i {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border: 2px solid rgba(99, 102, 241, 0.4);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    color: var(--primary-light);
}

.action-btn:hover i {
    transform: scale(1.15) rotate(5deg);
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.2);
    border-color: var(--primary-light);
}

/* تحسين زر الأرشفة الفورية */
#indexBtn:hover {
    border-color: var(--success) !important;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(5, 150, 105, 0.15) 100%) !important;
}

#indexBtn:hover i {
    background: var(--gradient-success) !important;
    color: white !important;
    border-color: var(--success-light) !important;
}

.action-btn h4 {
    font-size: 0.9rem;
    margin: 0;
    color: var(--text-main);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.3px;
}

/* تحسين النصوص في الوضع الفاتح */
[data-theme="light"] .action-btn h4 {
    color: #1e293b;
    font-weight: 800;
}

[data-theme="dark"] .action-btn h4 {
    color: #f0f4f8;
    font-weight: 700;
}

.action-btn:hover h4 {
    color: var(--text-main);
}

.action-btn p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
    font-weight: 500;
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    border-color: var(--border) !important;
}

.action-btn:disabled::before {
    display: none;
}

.action-btn:active {
    transform: translateY(-2px) scale(0.98);
}

.btn-primary {
    width: 100%;
    padding: 16px 24px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-primary);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
    text-transform: none;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: inset-inline-start 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    inset-inline-start: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    inset-inline-start: 100%;
}

.btn-primary:hover::after {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    background: var(--gradient-primary);
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-primary), var(--shadow-xl);
}

.btn-primary:active {
    transform: translateY(-2px) scale(0.98);
    box-shadow: var(--shadow-primary);
}

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

/* Secondary button (محايد/إلغاء) */
.btn-secondary {
    width: 100%;
    padding: 14px 20px;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    margin-top: 15px;
    width: 100%;
    font-size: 0.9rem;
    padding: 10px;
}

.btn-text:hover {
    color: white;
}

/* Cards */
.stat-card {
    background: var(--bg-card);
    padding: 24px 20px;
    border-radius: 18px;
    border: 2px solid var(--border);
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    box-shadow: var(--shadow-sm);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.stat-card:hover {
    border-color: var(--primary);
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-primary), var(--shadow-xl);
    background: var(--bg-elevated);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.3px;
    position: relative;
    overflow: visible;
    z-index: 1;
}

.stat-card .val {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-main);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1.2;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card:hover .val {
    transform: scale(1.1);
}

.stat-card .val.updating {
    animation: pulse-scale 0.6s ease-in-out;
    color: var(--primary);
}

@keyframes pulse-scale {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

.stat-card .sub-val {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.stat-card.health .val {
    color: var(--success);
}

.stat-card.indexed .val {
    background: var(--gradient-info);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* تحسين لون إحصائيات "مؤرشفة" في الوضع الفاتح - لون أزرق داكن واضح */
[data-theme="light"] .stat-card.indexed .val {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: #1e40af;
    /* Fallback color - أزرق داكن واضح للوضع الفاتح */
}

[data-theme="light"] .stat-card.indexed {
    border-inline-start: 4px solid #1e40af;
}

[data-theme="light"] .stat-card.indexed:hover {
    border-left-color: #1e40af;
    box-shadow: 0 8px 24px rgba(30, 64, 175, 0.3), var(--shadow-xl);
}

/* تحسين لون الأيقونة في الوضع الفاتح */
[data-theme="light"] .stat-card.indexed .indexed-icon {
    color: #1e40af;
}

.stat-card.indexed {
    border-inline-start: 4px solid var(--info);
}

.stat-card.indexed:hover {
    border-left-color: var(--info);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3), var(--shadow-xl);
}

.stat-card.pending .val {
    background: var(--gradient-warning);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card.pending {
    border-inline-start: 4px solid var(--warning);
}

.stat-card.pending:hover {
    border-left-color: var(--warning);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.3), var(--shadow-xl);
}

.stat-card.health .val {
    background: var(--gradient-success);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card.health {
    border-inline-start: 4px solid var(--success);
}

.stat-card.health:hover {
    border-left-color: var(--success);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3), var(--shadow-xl);
}

/* Modals - محسّنة */
/* Competitor Analysis Modal */
#competitorAnalysisModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 26, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);

    /* Hidden state */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#competitorAnalysisModal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#competitorAnalysisModal .modal-content {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--border);
    position: relative;

    /* Animation - using transform and opacity only for performance */
    transform: scale(0.9) translateY(20px) translateZ(0);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.3s ease;

    /* Performance optimization */
    will-change: transform, opacity;
    /* GPU acceleration */
    backface-visibility: hidden;
    /* Prevent layout shift */
    contain: layout style paint;
}

#competitorAnalysisModal.active .modal-content {
    transform: scale(1) translateY(0) translateZ(0);
    opacity: 1;
    /* Remove will-change after animation completes */
    will-change: auto;
}

#competitorAnalysisModal .modal-content::-webkit-scrollbar {
    width: 8px;
}

#competitorAnalysisModal .modal-content::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-radius: 10px;
}

#competitorAnalysisModal .modal-content::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}

/* Competitors Section Specific Styles */
#competitorsSection {
    padding: 30px !important;
    padding-inline-end: 30px !important;
    padding-inline-start: 30px !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
    position: relative !important;
    /* بدلاً من fixed */
    min-height: 100vh;
    transition: opacity 0.3s ease, transform 0.3s ease;
    /* Performance optimization */
    will-change: opacity, transform;
    /* Prevent layout shift */
    contain: layout style paint;
}

#competitorsSection .table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#competitorsSection table {
    min-width: 1000px;
    width: 100%;
    table-layout: auto;
}

/* Ensure content doesn't shift */
#competitorsSection>* {
    max-width: 100%;
    box-sizing: border-box;
}

#competitorsSection .section-title,
#competitorsSection .breadcrumbs {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#competitorsMetrics {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#competitorsMetrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

#competitorsMetrics .metric-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    /* Performance optimization */
    will-change: transform;
    /* Prevent layout shift */
    min-height: 120px;
    contain: layout style paint;
}

#competitorsMetrics .metric-card:hover {
    transform: translateY(-5px) translateZ(0);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.2);
    /* Remove will-change after hover */
    will-change: auto;
}

/* Responsive adjustments for competitors section */
@media (max-width: 768px) {
    #competitorsSection {
        padding: 20px !important;
    }

    #competitorsMetrics {
        grid-template-columns: 1fr;
    }

    #competitorsSection table {
        min-width: 800px;
    }

    #competitorAnalysisModal .modal-content {
        width: 95%;
        padding: 20px;
    }
}

.modal {
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 26, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(12px);
    animation: fadeIn 0.3s ease;
}

.modal-box {
    background: var(--bg-card);
    padding: 48px;
    border-radius: 24px;
    width: 550px;
    max-width: 92%;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(99, 102, 241, 0.1);
    transform: scale(0.9) translateY(20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-box::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-end: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 24px 24px 0 0;
}

.modal.active .modal-box {
    transform: scale(1) translateY(0);
}

.modal-title {
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--text-main);
    text-align: center;
    margin-bottom: 30px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input,
textarea {
    width: 100%;
    padding: 14px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: 10px;
    outline: none;
    transition: 0.3s;
    font-family: var(--font-family-primary, 'Cairo', sans-serif);
    border: 1px solid var(--border);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

input:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Loader */
.loader {
    position: fixed;
    bottom: 30px;
    inset-inline-start: 30px;
    background: var(--card-bg);
    padding: 15px 25px;
    border-radius: 12px;
    border: 1px solid var(--accent);
    display: none;
    align-items: center;
    gap: 15px;
    z-index: 3000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

/* Badges */
.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    display: inline-block;
    min-width: 90px;
    text-align: center;
}

.b-green {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.b-blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.b-yellow {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.b-red {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.b-purple {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Status Indicators - محسّنة */
.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-inline-start: 8px;
    position: relative;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        box-shadow: 0 0 0 0 currentColor;
        opacity: 1;
    }

    50% {
        box-shadow: 0 0 0 6px transparent;
        opacity: 0.8;
    }
}

.status-online {
    background: var(--success);
    box-shadow: 0 0 0 2px var(--success-bg), 0 0 8px var(--success);
}

.status-offline {
    background: var(--danger);
    box-shadow: 0 0 0 2px var(--danger-bg), 0 0 8px var(--danger);
}

.status-warning {
    background: var(--warning);
    box-shadow: 0 0 0 2px var(--warning-bg), 0 0 8px var(--warning);
}

/* Quick Actions */
.quick-actions {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.quick-actions-title {
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.quick-action-btn {
    background: var(--bg-card);
    border: 2px solid var(--border);
    color: var(--text-main);
    padding: 18px 16px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.quick-action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.quick-action-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    inset-inline-start: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
    z-index: 0;
}

.quick-action-btn:hover::before {
    opacity: 1;
}

.quick-action-btn:hover::after {
    width: 200px;
    height: 200px;
}

.quick-action-btn:hover {
    border-color: var(--primary);
    color: white;
    transform: translateY(-6px) scale(1.05);
    box-shadow: var(--shadow-primary), var(--shadow-lg);
}

.quick-action-btn>* {
    position: relative;
    z-index: 1;
}

.quick-action-btn i {
    font-size: 1.8rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(99, 102, 241, 0.1);
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-action-btn:hover i {
    transform: scale(1.2) rotate(10deg);
    background: rgba(255, 255, 255, 0.2);
    -webkit-text-fill-color: white;
    color: white;
}

.quick-action-btn span {
    transition: all 0.3s ease;
    font-weight: 700;
}

/* Recent Activity Widget */
.recent-activity-widget {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.widget-header {
    padding: 18px 24px;
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(99, 102, 241, 0.03);
}

.widget-header:hover {
    background: rgba(99, 102, 241, 0.08);
}

.widget-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

.widget-header h3 i {
    color: var(--primary);
    font-size: 1.2rem;
}

.widget-toggle {
    background: rgba(99, 102, 241, 0.1);
    border: 2px solid rgba(99, 102, 241, 0.2);
    color: var(--primary);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-toggle:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
    transform: scale(1.1);
}

.widget-content {
    padding: 20px 24px;
    max-height: 450px;
    overflow-y: auto;
    background: var(--bg-dark);
}

.widget-content.collapsed {
    display: none;
}

.activity-item-widget {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
    align-items: start;
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 8px;
}

.activity-item-widget:hover {
    background: rgba(99, 102, 241, 0.05);
    transform: translateX(-5px);
}

.activity-item-widget:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.activity-item-widget:hover .activity-icon {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.activity-icon.success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.activity-icon.info {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

.activity-icon.warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.activity-content {
    flex: 1;
}

.activity-text {
    color: var(--text-main);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.activity-time {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.activity-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

/* Pilot Buttons */
.pilot-btn-container {
    margin-bottom: 20px;
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.pilot-btn {
    background: var(--gradient-primary);
    flex: 1;
    padding: 16px 24px;
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: var(--shadow-primary), var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 52px;
    letter-spacing: 0.5px;
}

.pilot-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    inset-inline-start: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.pilot-btn::after {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: inset-inline-start 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.pilot-btn i {
    font-size: 1.1rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.pilot-btn:hover::before {
    width: 400px;
    height: 400px;
}

.pilot-btn:hover::after {
    inset-inline-start: 100%;
}

.pilot-btn:hover i {
    transform: rotate(20deg) scale(1.2);
}

.pilot-btn:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--shadow-primary), var(--shadow-xl);
    background: var(--gradient-primary);
}

.pilot-btn:active {
    transform: translateY(-3px) scale(0.98);
}

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

.stop-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    flex: 1;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 44px;
}

.stop-btn.show {
    display: flex !important;
}

.stop-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(239, 68, 68, 0.5);
}

.stop-btn:active {
    transform: translateY(-2px);
}

/* Terminal */
/* Enhanced Terminal Box with better styling */
/* Enhanced Terminal Box with better styling */
.terminal-container {
    margin-bottom: 40px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.terminal-box {
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1f2e 100%);
    border-radius: 0 0 18px 18px;
    border: 2px solid var(--border);
    border-top: none;
    height: 400px;
    overflow-y: auto;
    padding: 20px 24px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.7);
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

.terminal-box::-webkit-scrollbar {
    width: 8px;
}

.terminal-box::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

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

.terminal-box::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

.terminal-box::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-end: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

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

.terminal-title {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.terminal-action-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.terminal-action-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

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

.clear-logs {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: 0.3s;
    border: none;
}

.clear-logs:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.log-line {
    margin-bottom: 12px;
    padding: 12px 16px;
    border-inline-end: 3px solid transparent;
    font-size: 0.9rem;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    animation: slideInRight 0.3s ease;
    transition: all 0.2s ease;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.log-line:hover {
    background: rgba(255, 255, 255, 0.05);
    border-right-color: currentColor;
    transform: translateX(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Log card style for enhanced display */
.log-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-inline-end: 3px solid transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.log-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-right-color: currentColor;
    transform: translateX(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.log-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.log-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-card-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.log-time {
    color: #64748b;
    font-size: 0.8rem;
    min-width: 80px;
    flex-shrink: 0;
    font-weight: 600;
    opacity: 0.8;
}

.log-msg {
    flex: 1;
    word-break: break-word;
    line-height: 1.5;
}

/* Enhanced color classes with better visibility */
.c-info {
    color: #3b82f6;
    border-right-color: #3b82f6;
}

.c-success {
    color: #10b981;
    border-right-color: #10b981;
}

.c-error {
    color: #ef4444;
    border-right-color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.c-warn {
    color: #f59e0b;
    border-right-color: #f59e0b;
}

.c-system {
    color: #8b5cf8;
    border-right-color: #8b5cf8;
    font-weight: 600;
}

/* Log badges for status indicators */
.log-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.log-badge-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.log-badge-error {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.log-badge-warning {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.log-badge-info {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.log-badge-system {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    color: #8b5cf8;
}

/* Metadata display */
.log-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.log-metadata-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.log-metadata-label {
    font-weight: 600;
    opacity: 0.7;
}

.log-metadata-value {
    opacity: 0.9;
}

/* Progress bar for long operations */
.log-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.log-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    transition: width 0.3s ease;
    animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Log group styles */
.log-group-container {
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.log-group-container:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.log-group-header {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s ease;
    user-select: none;
}

.log-group-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.log-group-content {
    padding: 8px;
    background: rgba(255, 255, 255, 0.01);
}

.log-group-content .log-card {
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.01);
}

.log-group-content .log-card:last-child {
    margin-bottom: 0;
}

/* Export menu styles */
.terminal-export-option:hover {
    background: var(--bg-elevated) !important;
}

.terminal-export-option:active {
    background: var(--primary) !important;
    color: white !important;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Tables - محسّنة */
.table-wrap {
    background: var(--bg-card);
    border-radius: 20px;
    border: 2px solid var(--border);
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
    box-shadow: var(--shadow-md);
}

.table-wrap::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-end: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 20px 20px 0 0;
}

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

th,
td {
    padding: 20px 28px;
    text-align: start;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 800;
    position: sticky;
    top: 0;
    z-index: 10;
    overflow: visible;
    border-bottom: 2px solid var(--border);
}

th:first-child {
    border-radius: 20px 0 0 0;
}

th:last-child {
    border-radius: 0 20px 0 0;
}

td {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 500;
}

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

tr:hover {
    background: rgba(99, 102, 241, 0.05);
    transform: scale(1.01);
    transition: all 0.2s ease;
}

tr {
    transition: all 0.2s ease;
}

.table-empty {
    text-align: center;
    padding: 40px !important;
    color: var(--text-muted);
}

.action-cell {
    display: flex;
    gap: 8px;
}

.table-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
    border: none;
}

.table-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.table-btn.red {
    color: var(--danger);
    border-color: var(--danger);
}

.table-btn.red:hover {
    background: var(--danger);
    color: white;
}

/* Notifications */
.notifications-bell {
    position: relative;
    cursor: pointer;
    padding: 12px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.notifications-bell:hover {
    background: var(--bg-elevated);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary), var(--shadow-md);
}

.notifications-bell i {
    font-size: 1.3rem;
    color: var(--text-main);
    transition: all 0.3s ease;
}

.notifications-bell:hover i {
    color: var(--primary);
    transform: scale(1.1);
}

.notification-badge {
    position: absolute;
    top: 5px;
    inset-inline-end: 5px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.notifications-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    left: auto;
    width: 380px;
    max-width: 90vw;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 1200;
    /* Above sidebar (1100) but below modals (1300) */
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

/* RTL Support for dropdown */
html[dir="rtl"] .notifications-dropdown {
    right: auto;
    left: 0;
}

html[dir="ltr"] .notifications-dropdown {
    right: 0;
    left: auto;
}

.notifications-dropdown.active {
    display: block;
}

/* Responsive dropdown */
@media (max-width: 768px) {
    .notifications-dropdown {
        position: fixed;
        top: 70px;
        right: 10px;
        left: auto;
        width: calc(100vw - 20px);
        max-width: 380px;
        max-height: calc(100vh - 90px);
        border-radius: 16px;
    }

    html[dir="rtl"] .notifications-dropdown {
        right: auto;
        left: 10px;
    }
}

.notifications-header {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-elevated);
    flex-shrink: 0;
}

.notifications-header h3 {
    font-size: 1rem;
    color: var(--text-main);
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notifications-header h3::before {
    content: '\f0f3';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--primary);
    font-size: 1.1rem;
}

.mark-all-read {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mark-all-read:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.mark-all-read:active {
    transform: translateY(0);
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
    flex-shrink: 0;
}

.notifications-list::-webkit-scrollbar {
    width: 6px;
}

.notifications-list::-webkit-scrollbar-track {
    background: var(--bg-elevated);
    border-radius: 3px;
}

.notifications-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.notifications-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

.notification-item-dropdown {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.notification-item-dropdown::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.notification-item-dropdown:hover {
    background: rgba(99, 102, 241, 0.05);
    transform: translateX(-2px);
}

.notification-item-dropdown:hover::before {
    opacity: 1;
}

.notification-item-dropdown.unread {
    background: rgba(99, 102, 241, 0.08);
    border-inline-start: 3px solid var(--primary);
}

.notification-item-dropdown.unread::before {
    opacity: 1;
}

.notification-item-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.notification-item-empty::before {
    content: '\f0f3';
    font-family: 'Font Awesome 6 Free';
    font-weight: 400;
    font-size: 2rem;
    opacity: 0.3;
    color: var(--text-muted);
}

.notifications-footer {
    padding: 10px 15px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.notifications-footer a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
}

/* ============================================
   Notification Center - Responsive & Smart
   ============================================ */
.notification-center {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-card);
    border-left: 2px solid var(--border);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
}

.notification-center.active {
    transform: translateX(0);
    visibility: visible;
    opacity: 1;
}

/* RTL Support */
html[dir="rtl"] .notification-center {
    right: auto;
    left: 0;
    transform: translateX(-100%);
    border-left: none;
    border-right: 2px solid var(--border);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

html[dir="rtl"] .notification-center.active {
    transform: translateX(0);
    visibility: visible;
    opacity: 1;
}

html[dir="ltr"] .notification-center {
    right: 0;
    left: auto;
    transform: translateX(100%);
    border-left: 2px solid var(--border);
    border-right: none;
}

/* Active state is now defined above */

/* Overlay for mobile/tablet */
.notification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    backdrop-filter: blur(2px);
}

.notification-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Notification Header */
.notification-header {
    padding: 20px;
    border-bottom: 2px solid var(--border);
    background: var(--bg-elevated);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.notification-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification-header h3::before {
    content: '\f0f3';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--primary);
    font-size: 1.2rem;
}

.clear-all-btn {
    background: var(--danger);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.clear-all-btn:hover {
    background: var(--danger-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

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

.clear-all-btn i {
    font-size: 0.8rem;
}

/* Notification List */
.notification-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.notification-list::-webkit-scrollbar {
    width: 6px;
}

.notification-list::-webkit-scrollbar-track {
    background: transparent;
}

.notification-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.notification-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

/* Notification Item */
.notification-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    margin-bottom: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.notification-item::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.notification-item:hover {
    background: var(--bg-elevated);
    border-color: var(--primary);
    transform: translateX(-4px);
    box-shadow: var(--shadow-md);
}

.notification-item:hover::before {
    opacity: 1;
}

.notification-item.read {
    opacity: 0.7;
}

.notification-item.read::before {
    opacity: 0;
}

/* Notification Types */
.notification-item.success {
    border-inline-start-color: var(--success);
}

.notification-item.success::before {
    background: var(--success);
}

.notification-item.error {
    border-inline-start-color: var(--danger);
}

.notification-item.error::before {
    background: var(--danger);
}

.notification-item.warning {
    border-inline-start-color: var(--warning);
}

.notification-item.warning::before {
    background: var(--warning);
}

.notification-item.info {
    border-inline-start-color: var(--info);
}

.notification-item.info::before {
    background: var(--info);
}

/* Notification Icon */
.notification-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: var(--bg-elevated);
    transition: all 0.3s;
}

.notification-item.success .notification-icon {
    background: var(--success-bg);
    color: var(--success);
}

.notification-item.error .notification-icon {
    background: var(--danger-bg);
    color: var(--danger);
}

.notification-item.warning .notification-icon {
    background: var(--warning-bg);
    color: var(--warning);
}

.notification-item.info .notification-icon {
    background: var(--info-bg);
    color: var(--info);
}

/* Notification Content */
.notification-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.notification-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.4;
    word-wrap: break-word;
}

.notification-message {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    word-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-disabled);
    margin-top: 4px;
}

/* Notification Close Button */
.notification-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.6;
}

.notification-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
    opacity: 1;
}

.notification-close:active {
    transform: scale(0.9);
}

.notification-close i {
    font-size: 0.85rem;
}

/* Empty State */
.notification-list:empty::after {
    content: 'لا توجد إشعارات';
    display: block;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .notification-center {
        width: 100%;
        max-width: 100%;
        border-left: none;
        border-right: none;
    }

    html[dir="rtl"] .notification-center {
        border-right: none;
        border-left: none;
    }
}

@media (max-width: 768px) {
    .notification-center {
        width: 100vw;
        max-width: 100vw;
    }

    html[dir="rtl"] .notification-center {
        left: 0;
        right: auto;
        transform: translateX(-100%);
    }

    html[dir="rtl"] .notification-center.active {
        transform: translateX(0);
    }

    html[dir="ltr"] .notification-center {
        right: 0;
        left: auto;
        transform: translateX(100%);
    }

    html[dir="ltr"] .notification-center.active {
        transform: translateX(0);
    }

    .notification-header {
        padding: 16px;
    }

    .notification-header h3 {
        font-size: 1rem;
    }

    .clear-all-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .clear-all-btn span {
        display: none;
    }

    .notification-item {
        padding: 12px;
        margin-bottom: 10px;
    }

    .notification-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .notification-title {
        font-size: 0.9rem;
    }

    .notification-message {
        font-size: 0.8rem;
    }
}

/* Progress Bar Animations */
@keyframes progressPulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
    }

    50% {
        opacity: 0.9;
        box-shadow: 0 0 0 8px rgba(99, 102, 241, 0);
    }
}

@keyframes progressShimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes progressGlow {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.2);
    }
}

/* Enhanced Progress Bar Styles */
#contentGapProgressBar,
#gapAnalysisProgressBar {
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #a855f7, #6366f1) !important;
    background-size: 200% 100% !important;
    animation: progressShimmer 3s linear infinite, progressGlow 2s ease-in-out infinite !important;
    position: relative;
    overflow: hidden;
}

#contentGapProgressBar::after,
#gapAnalysisProgressBar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShimmer 2s linear infinite;
}

/* Progress Container Enhancements */
#contentGapProgressContainer,
#gapAnalysisProgressContainer {
    position: relative;
    overflow: hidden;
}

#contentGapProgressContainer::before,
#gapAnalysisProgressContainer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
    animation: progressShimmer 3s linear infinite;
}

/* Small sort button for pages table */
.pages-sort-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), #4f46e5);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

.pages-sort-btn i {
    font-size: 0.9rem;
}

.pages-sort-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.pages-sort-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Select & Refresh */
select {
    padding: 12px 18px;
    background: var(--bg-card);
    color: var(--text-main);
    border: 2px solid var(--border);
    border-radius: 12px;
    min-width: 240px;
    outline: none;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236366f1' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 18px center;
    padding-inline-start: 45px;
    padding-inline-end: 18px;
}

select:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), var(--shadow-md);
}

select option {
    background: var(--bg-card);
    color: var(--text-main);
    padding: 12px;
    font-weight: 500;
}

.refresh-btn {
    background: var(--bg-card);
    border: 2px solid var(--border);
    color: var(--text-main);
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.refresh-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    inset-inline-start: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--primary);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
    z-index: 0;
}

.refresh-btn:hover::before {
    width: 200px;
    height: 200px;
}

.refresh-btn>* {
    position: relative;
    z-index: 1;
}

.refresh-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary), var(--shadow-md);
}

.refresh-btn:active {
    transform: rotate(360deg) translateY(-2px);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Quick Search */
.quick-search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.quick-search-input {
    padding: 12px 18px 12px 45px;
    /* More padding on right for icon */
    background: var(--bg-card);
    color: var(--text-main);
    border: 2px solid var(--border);
    border-radius: 12px;
    width: 320px;
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.quick-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), var(--shadow-md);
    width: 320px;
}

.quick-search-input::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

.quick-search-icon {
    position: absolute;
    inset-inline-end: 16px;
    color: var(--text-muted);
    pointer-events: none;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.quick-search-container:focus-within .quick-search-icon {
    color: var(--primary);
    transform: scale(1.1);
}

/* ============================================
   New Feature Components - CSS Classes
   ============================================ */

/* Container for new features */
.new-feature-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
}

/* Card for feature data */
.new-feature-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.new-feature-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

/* Input fields */
.new-feature-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg-dark);
    color: var(--text-main);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-family: var(--font-family-primary, 'Cairo', sans-serif);
}

.new-feature-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.new-feature-input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.new-feature-button {
    width: 100%;
    padding: 15px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.new-feature-button:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}

.new-feature-button:active {
    transform: translateY(0);
}

.new-feature-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Results container */
.new-feature-results {
    margin-top: 30px;
}

/* Metric cards */
.metric-card {
    padding: 20px;
    background: var(--card-bg);
    border-radius: 10px;
    border: 2px solid var(--border);
    text-align: center;
    transition: all 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.metric-card.good {
    border-color: var(--success);
}

.metric-card.needs-improvement {
    border-color: var(--warning);
}

.metric-card.poor {
    border-color: var(--danger);
}

.metric-card-label {
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.metric-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 10px 0;
}

.metric-card-description {
    color: var(--text-muted);
    margin-top: 5px;
    font-size: 0.85rem;
}

/* Responsive grid */
.responsive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* Loading state */
.loading-state {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

.loading-state i {
    font-size: 2rem;
    color: var(--accent);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Error state */
.error-state {
    text-align: center;
    padding: 20px;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.error-state i {
    font-size: 2rem;
    margin-bottom: 15px;
    display: block;
}

/* Feature section title */
.feature-section-title {
    color: var(--text-main);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.5rem;
    font-weight: 700;
}

.feature-section-title i {
    color: var(--accent);
    font-size: 1.5rem;
}

/* Form group */
.feature-form-group {
    margin-bottom: 25px;
}

.feature-form-label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-item {
    padding: 20px;
    background: var(--card-bg);
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.stat-label {
    color: var(--text-muted);
    margin-top: 5px;
    font-size: 0.9rem;
}

/* Recommendations list */
.recommendations-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recommendation-item {
    padding: 12px;
    background: var(--card-bg);
    border-radius: 8px;
    margin-bottom: 10px;
    border-right: 4px solid var(--accent);
    transition: all 0.3s ease;
}

.recommendation-item:hover {
    background: var(--bg-elevated);
    transform: translateX(-5px);
}

/* Feature header */
.feature-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.feature-header h3 {
    color: var(--text-main);
    margin-bottom: 10px;
    font-size: 1.2rem;
    font-weight: 700;
}

/* Log Date Divider */
.log-date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.7;
    width: 100%;
}

.log-date-divider::before,
.log-date-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
    margin: 0 16px;
    opacity: 0.5;
}

.log-date-divider span {
    background: var(--bg-card);
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

[data-theme="dark"] .log-date-divider span {
    background: rgba(255, 255, 255, 0.05);
}

/* Terminal Stats Pills */
.stat-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.stat-pill.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.2);
}

.stat-pill.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.2);
}

.stat-pill.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

.stat-pill i {
    font-size: 0.7rem;
}

.stat-pill span {
    min-width: 14px;
    text-align: center;
}