/* Top Controls - Updated for inline layout */
.top-control-bar {
    /* Remove standalone top control bar styles since controls are now inline */
    display: none;
}
/* Empty state styles */
.no-notifications {
    text-align: center;
    padding: 3rem 1.5rem;
    color: rgba(120, 120, 120, 0.8);
}

.no-notifications i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
    color: rgba(180, 180, 180, 0.6);
}

.no-notifications p {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}
/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, #ff4d4f, #d9363e);
    color: #fff;
    border-radius: 999px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    font-size: 12px;
    line-height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    z-index: 20;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Enhanced Notifications Panel - Overlay Style - NO SPACE RESERVED */
.notifications-panel,
#notificationsPanel {
    position: absolute !important; /* anchor to bell btn container when possible */
    top: calc(100% + 8px) !important; /* just below the button */
    right: 0 !important;
    width: 480px !important; /* تم تكبير العرض من 360px إلى 480px */
    max-height: 600px !important; /* تم تكبير الارتفاع من 480px إلى 600px */
    
    /* Modern glass morphism design */
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95) 0%,
        rgba(248, 250, 252, 0.9) 100%);
    backdrop-filter: blur(25px) saturate(1.8);
    -webkit-backdrop-filter: blur(25px) saturate(1.8);
    
    /* Elegant borders and shadows */
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.25),
        0 12px 24px rgba(0, 0, 0, 0.15),
        0 4px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    
    z-index: 999999999 !important; /* أعلى قيمة ممكنة - فوق كل شيء بالتأكيد */
    
    /* FORCE HIDDEN BY DEFAULT - OVERLAY STYLE */
    display: none !important;
    transform: translateY(-10px) scale(0.95) !important;
    transform-origin: top right !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    overflow: hidden !important;
    
    /* Smooth transition */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Small caret arrow */
.notifications-wrapper > .notifications-panel::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 14px;
    width: 10px;
    height: 10px;
    background: inherit;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    transform: rotate(45deg);
    box-shadow: -2px -2px 4px rgba(0,0,0,0.05);
}

/* Remove arrow since panel is now a fixed overlay */

/* Keep control buttons positioned but no longer contains the panel */
.control-buttons {
    position: relative;
}

/* Show notifications panel ONLY when .active class is added - OVERLAY STYLE */
.notifications-panel.active,
#notificationsPanel.active {
    display: block !important; /* Override the display: none */
    transform: translateY(0) scale(1) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    overflow-y: auto !important; /* Allow scrolling if needed */
    z-index: 999999999 !important; /* التأكيد على أعلى قيمة */
    position: fixed !important; /* تثبيت النافذة */
    
    /* Overlay animation */
    animation: slideDownFade 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideDownFade {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Remove full-screen backdrop for dropdown style */
.notifications-panel.active::after { content: none !important; }

/* Extra specificity for stubborn cases */
body .notifications-panel:not(.active),
body #notificationsPanel:not(.active),
.team-portal-container .notifications-panel:not(.active),
.main-header-row .notifications-panel:not(.active) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    max-height: 0 !important;
    overflow: hidden !important;
}

/* Reset any inline styles that might force visibility */
.notifications-panel[style*="display: block"]:not(.active),
.notifications-panel[style*="opacity: 1"]:not(.active),
.notifications-panel[style*="visibility: visible"]:not(.active) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Ultimate overlay hiding - NO SPACE RESERVED */
body:not(.force-show-notifications) .notifications-panel:not(.active),
html .notifications-panel:not(.active),
* .notifications-panel:not(.active) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    overflow: hidden !important;
    /* Remove positioning that takes up space */
}

/* Fallback: when not inside header, show fixed at top-right under header */
body > .notifications-panel.active,
body > #notificationsPanel.active {
    position: fixed !important;
    top: calc(var(--header-height) + 8px) !important;
    right: 20px !important;
}

.notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: transparent;
}

.notifications-header h3 {
    margin: 0;
    color: rgba(30, 30, 30, 0.95);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.close-notifications {
    background: rgba(0, 0, 0, 0.04);
    border: none;
    color: rgba(100, 100, 100, 0.8);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-notifications:hover {
    background: rgba(0, 0, 0, 0.08);
    color: rgba(50, 50, 50, 1);
    transform: scale(1.05);
}

.notifications-content {
    max-height: 380px;
    padding: 0.5rem;
    overflow-y: auto;
    
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

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

.notifications-content::-webkit-scrollbar-track {
    background: transparent;
}

.notifications-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.notifications-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}
 

.no-notifications {
    text-align: center;
    padding: 2rem 1rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Inline notification count inside slim header */
.main-header-row .control-buttons .notifications-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: #e5e7eb;
    height: var(--header-height);
    padding: 0 8px;
}

.main-header-row .control-buttons .notifications-btn:hover {
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
}

.main-header-row .control-buttons .notifications-btn .notification-badge {
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    border-radius: 9999px !important;
    min-width: 18px !important;
    height: 18px !important;
    padding: 0 6px !important;
    line-height: 18px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    margin-inline-start: 6px !important;
    border: 1px solid rgba(255,255,255,0.9) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.35) !important;
    animation: none !important;
}

.no-notifications i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.no-notifications p {
    margin: 0;
    font-size: 0.9rem;
}

/* Enhanced Notification Item - Facebook Style */
.notification-item {
    background: transparent;
    border: none;
    border-radius: 12px;
    padding: 1rem;
    margin: 0.25rem 0;
    transition: all 0.2s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.notification-item:hover {
    background: rgba(0, 0, 0, 0.04);
    transform: translateX(2px);
}

.notification-item.unread {
    border-left-color: #1877f2;
    background: rgba(24, 119, 242, 0.05);
}

.notification-item.unread:hover {
    background: rgba(24, 119, 242, 0.08);
}

/* Notification content styling */
.notification-title {
    font-weight: 600;
    color: rgba(30, 30, 30, 0.9);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.notification-message {
    color: rgba(100, 100, 100, 0.8);
    font-size: 0.8rem;
    line-height: 1.3;
    margin-bottom: 0.25rem;
}

.notification-time {
    color: rgba(130, 130, 130, 0.7);
    font-size: 0.75rem;
}

/* Responsive adjustments for overlay notifications panel */
@media (max-width: 768px) {
    .notifications-panel { width: 320px; max-height: 400px; right: 0; top: calc(100% + 8px) !important; }
    .notifications-panel.active { right: 0 !important; top: calc(100% + 8px) !important; }
}

@media (max-width: 480px) {
    .notifications-panel { width: calc(100vw - 20px); left: 10px; right: 10px; max-height: 350px; top: calc(100% + 8px) !important; }
    .notifications-panel.active { width: calc(100vw - 20px) !important; left: 10px !important; right: 10px !important; top: calc(100% + 8px) !important; }
}

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.notification-title {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.9rem;
    margin: 0;
}

.notification-time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
}

.notification-message {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    line-height: 1.4;
    margin: 0;
}

.notification-editor {
    font-weight: 500;
    color: rgba(52, 152, 219, 0.9);
}

/* Dark Mode Styles */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #ffffff;
}

body.dark-mode .control-buttons {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .control-btn {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .notifications-panel {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .notifications-header {
    background: rgba(0, 0, 0, 0.2);
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .notification-item {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .notification-item:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Light Mode Styles */
body.light-mode {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333333;
}

body.light-mode .control-buttons {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

body.light-mode .control-btn {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(0, 0, 0, 0.8);
}

body.light-mode .control-btn:hover {
    color: rgba(0, 0, 0, 0.9);
}

body.light-mode .notifications-panel {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

body.light-mode .notifications-header {
    background: rgba(255, 255, 255, 0.2);
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

body.light-mode .notifications-header h3 {
    color: rgba(0, 0, 0, 0.8);
}

body.light-mode .close-notifications {
    color: rgba(0, 0, 0, 0.6);
}

body.light-mode .close-notifications:hover {
    color: rgba(0, 0, 0, 0.8);
}

body.light-mode .no-notifications {
    color: rgba(0, 0, 0, 0.6);
}

body.light-mode .notification-item {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.2);
}

body.light-mode .notification-item:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

body.light-mode .notification-title {
    color: rgba(0, 0, 0, 0.9);
}

body.light-mode .notification-message {
    color: rgba(0, 0, 0, 0.7);
}

body.light-mode .notification-time {
    color: rgba(0, 0, 0, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
    .top-control-bar {
        top: 10px;
        left: 10px;
    }
    
    .notifications-panel {
        top: 70px;
        left: 10px;
        right: 10px;
        width: auto;
    }
    
    .control-btn {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
}
/* ======================================== 
   ????? ????? ?????? ????????? - ???? ??? ?? ???
   ======================================== */

/* ?????? ?? ???? ??????? ??? ???? ??????? */
.notifications-panel.active,
#notificationsPanel.active {
    z-index: 2147483647 !important; /* ???? ???? ????? */
    position: fixed !important;
    isolation: isolate !important; /* ??? ?????? */
}

/* ??? ?? ???? ?? ??????? */
.notifications-wrapper {
    z-index: 2147483646 !important;
    position: relative !important;
}

/* Responsive - ????? ????? ?? ??????? ??????? */
@media (max-width: 768px) {
    .notifications-panel,
    #notificationsPanel {
        width: 90vw !important;
        max-width: 400px !important;
        right: 5vw !important;
        left: auto !important;
    }
}

@media (max-width: 480px) {
    .notifications-panel,
    #notificationsPanel {
        width: 95vw !important;
        max-width: none !important;
        right: 2.5vw !important;
        max-height: 70vh !important;
    }
}
