/* static/css/notifications.css */

/* ================================================== */
/*          1. NAVBAR BELL & BADGE (REVISED)          */
/* ================================================== */
.notification-bell {
    position: relative;
}

/* Используем стили кнопок из glass_vv.css для консистентности */
#notification-bell-btn {
    /* V-- ИЗМЕНЕНИЯ ЗДЕСЬ --V */
    background: transparent !important; /* Убираем фон */
    border-color: transparent !important; /* Убираем рамку */
    box-shadow: none !important;
    display: flex !important; /* Делаем кнопку флекс-контейнером */
    align-items: center; /* Центрируем иконку по вертикали */
    justify-content: center; /* Центрируем иконку по горизонтали */
    /* ^-- КОНЕЦ ИЗМЕНЕНИЙ --^ */

    width: 40px;
    height: 40px;
    padding: 0 !important;
    color: var(--color-text-secondary) !important;
    transition: all var(--transition-fast) !important;
}

#notification-bell-btn:hover {
    background-color: var(--color-surface-hover) !important;
    color: var(--color-text-primary) !important;
    transform: none; /* Убираем эффект, так как нет фона */
    box-shadow: none !important;
}

#notification-bell-btn.has-new .icon i {
    animation: bell-shake 0.8s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes bell-shake {
  10%, 90% { transform: rotate3d(0, 0, 1, -5deg); }
  20%, 80% { transform: rotate3d(0, 0, 1, 5deg); }
  30%, 50%, 70% { transform: rotate3d(0, 0, 1, -3deg); }
  40%, 60% { transform: rotate3d(0, 0, 1, 3deg); }
}

#notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #ff3860;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-bg);
    transform: scale(1);
    transition: transform 0.2s ease-in-out, opacity 0.2s ease;
    pointer-events: none; /* Чтобы не мешал клику на кнопку */
}

#notification-badge.is-hidden {
    transform: scale(0);
    opacity: 0;
}

/* ================================================== */
/*          2. NOTIFICATION WIDGET (DROPDOWN)         */
/* ================================================== */
.notification-widget {
    position: fixed;
    top: 70px; /* Ниже навбара */
    right: 20px;
    width: 100%;
    max-width: 400px;
    z-index: 1040;

    background: hsla(0, 0%, 10%, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid hsla(0, 0%, 100%, 0.1);
    border-radius: var(--radius-l);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);

    display: flex;
    flex-direction: column;
    overflow: hidden;

    opacity: 0;
    transform: translateY(-20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.notification-widget:not(.is-hidden) {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.widget-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.widget-body {
    max-height: 450px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-text-tertiary) transparent;
}
.widget-body::-webkit-scrollbar { width: 6px; }
.widget-body::-webkit-scrollbar-track { background: transparent; }
.widget-body::-webkit-scrollbar-thumb { background-color: var(--color-text-tertiary); border-radius: 6px; }

.widget-footer {
    padding: 10px 16px;
    text-align: center;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.widget-footer a {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

/* ================================================== */
/*          3. NOTIFICATION ITEM & SKELETON           */
/* ================================================== */
.notification-item, .notification-skeleton {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    transition: background-color var(--transition-fast);
    text-decoration: none !important;
}

.notification-item:hover {
    background-color: hsla(0, 0%, 100%, 0.05);
}

.notification-item.is-unread {
    background-color: hsla(210, 100%, 50%, 0.08);
}

.notification-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}
/* Icon colors per type */
.notification-icon.type-like { background-color: hsla(350, 82%, 58%, 0.15); color: #ff6b81; }
.notification-icon.type-comment { background-color: hsla(204, 86%, 53%, 0.15); color: #48a2e4; }
.notification-icon.type-download { background-color: hsla(145, 63%, 42%, 0.15); color: #5dd592; }
.notification-icon.type-upload { background-color: hsla(48, 100%, 50%, 0.15); color: #ffdd57; }
.notification-icon.type-admin { background-color: hsla(0, 0%, 50%, 0.15); color: #bdbdbd; }


.notification-content {
    flex-grow: 1;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.notification-content p {
    margin-bottom: 4px;
}

.notification-content a {
    font-weight: 600;
    color: var(--color-text-primary);
}

.notification-timestamp {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
}

.notification-empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--color-text-secondary);
}
.notification-empty-state .icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* Skeleton Loader */
.notification-skeleton .notification-icon {
    background-color: var(--color-surface-2);
}
.notification-skeleton .skeleton-line {
    background: linear-gradient(90deg, var(--color-surface-2) 25%, var(--color-surface-hover) 50%, var(--color-surface-2) 75%);
    background-size: 200% 100%;
    animation: skeleton-shine 1.5s infinite linear;
    border-radius: 4px;
    height: 1em;
}
.notification-skeleton .line-1 { width: 90%; }
.notification-skeleton .line-2 { width: 60%; margin-top: 8px; }

@keyframes skeleton-shine {
    to { background-position: -200% 0; }
}

/* ================================================== */
/*          4. REAL-TIME TOASTS (POPUPS)              */
/* ================================================== */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column-reverse; /* Новые тосты появляются снизу и сдвигают старые вверх */
    gap: 12px;
}

.toast-notification {
    width: 350px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;

    background: hsla(0, 0%, 12%, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid hsla(0, 0%, 100%, 0.15);
    border-radius: var(--radius-m);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);

    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-notification.hide {
    opacity: 0;
    transform: scale(0.9) translateX(20%);
}