/* файл notifications.css */

/* ============================================
   MODERN TOAST NOTIFICATIONS & HISTORY PANEL
   ============================================ */

/* ---------- КОНТЕЙНЕРЫ УВЕДОМЛЕНИЙ (ТОСТЫ) ---------- */
.toast-container {
    position: fixed;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - 32px);
}

.toast-container-top-right {
    top: 24px;
    right: 24px;
}

.toast-container-top-left {
    top: 24px;
    left: 24px;
}

.toast-container-bottom-right {
    bottom: 24px;
    right: 24px;
}

.toast-container-bottom-left {
    bottom: 24px;
    left: 24px;
}

/* ---------- ОСНОВНОЙ БЛОК УВЕДОМЛЕНИЯ ---------- */
.toast {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    border-radius: 24px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.02);
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    position: relative;
    overflow: hidden;
}

.toast:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 38px -12px rgba(0, 0, 0, 0.25);
}

.toast-show {
    animation: toastSlideIn 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1) forwards;
}

.toast-hide {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.6, 1) forwards !important;
}

/* Типы */
.toast-success {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-left: 4px solid #10b981;
    color: #065f46;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.15);
}

.toast-error {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border-left: 4px solid #ef4444;
    color: #991b1b;
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.15);
}

.toast-warning {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-left: 4px solid #f59e0b;
    color: #92400e;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.15);
}

.toast-info {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-left: 4px solid #3b82f6;
    color: #1e40af;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.15);
}

.toast-neutral {
    background: linear-gradient(135deg, #f9fafb, #f3f4f6);
    border-left: 4px solid #6b7280;
    color: #374151;
    box-shadow: 0 8px 20px rgba(107, 114, 128, 0.1);
}

/* Иконка */
.toast-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.toast:hover .toast-icon {
    transform: scale(1.05);
}

.toast-icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 2;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.05));
}

.toast-success .toast-icon svg {
    stroke: #10b981;
    color: #10b981;
}

.toast-error .toast-icon svg {
    stroke: #ef4444;
    color: #ef4444;
}

.toast-warning .toast-icon svg {
    stroke: #f59e0b;
    color: #f59e0b;
}

.toast-info .toast-icon svg {
    stroke: #3b82f6;
    color: #3b82f6;
}

.toast-neutral .toast-icon svg {
    stroke: #6b7280;
    color: #6b7280;
}

/* Контент */
.toast-content {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.45;
}

.toast-message {
    word-break: break-word;
}

/* Кнопка закрытия тоста */
.toast-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.06);
    border: none;
    border-radius: 40px;
    font-size: 16px;
    cursor: pointer;
    color: currentColor;
    opacity: 0.7;
    transition: all 0.2s;
}

.toast-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.12);
    transform: scale(1.05);
}

/* Прогресс-бар */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 0 0 24px 24px;
    overflow: hidden;
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    background: currentColor;
    transition: width linear;
}

.toast-success .toast-progress-bar {
    background: #10b981;
}

.toast-error .toast-progress-bar {
    background: #ef4444;
}

.toast-warning .toast-progress-bar {
    background: #f59e0b;
}

.toast-info .toast-progress-bar {
    background: #3b82f6;
}

.toast-neutral .toast-progress-bar {
    background: #6b7280;
}

/* Анимации */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

.toast-container-top-left .toast-show,
.toast-container-bottom-left .toast-show {
    animation-name: toastSlideInLeft;
}

.toast-container-top-left .toast-hide,
.toast-container-bottom-left .toast-hide {
    animation-name: toastSlideOutLeft;
}

@keyframes toastSlideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-40px);
    }
}

/* ---------- ИКОНКА УВЕДОМЛЕНИЙ В ШАПКЕ ---------- */
.notification-bell {
    position: relative;
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 50%;
    transition: all 0.2s;
    margin-left: 0.75rem;
    color: var(--text, #1f2937);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.notification-bell:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.02);
}

.notification-badge {
    position: absolute;
    top: 1px;
    right: 2px;
    background: linear-gradient(135deg, #ffffffb2, #d2d2d2a3);
    color: rgb(0, 0, 0);
    border-radius: 40px;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* ---------- ПАНЕЛЬ ИСТОРИИ (ВЕРХНЕЕ ВЫРАВНИВАНИЕ) ---------- */
.notification-history-panel {
    position: fixed;
    top: 5px;
    right: 5px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: calc(100% - 10px);
    background: rgba(0, 0, 0, 0.249);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    /* border: #cdcdcd 1px solid; */
    box-shadow: 0 30px 50px -20px rgba(0, 0, 0, 0.25);
    z-index: 10001;
    display: none;
    flex-direction: column;
    overflow: hidden;
    padding: 0.5rem;
}

@keyframes panelFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(-8px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    margin-bottom: 0.2rem;
}

.history-title {
    font-size: 1.05rem;
    font-weight: 600;
    background: linear-gradient(135deg, #1e293b, #334155);
    background-clip: text;
    -webkit-background-clip: text;
    color: #f0f0f0;
}

.history-actions {
    display: flex;
    gap: 8px;
}

.history-actions button {
    background: rgba(0, 0, 0, 0.04);
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 6px 10px;
    border-radius: 40px;
    transition: all 0.2s;
    color: #cdcdcd;
    font-weight: 500;
}

.history-actions button:hover {
    background: rgba(0, 0, 0, 0.08);
    transform: scale(0.96);
}

.history-list {
    max-height: calc(100vh - 73px);
    /* пример: вычитаем высоту шапки, подвала */
    overflow-y: auto;
}

.history-list::-webkit-scrollbar {
    width: 5px;
}

.history-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* СТРОКА УВЕДОМЛЕНИЯ */
.history-item {
    display: flex !important;
    align-items: flex-start !important;
    /* ← ключевое изменение */
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 12px 16px !important;
    cursor: pointer;
    transition: background 0.2s;
}

.history-item-content {
    flex: 1 !important;
    min-width: 0 !important;
}

/* Скрываем возможные левые иконки */
.history-item-icon {
    display: none !important;
}

.history-item-message {
    font-size: 0.9rem;
    font-weight: 500;
    color: #f0f0f0;
    line-height: 1.4;
    word-break: break-word;
}

.history-item-time {
    font-size: 0.7rem;
    color: #cdcdcd;
    margin-top: 4px;
}

.history-item-delete {
    flex-shrink: 0 !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 1rem !important;
    padding: 4px 6px !important;
    border-radius: var(--radius-lg) !important;
    color: #f0f0f0 !important;
    transition: all 0.2s;
    line-height: 1;
    visibility: visible !important;
    opacity: 0.6;
    align-self: flex-start !important;
    /* принудительное прижатие к верху */
    margin-top: 0 !important;
    /* убираем любой отступ сверху */
}

.history-item:hover .history-item-delete {
    visibility: visible;
    opacity: 1;
}

.history-item-delete:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #ef4444 !important;
    opacity: 1;
    transform: scale(1.05);
}

/* Непрочитанные */
.history-item.unread {
    background: #0000001a;
    position: relative;
    color: #f0f0f0;
}

.history-empty {
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ---------- МОБИЛЬНАЯ АДАПТАЦИЯ ---------- */
@media (max-width: 640px) {
    .toast-container {
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
    }

    .toast {
        padding: 12px 16px;
        border-radius: 20px;
    }

    .toast-icon svg {
        width: 20px;
        height: 20px;
    }

    .toast-content {
        font-size: 0.85rem;
    }

    .notification-history-panel {
        top: 70px;
        right: 12px;
        left: 12px;
        width: auto;
        border-radius: 24px;
    }

    .history-header {
        padding: 12px 16px;
    }

    .history-item {
        padding: 12px 16px;
        gap: 12px;
    }
}

/* ===== ФИНАЛЬНЫЙ ФИКС ДЛЯ ПАНЕЛИ ИСТОРИИ ===== */
.notification-history-panel .history-item {
    display: flex !important;
    flex-direction: row !important;
    /* строка, а не колонка */
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 12px !important;

    padding: .75rem 1rem;
    margin: .0rem .0rem .15rem .0rem;
    cursor: pointer;
    transition: background 0.2s ease;
    border-radius: var(--radius-lg, 14px);
}

.notification-history-panel .history-item-content {
    flex: 1 !important;
    min-width: 0 !important;
}

.notification-history-panel .history-item-delete {
    flex-shrink: 0 !important;
    align-self: flex-start !important;
    /* прижатие к верху */
    margin-top: 0 !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 0.75rem !important;
    padding: 4px 6px !important;
    border-radius: 20px !important;
    color: #94a3b8 !important;
    line-height: 1 !important;
}

.notification-history-panel .history-item-delete:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    /* color: #ef4444 !important; */
    color: #ffffff !important;
}

/* Затемняющий фон (бекдроп) */
.notification-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Панель истории – по умолчанию скрыта за правым краем */
.notification-history-panel {
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    /* Остальные стили (position, right, top и т.д.) остаются без изменений */
}

/* Когда открыта – выезжает */
.notification-history-panel.panel-open {
    transform: translateX(0);
}

.history-clear,
.history-close,
.history-mark-read {
    background: transparent;
    border: none;
    font-size: 0.75rem;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.15s;
    color: #475569;
    background: var(--border);
    border: 0.5px solid #eef2f6;
}