.notif-wrap {
    position: relative;
    display: inline-block;
}

.notif-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 320px;
    max-width: calc(100vw - 24px);
    background: white;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    z-index: 9999;
    overflow: hidden;
    flex-direction: column;
    max-height: min(80vh, 520px);
}

.notif-wrap.open .notif-dropdown { display: flex; }

.notif-header {
    padding: 14px 16px;
    font-weight: 700;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.notif-header-title {
    flex: 1;
    min-width: 0;
}

.notif-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
    justify-content: flex-end;
}

.notif-see-all-header {
    font-size: 12px;
    font-weight: 700;
    color: #4A5BA8;
    text-decoration: none;
    white-space: nowrap;
}

.notif-see-all-header:hover {
    text-decoration: underline;
}

/* รายการแจ้งเตือนในกล่อง — เลื่อนได้ ลิงก์ดูทั้งหมดด้านล่างไม่ถูกดันออกจอ */
.notif-body-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.notif-mark-all {
    font-size: 12px;
    color: #4A5BA8;
    cursor: pointer;
    text-decoration: none;
}

.notif-mark-all:hover { text-decoration: underline; }

.notif-item {
    padding: 12px 16px;
    min-height: 44px;
    border-bottom: 1px solid #f9f9f9;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: inherit;
    box-sizing: border-box;
    touch-action: manipulation;
}

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

.notif-item.unread {
    background: #f0f4ff;
    border-left: 3px solid #4A5BA8;
}

.notif-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    margin-bottom: 3px;
}

.notif-item-msg {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    margin-bottom: 3px;
}

.notif-item-time { font-size: 11px; color: #bbb; }

.notif-empty {
    padding: 24px;
    text-align: center;
    color: #bbb;
    font-size: 13px;
}

/**
 * ปุ่มกระดิ่ง / โปรไฟล์: ชนะ Bootstrap reboot และลำดับ stylesheet ทุกหน้า
 * (navbar.php โหลดไฟล์นี้หลัง css อื่นใน <head> ของหลายหน้า)
 */
.navbar .nav-right .notif-wrap button.notif-btn {
    margin: 0 !important;
    padding: 0 !important;
    min-width: 44px !important;
    min-height: 44px !important;
    width: 44px !important;
    height: 44px !important;
    line-height: 1 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    border-width: 0 !important;
    border-style: none !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    outline: none !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    touch-action: manipulation;
}

.navbar .nav-right button.profile-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    box-sizing: border-box !important;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.navbar .nav-right .notif-wrap button.notif-btn:hover,
.navbar .nav-right .notif-wrap button.notif-btn:focus,
.navbar .nav-right .notif-wrap button.notif-btn:focus-visible {
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
}

@media (hover: none) and (pointer: coarse) {
    .navbar .nav-right .notif-wrap button.notif-btn:active {
        background: rgba(0, 0, 0, 0.09) !important;
        transform: scale(0.94);
    }

    .navbar .nav-right button.profile-btn:active {
        opacity: 0.88;
        transform: scale(0.94);
    }
}

.navbar .nav-right a.profile-btn {
    position: relative;
    overflow: hidden;
}

.navbar .nav-right a.profile-btn img.nav-icon,
.navbar .nav-right a.profile-btn img.nav-profile-photo {
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
    object-position: center center;
    border-radius: 50% !important;
    display: block;
}