/**
 * KORVON-NOTIFICATION-STYLES-2026
 * Локация: /notifications/notifications.css
 * Назначение: Стили колокольчика и выпадающего списка
 * Протокол: v2.0 (Mobile First & Event-Driven UI)
 * Обновлено: 28.02.2026 (FIXED: Zero-count visibility & Seller/Customer UI separation)
 */

/* --- Контейнер --- */
.myshop-notifications-wrapper {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    box-sizing: border-box;
}

/* --- Кнопка колокольчика (Trigger) --- */
#myshop-notifications-btn {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
    cursor: pointer;
    position: relative;
    font-size: 18px;
    border-radius: 10px;
    color: #333;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#myshop-notifications-btn:hover {
    background: #f8f9fa;
    border-color: #d0d0d0;
    transform: translateY(-1px);
}

#myshop-notifications-btn.active {
    background: #f0f0f0;
    color: #ff3300; /* Розовый акцент при открытии */
    border-color: #ff3300;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

/* --- Бадж счетчика --- */
.js-notif-count {
    background: #ff3b30;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 10px;
    position: absolute;
    top: -6px;
    right: -6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(255, 59, 48, 0.3);
    z-index: 2;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* СКРЫТИЕ СЧЕТЧИКА ПРИ 0 */
.js-notif-count.is-hidden {
    display: none !important;
}

/* АНИМАЦИЯ ПОЯВЛЕНИЯ */
.js-notif-count.is-visible {
    display: flex;
    animation: badgePop 0.3s ease-out;
}

@keyframes badgePop {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* --- Выпадающее меню --- */
.js-notif-dropdown {
    display: none; /* По умолчанию скрыто, JS добавляет класс active или меняет display */
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 360px;
    max-height: 500px;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.1);
    z-index: 9999;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15), 0 5px 15px rgba(0,0,0,0.05);
    border-radius: 16px;
    overflow: hidden;
}

/* Класс открытия для JS */
.js-notif-dropdown.active {
    display: block;
    animation: dropdownFade 0.2s ease-out;
}

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

.notifications-header {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-weight: 700;
    font-size: 16px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.notifications-close {
    display: grid;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #f2f3f5;
    color: #343a40;
    font-size: 16px;
    cursor: pointer;
}

.notifications-close:hover {
    background: #e7e9ec;
}

.notifications-close:focus-visible {
    outline: 2px solid #007aff;
    outline-offset: 2px;
}

.js-notif-list-target {
    overflow-y: auto;
    max-height: 400px;
}

.notifications-ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* --- Элемент уведомления --- */
.notification-item {
    padding: 16px 20px;
    border-bottom: 1px solid #f5f5f7;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.notification-item:hover {
    background: #f9f9fb;
}

.notification-item.new {
    background: #f0f7ff;
}

.notification-item.new::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 22px;
    width: 6px;
    height: 6px;
    background: #007aff;
    border-radius: 50%;
}

.notification-message {
    font-size: 14px;
    line-height: 1.5;
    color: #1d1d1f;
    margin-bottom: 6px;
}

.notification-item.read .notification-message {
    color: #86868b;
}

.notification-time {
    font-size: 11px;
    color: #86868b;
    font-weight: 500;
}

/* --- Кнопки действий (Цветовое разделение Продавец/Клиент) --- */
.notification-link-btn {
    display: inline-block;
    margin-top: 10px;
    font-size: 12px;
    text-decoration: none;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    width: fit-content;
    transition: all 0.2s ease;
}

/* По умолчанию (Покупатель - Синий) */
.notification-link-btn {
    color: #007aff;
    background: rgba(0, 122, 255, 0.05);
}

/* Если ведет в кабинет ПРОДАВЦА (Розовый) */
.notification-link-btn[href*="/seller/"] {
    color: #ff3300;
    background: rgba(255, 51, 0, 0.08);
}

.notification-link-btn:hover {
    filter: brightness(0.95);
}

/* Пустое состояние */
.no-notifications {
    text-align: center;
    padding: 40px 20px;
    color: #86868b;
    font-size: 14px;
}

/* --- АДАПТИВНОСТЬ --- */
@media (max-width: 480px) {
    .js-notif-dropdown {
        position: fixed !important;
        top: auto !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: min(82vh, 700px) !important;
        height: min(82dvh, 700px) !important;
        max-height: 82vh !important;
        max-height: 82dvh !important;
        padding-bottom: env(safe-area-inset-bottom);
        border: 1px solid rgba(25, 30, 38, .08);
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -16px 44px rgba(0,0,0,.2);
        background: #fff;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .js-notif-dropdown.is-open {
        animation: notificationSheetIn .28s cubic-bezier(.22,.8,.25,1);
    }

    .js-notif-dropdown.is-open::before {
        content: "";
        display: block;
        width: 38px;
        height: 4px;
        margin: 9px auto 2px;
        border-radius: 999px;
        background: #d9dce1;
    }

    @keyframes notificationSheetIn {
        from { opacity: .7; transform: translateY(100%); }
        to { opacity: 1; transform: translateY(0); }
    }

    .notifications-header {
        padding: 10px 14px 10px 18px;
    }

    .js-notif-list-target {
        max-height: calc(82vh - 66px);
        max-height: calc(82dvh - 66px);
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
}
