﻿/* =========================================================
   Notifications Dropdown
   ========================================================= */

/* ── Hide Bootstrap default caret ── */
#notifications .dropdown-toggle::after {
    display: none !important;
}

/* ── Bell button ── */
#notifications-dropdown {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 10px !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    transition: background 0.18s ease;
}

    #notifications-dropdown:hover,
    #notifications-dropdown[aria-expanded="true"] {
        background: rgba(0, 0, 0, 0.07) !important;
    }

    #notifications-dropdown .bell-icon {
        font-size: 1.25rem;
    }

/* ── Unread badge ── */
.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    border-radius: 7px;
    background: #e8394b;
    color: #fff;
    font-size: 8px;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
    pointer-events: none;
    box-shadow: 0 0 0 2px #fff;
}

/* ── Dropdown panel — desktop ── */
#notifications .dropdown-menu {
    min-width: 320px;
    max-width: 360px;
    padding: 0;
    border: none;
    border-radius: 14px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04), 0 12px 32px rgba(0, 0, 0, 0.13), 0 0 0 1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transform-origin: top right;
    animation: notifDrop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    background: #fff;
}

@keyframes notifDrop {
    from {
        opacity: 0;
        transform: scale(0.93) translateY(-6px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ── Mobile: full-width bottom sheet (up to 480px) ── */
@media (max-width: 480px) {
    #notifications .dropdown-menu {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        min-width: 100vw;
        max-width: 100vw;
        border-radius: 18px 18px 0 0;
        transform-origin: bottom center;
        animation: notifSlideUp 0.22s cubic-bezier(0.34, 1.4, 0.64, 1) both;
        box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.06);
    }

    @keyframes notifSlideUp {
        from {
            opacity: 0;
            transform: translateY(24px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .notif-list {
        max-height: 55vh;
    }

    /* Drag handle hint */
    .notif-header {
        position: relative;
        padding-top: 22px !important;
    }

        .notif-header::before {
            content: '';
            display: block;
            position: absolute;
            top: 8px;
            left: 50%;
            transform: translateX(-50%);
            width: 36px;
            height: 4px;
            border-radius: 2px;
            background: rgba(0, 0, 0, 0.12);
        }

    /* Larger touch targets */
    a[notification-link].dropdown-item {
        padding: 12px 14px !important;
        min-height: 48px;
    }

    .notif-trash {
        width: 36px;
        height: 36px;
    }
}

/* ── Small tablets (481px to 640px): constrained panel ── */
@media (min-width: 481px) and (max-width: 640px) {
    #notifications .dropdown-menu {
        min-width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        right: 0;
        left: auto;
    }
}

/* ── Panel header ── */
.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.notif-header-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #111;
}

#all-read-btn {
    font-size: 11.5px;
    font-weight: 500;
    color: #5a6a7e !important;
    text-decoration: none !important;
    padding: 3px 8px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

    #all-read-btn:hover {
        background: #f0f3f8;
        color: #2563eb !important;
    }

/* ── Scrollable list ── */
.notif-list {
    max-height: 340px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

    .notif-list::-webkit-scrollbar {
        width: 4px;
    }

    .notif-list::-webkit-scrollbar-track {
        background: transparent;
    }

    .notif-list::-webkit-scrollbar-thumb {
        background: #dde3ed;
        border-radius: 4px;
    }

/* ── Individual item ── */
a[notification-link].dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.045);
    border-radius: 0 !important;
    transition: background 0.13s ease;
    color: #1a202c !important;
    text-decoration: none !important;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.04);
}

    a[notification-link].dropdown-item:last-child {
        border-bottom: none;
    }

    a[notification-link].dropdown-item:hover,
    a[notification-link].dropdown-item:active {
        background: #f5f7fb !important;
    }

/* ── Status dot ── */
.notif-dot {
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-top: 1px;
}

    .notif-dot.unread {
        background: #e8394b;
        box-shadow: 0 0 0 2.5px rgba(232, 57, 75, 0.18);
    }

    .notif-dot.read {
        background: #c8d0db;
    }

/* ── Star badge ── */
.notif-star {
    flex-shrink: 0;
    font-size: 10px;
    color: #f59e0b;
}

/* ── Title text ── */
.notif-text {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
    color: inherit;
}

a[notification-link].dropdown-item:not(.is-read) .notif-text {
    font-weight: 600;
}

/* ── Trash button ── */
.notif-trash {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: #9aa5b4;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}

    .notif-trash:hover,
    .notif-trash:active {
        background: #fde8ea;
        color: #e8394b;
    }

    .notif-trash.d-none {
        display: none !important;
    }

/* ── Important bell shake ── */
.bell-important {
    animation: bellShake 2s ease-in-out infinite;
    color: gold;
}

@keyframes bellShake {
    0%, 100% {
        transform: rotate(0deg);
    }

    10% {
        transform: rotate(12deg);
    }

    20% {
        transform: rotate(-10deg);
    }

    30% {
        transform: rotate(8deg);
    }

    40% {
        transform: rotate(-6deg);
    }

    50% {
        transform: rotate(0deg);
    }
}
