/* radio-v5.5/css/notifications_header.css */

:root {
    --header-text-primary: #e2e8f0;
    --header-text-secondary: #a0aec0;
    --header-text-link: #63b3ed;
    --header-text-link-hover: #90cdf4;
    --header-bg-primary: #1a202c;
    --header-bg-secondary: #2d3748;
    --header-border: #4a5568;
    --header-danger: #e53e3e;
    --header-border-radius-md: 6px;
    --header-border-radius-lg: 8px;
    --header-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.notifications-container {
    position: relative; /* Для позиционирования .notification-count */
    /* margin-left: auto; -- Это убрали, т.к. родитель (.modern-user-nav) должен управлять выравниванием группы */
    margin-right: 5px; 
}

.notifications-trigger {
    position: relative;
    background: none;
    border: none;
    color: var(--header-text-secondary);
    font-size: 1.3em;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notifications-trigger:hover,
.notifications-trigger[aria-expanded="true"] {
    color: var(--header-text-primary);
    background-color: rgba(255, 255, 255, 0.08);
}
.notifications-trigger:active {
    transform: scale(0.95);
}

.notifications-trigger.has-unread .fa-bell {
    animation: bellRingAnimation 0.7s ease-in-out;
}

@keyframes bellRingAnimation {
    0%, 100% { transform: rotate(0); }
    10%, 30%, 50%, 70%, 90% { transform: rotate(-10deg); }
    20%, 40%, 60%, 80% { transform: rotate(10deg); }
}

.notification-count {
    position: absolute;
    top: 2px;
    right: 0px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background-color: var(--header-danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.25);
    border: 1px solid var(--header-bg-secondary);
    pointer-events: none;
    opacity: 1;
    transform: scale(1) translate(20%, -20%); 
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.notification-count[data-count="0"],
.notifications-trigger:not(:has(.notification-count)) .notification-count {
    opacity: 0;
    transform: scale(0.5) translate(20%, -20%);
}

.notifications-dropdown {
    position: absolute;
    top: calc(100% + 10px); 
    right: 0; /* По умолчанию выравниваем по правому краю родителя (.notifications-container) */
    width: 330px;
    max-height: 420px; 
    background-color: var(--header-bg-secondary);
    border: 1px solid var(--header-border);
    border-radius: var(--header-border-radius-lg);
    box-shadow: var(--header-shadow-lg);
    z-index: 1150; 
    color: var(--header-text-primary);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.98); 
    transition: opacity 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),
                visibility 0s linear 0.2s, 
                transform 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.notifications-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    transition: opacity 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),
                visibility 0s linear 0s,
                transform 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.notifications-header {
    padding: 12px 18px;
    font-weight: 600;
    border-bottom: 1px solid var(--header-border);
    font-size: 0.95em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; 
}
.mark-all-read-link {
    font-size: 0.85em;
    color: var(--header-text-link);
    text-decoration: none;
    font-weight: 500; 
}
.mark-all-read-link:hover {
    text-decoration: underline;
    color: var(--header-text-link-hover);
}

.notifications-list {
    padding: 0;
    margin: 0;
    list-style: none;
    flex-grow: 1; 
    overflow-y: auto; 
}

.notification-item {
    display: block;
    padding: 12px 18px;
    text-decoration: none;
    color: var(--header-text-secondary); 
    border-bottom: 1px solid var(--header-border);
    transition: background-color 0.15s ease;
    cursor: pointer;
}
.notification-item:last-child {
    border-bottom: none;
}
.notification-item:hover {
    background-color: rgba(255, 255, 255, 0.05); 
    color: var(--header-text-primary);
}
.notification-item[style*="opacity: 0.6"] { 
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--header-text-secondary); 
}
.notification-item[style*="opacity: 0.6"]:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.notification-item-content { }
.notification-message {
    font-size: 0.9em; 
    display: block;
    margin-bottom: 4px;
    line-height: 1.4;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3; 
    -webkit-box-orient: vertical;
}
.notification-time {
    font-size: 0.75em; 
    color: #718096;   
    display: block;
}

.notification-item-none {
    padding: 20px 18px; 
    text-align: center;
    font-size: 0.9em;
    color: var(--header-text-secondary);
}

.notifications-footer {
    padding: 10px 18px;
    text-align: center;
    border-top: 1px solid var(--header-border);
    flex-shrink: 0; 
}
.notifications-footer a {
    font-size: 0.9em;
    color: var(--header-text-link);
    text-decoration: none;
    font-weight: 500;
}
.notifications-footer a:hover {
    text-decoration: underline;
    color: var(--header-text-link-hover);
}

/* --- Адаптация для мобильных устройств --- */
@media (max-width: 768px) {
    .notifications-container {
        margin-left: 0; 
        margin-right: 5px; 
    }
    .notifications-trigger {
        font-size: 1.2em; 
        padding: 7px;
    }
    .notification-count {
        top: 3px; right: 1px; min-width: 16px; height: 16px; font-size: 9px; line-height: 16px;
        transform: scale(1) translate(15%, -15%);
    }
    .notification-count[data-count="0"],
    .notifications-trigger:not(:has(.notification-count)) .notification-count {
        transform: scale(0.5) translate(15%, -15%);
    }

    .notifications-dropdown {
        width: 300px; 
        right: 0; 
        top: calc(100% + 8px); 
    }
    .notifications-header,
    .notification-item,
    .notifications-footer {
        padding-left: 15px;
        padding-right: 15px;
    }
}

@media (max-width: 480px) {
    .notifications-container {
        margin-left: 0; 
        margin-right: 0px; 
        /* position: static; -- ЗАКОММЕНТИРОВАНО или УДАЛЕНО. Оставляем relative. */
                           /* Это позволит .notifications-dropdown позиционироваться относительно .notifications-container */
    }
    .notifications-trigger {
        font-size: 1.15em;
        padding: 6px;
    }
    .notification-count {
        min-width: 15px; height: 15px; font-size: 8px; line-height: 15px;
        top: 2px; right: -1px;
    }
    .notifications-dropdown {
        position: absolute; 
        top: calc(100% + 8px); /* Отступ от нижней границы .notifications-container */
        
        /* Выравниваем правый край dropdown по правому краю .notifications-container */
        right: 0; 
        left: auto;  /* Сбрасываем левую привязку */
        
        width: 270px; /* Уменьшенная ширина, чтобы лучше помещаться */
        max-width: calc(100vw - 20px); /* Не шире экрана минус боковые отступы (например по 10px) */
        
        z-index: 1150; 
        background-color: var(--header-bg-secondary);
        border: 1px solid var(--header-border);
        border-radius: var(--header-border-radius-lg);
        box-shadow: var(--header-shadow-lg);
        color: var(--header-text-primary);
        display: flex;
        flex-direction: column;
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px) scale(0.98);
        transition: opacity 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),
                    visibility 0s linear 0.2s, 
                    transform 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
    }
    .notifications-dropdown.show {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
    }
    
    .notifications-header,
    .notification-item,
    .notifications-footer {
        padding-left: 12px;
        padding-right: 12px;
    }
    .notification-message { font-size: 0.85em; }
    .notification-time { font-size: 0.7em; }
}
/* --- Анимация для новых уведомлений --- */
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  10%, 30%, 50%, 70%, 90% { transform: rotate(-10deg); }
  20%, 40%, 60%, 80% { transform: rotate(10deg); }
}

.new-notification-shake .fa-bell {
  animation: shake 0.8s cubic-bezier(.36,.07,.19,.97) both;
}
/* Добавьте это в конец файла radio/css/notifications_header.css */
.notification-item.fading-out {
    opacity: 0;
    transition: opacity 0.3s ease-out, max-height 0.3s ease-out, padding 0.3s ease-out;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top: 0;
    border-bottom: 0;
    margin: 0;
    overflow: hidden;
}