/* ═══════════════════════════════════════════
   NOTIFICATIONS — CSS
═══════════════════════════════════════════ */

/* --- Toast Container --- */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none; /* Let clicks pass through empty area */
}

/* --- Toast Item --- */
.toast-notification {
    pointer-events: auto; /* Re-enable clicks on the toast itself */
    width: 340px;
    max-width: calc(100vw - 32px); /* Prevent overflow on narrow phones */
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px -10px rgba(15, 23, 42, 0.2);
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: flex-start;
    padding: 14px 16px;
    gap: 12px;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.toast-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-notification.hide {
    transform: translateY(20px);
    opacity: 0;
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 16px;
    flex-shrink: 0;
}
.toast-icon.course { background: #e0f2fe; color: #0284c7; }
.toast-icon.payment { background: #fef3c7; color: #d97706; }
.toast-icon.system { background: #f1f5f9; color: #475569; }

.toast-content {
    flex: 1;
    min-width: 0; /* Prevent text overflow */
}

.toast-title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.toast-message {
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Navbar Dropdown --- */
.nav-bell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s, background 0.2s;
    font-size: 1.15rem;
    cursor: pointer;
}
.nav-bell:hover {
    color: var(--hsk-primary, #dc2626);
    background: rgba(220, 38, 38, 0.06);
}
.nav-bell-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--hsk-primary, #dc2626);
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 9px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.noti-dd-wrap { position: relative; display: inline-flex; }
.noti-dd-wrap::after {
    content: ''; position: absolute;
    top: 100%; right: 0; width: 360px; height: 16px;
    background: transparent; z-index: 100;
}
.noti-dd-panel {
    position: absolute; top: calc(100% + 10px); right: 0;
    width: 360px; background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px; overflow: hidden;
    box-shadow: 0 20px 60px -10px rgba(15,23,42,0.18);
    opacity: 0; visibility: hidden;
    transform: translateY(8px) scale(0.97);
    transition: opacity 0.22s cubic-bezier(0.16,1,0.3,1),
                visibility 0.22s,
                transform 0.22s cubic-bezier(0.16,1,0.3,1);
    z-index: 200;
    pointer-events: none;
}
.noti-dd-wrap:hover .noti-dd-panel,
.noti-dd-panel.active {
    opacity: 1; visibility: visible; transform: translateY(0) scale(1);
    pointer-events: auto;
}
/* Mobile: position:fixed — không dùng transform scale (navbar.php override) */
@media (max-width: 991px) {
    .noti-dd-wrap::after { display: none; }
    .noti-dd-panel {
        /* position, top, left, right, width được override bởi navbar.php media query */
        transform: translateY(-8px) !important; /* slide from top */
    }
    .noti-dd-wrap:hover .noti-dd-panel,
    .noti-dd-panel.active {
        transform: translateY(0) !important;
    }
}

/* Toast — full-width slide from bottom on narrow phones */
@media (max-width: 480px) {
    #toast-container {
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        right: 12px;
        left: 12px;
        align-items: stretch;
    }
    .toast-notification {
        width: 100%;
        max-width: 100%;
        transform: translateY(120%); /* slide from bottom on mobile */
        border-radius: 14px;
    }
    .toast-notification.show  { transform: translateY(0); }
    .toast-notification.hide  { transform: translateY(20px); }
}

.noti-dd-header {
    background: #f8fafc;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.noti-dd-title { font-size: 14px; font-weight: 800; color: #1e293b; }
.noti-dd-readall {
    font-size: 12px;
    color: var(--hsk-primary, #dc2626);
    font-weight: 600;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}
.noti-dd-readall:hover { text-decoration: underline; }

.noti-dd-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
}
.noti-item {
    display: flex;
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}
.noti-item:hover { background: #f8fafc; }
.noti-item.unread { background: #eff6ff; }
.noti-item.unread:hover { background: #e0f2fe; }

.noti-item-content { flex: 1; min-width: 0; }
.noti-item-title {
    font-weight: 700;
    font-size: 13.5px;
    color: #1e293b;
    margin-bottom: 2px;
}
.noti-item-msg {
    font-size: 12.5px;
    color: #475569;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.noti-item-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 6px;
    font-weight: 500;
}

.noti-dd-footer {
    display: block;
    text-align: center;
    padding: 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--hsk-primary, #dc2626);
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    text-decoration: none;
    transition: background 0.2s;
}
.noti-dd-footer:hover { background: #f1f5f9; }
