/**
 * School Management ERP - Notification Center & PWA Styles
 * Version: 3.0.0
 */

/* ==========================================================================
   1. Real-Time Notification Bell & Dropdown
   ========================================================================== */
.notif-wrapper {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin: 0 8px;
    z-index: 1050;
}

.notif-bell-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    padding: 6px 8px;
    color: inherit;
    font-size: 16px;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.2s ease;
    outline: none;
}

.notif-bell-btn:hover {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
}

.notif-bell-btn i {
    font-size: 17px;
    transition: transform 0.2s ease;
}

.notif-bell-btn:hover i {
    transform: rotate(15deg);
}

/* Badge Counter */
.notif-badge {
    position: absolute;
    top: 0px;
    right: 0px;
    background: #ef4444;
    color: #ffffff !important;
    font-size: 10px;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    line-height: 17px;
    border-radius: 10px;
    text-align: center;
    padding: 0 4px;
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.4);
    pointer-events: none;
}

.notif-badge.pulse {
    animation: notifPulse 1.8s infinite;
}

@keyframes notifPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Dropdown Menu Container */
.notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 350px;
    max-width: 90vw;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 15px 35px -5px rgba(15, 23, 42, 0.2), 0 5px 15px rgba(0, 0, 0, 0.05);
    z-index: 9999;
    text-align: left;
    color: #1e293b;
    overflow: hidden;
    animation: notifFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.notif-dropdown.show {
    display: block;
}

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

/* Dropdown Header */
.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.notif-header-title {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.notif-header-title i {
    color: #2563eb;
}

.notif-mark-all-btn {
    background: none;
    border: none;
    font-size: 11px;
    color: #2563eb;
    cursor: pointer;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.notif-mark-all-btn:hover {
    background: rgba(37, 99, 235, 0.1);
    text-decoration: underline;
}

/* Dropdown List Items */
.notif-dropdown-body {
    max-height: 330px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.notif-dropdown-body::-webkit-scrollbar {
    width: 5px;
}

.notif-dropdown-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease;
    cursor: pointer;
    position: relative;
    text-decoration: none !important;
    color: inherit !important;
}

.notif-item:hover {
    background: #f8fafc;
}

.notif-item.unread {
    background: #eff6ff;
}

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

.notif-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #dbeafe;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.notif-item.unread .notif-item-icon {
    background: #2563eb;
    color: #ffffff;
}

.notif-item-content {
    flex: 1;
    min-width: 0;
}

.notif-item-msg {
    font-size: 13px;
    color: #334155;
    line-height: 1.4;
    word-break: break-word;
    margin-bottom: 4px;
}

.notif-item.unread .notif-item-msg {
    font-weight: 600;
    color: #0f172a;
}

.notif-item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: #94a3b8;
}

.notif-unread-dot {
    width: 7px;
    height: 7px;
    background: #2563eb;
    border-radius: 50%;
    margin-left: auto;
    align-self: center;
    flex-shrink: 0;
}

/* Empty State */
.notif-empty-state {
    padding: 30px 20px;
    text-align: center;
    color: #94a3b8;
}

.notif-empty-state i {
    font-size: 32px;
    margin-bottom: 8px;
    display: block;
    color: #cbd5e1;
}

.notif-empty-state p {
    font-size: 13px;
    margin: 0;
}

/* Dropdown Footer */
.notif-dropdown-footer {
    padding: 10px 16px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.notif-view-all-link {
    font-size: 12px;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    display: block;
    transition: color 0.15s ease;
}

.notif-view-all-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* ==========================================================================
   2. Modern PWA In-App Install Banner
   ========================================================================== */
.pwa-install-banner {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 380px;
    width: calc(100% - 48px);
    background: #0f172a;
    color: #ffffff;
    border-radius: 14px;
    padding: 14px 18px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 10000;
    border: 1px solid rgba(255, 255, 255, 0.12);
    animation: pwaSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwaSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pwa-install-icon img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.pwa-install-info {
    flex: 1;
    min-width: 0;
}

.pwa-install-info h6 {
    margin: 0 0 2px 0;
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
}

.pwa-install-info p {
    margin: 0;
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.35;
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pwa-btn {
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-btn-primary {
    background: #2563eb;
    color: #ffffff;
    padding: 8px 14px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.pwa-btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.pwa-btn-close {
    background: transparent;
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    padding: 4px 6px;
}

.pwa-btn-close:hover {
    color: #ffffff;
}

/* ==========================================================================
   3. Floating PWA Toasts (Online/Offline/Updates)
   ========================================================================== */
.pwa-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(40px);
    background: #1e293b;
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
}

.pwa-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.pwa-toast-success {
    background: #065f46;
    border: 1px solid #10b981;
}

.pwa-toast-warning {
    background: #78350f;
    border: 1px solid #f59e0b;
}

.pwa-toast-update {
    background: #1e1b4b;
    border: 1px solid #6366f1;
}

.pwa-toast-btn {
    background: #6366f1;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.pwa-toast-btn:hover {
    background: #4f46e5;
}

/* Responsive adjustment */
@media (max-width: 576px) {
    .notif-dropdown {
        width: 300px;
        right: -40px;
    }
    .pwa-install-banner {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 16px;
    }
    .notif-perm-card {
        right: 12px !important;
        left: 12px !important;
        width: auto !important;
        bottom: 16px !important;
    }
}

/* ==========================================================================
   4. Notification Permission Request Card & Dropdown Banner
   ========================================================================== */
.notif-perm-card {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 360px;
    max-width: calc(100vw - 32px);
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 16px 40px -6px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.08);
    z-index: 10000;
    overflow: hidden;
    animation: notifSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
}

@keyframes notifSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.notif-perm-card-header {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notif-perm-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -0.2px;
}

.notif-perm-card-title i {
    font-size: 16px;
    color: #fde047;
    animation: notifBellRing 3s ease infinite;
}

@keyframes notifBellRing {
    0%, 80%, 100% { transform: rotate(0); }
    85% { transform: rotate(15deg); }
    90% { transform: rotate(-15deg); }
    95% { transform: rotate(10deg); }
}

.notif-perm-card-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
    transition: color 0.15s;
}

.notif-perm-card-close:hover {
    color: #ffffff;
}

.notif-perm-card-body {
    padding: 14px 16px 16px 16px;
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
}

.notif-perm-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.notif-perm-btn-allow {
    flex: 1;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s ease, transform 0.1s ease;
}

.notif-perm-btn-allow:hover {
    background: #1d4ed8;
}

.notif-perm-btn-allow:active {
    transform: scale(0.98);
}

.notif-perm-btn-later {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.notif-perm-btn-later:hover {
    background: #e2e8f0;
    color: #334155;
}

/* Dropdown Banner */
.notif-perm-dropdown-bar {
    background: #eff6ff;
    border-bottom: 1px solid #bfdbfe;
    padding: 8px 14px;
    font-size: 12px;
    color: #1e40af;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.notif-perm-dropdown-bar.denied {
    background: #fef2f2;
    border-bottom: 1px solid #fecaca;
    color: #991b1b;
}

.notif-perm-dropdown-bar .perm-text {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    line-height: 1.3;
}

.notif-perm-dropdown-bar .perm-btn {
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.notif-perm-dropdown-bar .perm-btn:hover {
    background: #1d4ed8;
}

.notif-perm-dropdown-bar.denied .perm-btn {
    background: #dc2626;
}

.notif-perm-dropdown-bar.denied .perm-btn:hover {
    background: #b91c1c;
}
