/* =========================================================
   ENCBYT HEADER ACTIONS, NOTIFICATIONS & AVATAR v2.1
   Path: frontend/pwa/css/header-actions.css
   Security: Strict CSP Compliant | Dark Mode Supported
   Fix: Added position: relative to button + avatar containers for badge positioning
   ========================================================= */

/* Action Button Container */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn-liveguard,
.header-btn-icon,
.action-btn {
    padding: 6px 12px;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted, #475569);
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    box-sizing: border-box;
    position: relative;    /* 🔥 FIX: Badge anchoring */
}

.header-btn-liveguard:hover,
.header-btn-icon:hover,
.action-btn:hover {
    background: var(--hover-bg, #f8fafc);
    border-color: var(--accent-primary, #2563eb);
    color: var(--accent-primary, #2563eb);
}

/* User Profile Avatar */
.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.05));
    transition: transform 0.2s ease;
    position: relative;    /* 🔥 FIX: Safe anchoring for future badges */
}

.header-avatar:hover {
    transform: scale(1.08);
}

/* Notification Bell Trigger */
.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 8px;
    color: var(--text-muted, #475569);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--card-bg, #ffffff);
    height: 36px;
    width: 36px;
    box-sizing: border-box;
    transition: all 0.15s ease;
}

.notification-bell:hover {
    color: var(--accent-primary, #2563eb);
    border-color: var(--accent-primary, #2563eb);
}

.notification-bell .badge,
.header-btn-icon .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger-color, #ef4444);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card-bg, #ffffff);
    pointer-events: none;    /* Non-clickable badge */
    z-index: 2;              /* Above icon */
}

/* Notification Dropdown Panel */
.cv-notif-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    box-shadow: var(--shadow-lg, 0 12px 36px rgba(15, 23, 42, 0.12));
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    cursor: default;
    animation: cvNotifFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cv-notif-dropdown.show {
    display: flex;
}

@keyframes cvNotifFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.cv-notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-light, #f8fafc);
}

.cv-notif-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cv-notif-title-group h4 {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    margin: 0;
}

.cv-notif-unread-count {
    background: var(--accent-primary, #2563eb);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 999px;
}

.cv-notif-clear-btn {
    background: transparent;
    border: none;
    color: var(--accent-primary, #2563eb);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
}

.cv-notif-clear-btn:hover {
    text-decoration: underline;
}

.cv-notif-body {
    max-height: 320px;
    overflow-y: auto;
}

.cv-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #f1f5f9);
    transition: background 0.15s ease;
}

.cv-notif-item:hover {
    background: var(--hover-bg, #f8fafc);
}

.cv-notif-item.unread {
    background: rgba(37, 99, 235, 0.06);
}

.cv-notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.cv-notif-icon.security {
    background: rgba(37, 99, 235, 0.12);
    color: var(--accent-primary, #2563eb);
}

.cv-notif-icon.info {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success-color, #10b981);
}

.cv-notif-icon.warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning-color, #f59e0b);
}

.cv-notif-text {
    flex: 1;
}

.cv-notif-text h5 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    margin: 0 0 2px;
}

.cv-notif-text p {
    font-size: 11.5px;
    color: var(--text-muted, #64748b);
    line-height: 1.4;
    margin: 0 0 4px;
}

.cv-notif-time {
    font-size: 10.5px;
    color: var(--text-muted, #94a3b8);
}

.cv-notif-empty {
    padding: 36px 16px;
    text-align: center;
    color: var(--text-muted, #94a3b8);
}

.cv-notif-empty i {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
}
/* =========================================================
   TOP HEADER & OFFER TICKER LAYOUT FIX
   ========================================================= */
.top-header { 
    /* ✅ Sticky — files toolbar jaisa */
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    
    /* Layout */
    width: 100%;
    height: 48px;
    display: flex; 
    justify-content: flex-end; 
    align-items: center; 
    padding: 0;
    margin-bottom: 24px;
}

.offer-ticker {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: #ffffff;
    padding: 6px 16px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    z-index: 2;
}

.ticker-text strong { 
    color: #ffffff; 
    font-weight: 800; 
}

.ticker-cta {
    background: #ffffff;
    color: #4f46e5;
    padding: 3px 10px;
    border-radius: 9999px;
    text-decoration: none;
    font-weight: 700;
    font-size: 11px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.ticker-cta:hover { 
    background: #e0e7ff; 
    transform: scale(1.05); 
}

/* ═══════════════════════════════════════════════════════════════
   TOP HEADER LAYOUT
   - .top-header: fixed (window top pe pin)
   - Dashboard pe visible → main-content 72px neeche
   - Baaki pages pe hidden → main-content 0px
   ═══════════════════════════════════════════════════════════════ */

/* Files page jaisa — main-content pe koi top padding nahi */
body.dashboard-body .main-content {
    padding-top: 0;
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD — content thoda neeche (8px breathing room)
   ═══════════════════════════════════════════════════════════════ */
body.dashboard-body:has(#appTopHeader:not(.u-hidden)) .main-content {
    padding-top: 8px;
}

/* Custom confirm dialog animations */
@keyframes cvFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes cvSlideUp {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
