/* ============================================================================
   Modern Header System - نظام الهيدر الحديث
   Clean, Responsive, and Glassmorphic Aesthetic
   ============================================================================ */

:root {
    /* Dimensions */
    --header-height: 80px;
    
    /* Colors */
    --bg-glass: rgba(255, 255, 255, 0.85);
    --border-glass: rgba(255, 255, 255, 0.6);
    --header-bg: rgba(255, 255, 255, 0.9);
    --header-border: rgba(226, 232, 240, 0.8);
    --primary-color: #2563eb;
    --primary-accent: #274060;
    --primary-light: #eff6ff;
    --text-dark: #0f172a;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-gray: #64748b;
    --danger: #ef4444;
    --notification-badge: #ef4444;
    
    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
    --header-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --glow: 0 0 15px rgba(37, 99, 235, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.admin-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    transition: var(--transition);
}

.admin-header__container {
    max-width: 100%;
    height: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ============================================================================
   Notifications Center
   ============================================================================ */

.notifications-center {
    position: relative;
    margin-left: 0; /* Left side for RTL context usually, or based on flex order */
    margin-right: auto; /* Push to the left in RTL */
}

.notifications-btn {
    position: relative;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background-color: transparent;
    color: var(--text-gray);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.notifications-btn:hover {
    background-color: white;
    color: var(--primary-color);
    border-color: rgba(37, 99, 235, 0.1);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.notifications-btn i {
    font-size: 1.4rem;
    transition: transform 0.2s ease;
}

.notifications-btn:hover i {
    animation: bell-ring 1s infinite linear;
}

/* Bell Animation */
@keyframes bell-ring {
    0% { transform: rotate(0); }
    10% { transform: rotate(15deg); }
    20% { transform: rotate(-15deg); }
    30% { transform: rotate(10deg); }
    50% { transform: rotate(0); }
    100% { transform: rotate(0); }
}

.notifications-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.4);
}

.notifications-badge:empty,
.notifications-badge:contains("0") {
    display: none; /* Hide if empty or 0 */
}

/* Dropdown Menu */
.notifications-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0; /* Aligned to left for RTL layout usually, or adjust */
    width: 360px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.15);
    border: 1px solid var(--header-border);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition-base);
    overflow: hidden;
    z-index: 1010;
}

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

.notifications-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notifications-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--header-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f8fafc;
}

.notifications-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.notifications-list {
    max-height: 320px;
    overflow-y: auto;
}

.notification-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--header-border);
    display: flex;
    gap: 1rem;
    cursor: pointer;
    transition: background-color 0.15s;
}

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

.notification-item:hover {
    background-color: #f8fafc;
}

.notification-item.unread {
    background-color: #f0f9ff;
}

.notification-item.unread:hover {
    background-color: #e0f2fe;
}

/* Footer */
.notifications-footer {
    padding: 0.75rem;
    text-align: center;
    background-color: #f8fafc;
    border-top: 1px solid var(--header-border);
}

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

/* Backdrop */
.notifications-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: transparent;
    display: none;
}

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

/* ============================================================================
   User Info Section
   ============================================================================ */

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-greeting {
    display: flex;
    flex-direction: column;
    text-align: right;
    line-height: 1.3;
}

.greeting-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.user-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    transition: var(--transition);
    cursor: pointer;
}

.user-info-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 6px 12px 6px 6px;
    border-radius: 50px;
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
}

.user-info-wrapper:hover {
    background-color: white;
    border-color: rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-md);
}

.user-info-wrapper:hover .user-avatar {
    transform: scale(1.05);
    box-shadow: var(--glow);
    border-color: var(--primary-light);
}

.user-avatar-container {
    position: relative;
}

.user-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #10b981;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}


/* ============================================================================
   Loading Bar
   ============================================================================ */

.loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: transparent;
    z-index: 1002;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.loading-bar.active {
    opacity: 1;
}

.loading-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-accent), #3b82f6);
    transition: width 0.2s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 768px) {
    .admin-header__container {
        padding: 0 1rem;
    }
    
    .notifications-dropdown {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0 0 16px 16px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    }
}
