/* Улучшенные стили для системы уведомлений */

/* Кнопка уведомлений с анимированным бейджем */
.notifications-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.notifications-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.notifications-btn svg {
    width: 20px;
    height: 20px;
    color: #ffffff;
    transition: color 0.2s ease;
}

/* Красивый анимированный бейдж */
.notification-badge {
    position: absolute;
    top: 2px;
    right: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    border: 2px solid #fff;
    box-shadow: 0 0 10px #a78bfa55;
    z-index: 10;
    padding: 0;
    display: none;
}
.notification-badge.has-unread {
    display: block;
    animation: pulse-badge-violet 1.6s infinite;
}
.notification-badge.has-unread::after {
    content: '';
    position: absolute;
    left: -6px; top: -6px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: inherit;
    opacity: .16;
    z-index: 0;
    animation: pulse-badge-violet-glow 1.6s infinite;
    pointer-events: none;
}
@keyframes pulse-badge-violet {
    0%,100%{box-shadow:0 0 0 0 #a78bfa99;}
    60%{box-shadow:0 0 0 10px #7c3aed00;}
}
@keyframes pulse-badge-violet-glow {
    0%,100%{opacity:.10;} 50%{opacity:.25;}
}


/* === GLASS NOTIFICATIONS DROPDOWN === */
.notifications-dropdown {
    position: absolute;
    top: 105%;
    right: 0;
    min-width: 325px;
    max-width: 98vw;
    background: rgba(32,34,55,0.7) !important;
    color: #fff !important;
    box-shadow: 0 8px 28px 0 #17132b55, 0 2px 12px #0a073016;
    border-radius: 17px;
    padding: 14px 0 8px 0;
    backdrop-filter: blur(24px) saturate(.97);
    border: 1.2px solid rgba(109,40,217,0.14);
    margin-top: 6px;
    z-index: 1000;
    transition: box-shadow .22s;
}
body.dark .notifications-dropdown {
    background: rgba(36,32,71,0.98) !important;
    color: #f3efff !important;
    box-shadow: 0 12px 36px 0 rgba(78,60,190,0.24),0 3px 10px 0 #0002;
}
.notifications-header {
    padding: 16px 22px 8px 22px;
    font-size: 18px;
    font-weight: bold;
    color: #a5b4fb;
    border-bottom: 1px solid rgba(140,120,225,0.13);
    margin-bottom: 10px;
    letter-spacing: 0.2px;
}
body.dark .notifications-header {
    color: #fff;
    border-color: #3e326d33;
}
.notifications-list {
    padding: 0 16px 0 16px;
}
.notification-item {
    background: rgba(59,62,89,0.5) !important;
    color: #fff !important;
    border-radius: 13px;
    margin-bottom: 9px;
    box-shadow: 0 1.5px 7px 0 #211c3159;
    padding:15px 15px 13px 18px;
    text-align: left;
    font-size: 15px;
    font-weight: 500;
    transition: box-shadow .18s, background .17s;
    box-shadow: 0 2px 12px rgba(124,58,237,.05);
    cursor: pointer;
    border: none;
    position: relative;
}
body.dark .notification-item {
    background: #2e2552 !important;
    color: #f3efff !important;
}
.notification-item:hover {
    background: rgba(100,108,160,0.82) !important;
    border-color: #c4b5fd;
    box-shadow: 0 4px 18px 0 #1f1b3077;
}
body.dark .notification-item:hover {
    background: #1e1930;
    border-color: #a78bfa44;
}
.notification-item.unread {
    border-left: 4px solid #a5b4fc !important;
    background: rgba(97,120,224,0.18) !important;
}
body.dark .notification-item.unread {
    background: #372c5f !important;
    color: #ccccff !important;
    border-left: 4px solid #a78bfa !important;
}

/* === MODAL === */
.notification-modal {
    position: fixed;
    top: 50vh;
    left: 50vw;
    transform: translate(-50%, -50%);
    max-width: 390px;
    width: 96vw;
    max-height: 85vh;
    overflow: auto;
    background: rgba(32,34,55,0.99);
    color: #fff!important;
    border-radius: 20px;
    border: 1.1px solid rgba(109,40,217,0.16);
    padding: 34px 24px 24px 24px;
    box-shadow: 0 14px 70px 0 #232036b5, 0 4px 18px #180b3a6a;
    z-index: 2222;
    font-size: 16px;
    text-align: left;
    display: flex; flex-direction:column;
}
body.dark .notification-modal {
    background: rgba(40,36,80,0.98);
    color: #f4f4fe;
}
.notification-modal-title {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #7c3aed;
}
body.dark .notification-modal-title {color: #fff;}
.notification-modal-close {
    position: absolute;
    right: 14px;
    top: 9px;
    background: none;
    border: none;
    font-size: 22px;
    color: #9686e7;
    cursor: pointer;
    opacity: .8;
    transition: color .14s;
}
.notification-modal-close:hover {color:#7c3aed;opacity:1;}

/* Содержимое уведомления */
.notification-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.notification-title {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.4;
    flex: 1;
}

.notification-time {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    flex-shrink: 0;
}

.notification-message {
    position: relative;
}

.message-text {
    font-size: 15px;
    color: #ccc;
    line-height: 1.5;
}

.message-text.truncated {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Кнопка "Читать полностью" */
.expand-btn {
    background: rgba(157,143,243,0.13) !important;
    color: #e0e0ff !important;
    border-radius: 8px !important;
    font-weight: 600;
    font-size: 12px !important;
    padding: 5px 11px !important;
    margin-top: 8px !important;
    border: none !important;
    box-shadow: none;
    transition:.12s;
}

.expand-btn:hover {
    background: rgba(157,143,243,0.23) !important;
    color:#fff !important;
}

body.dark .expand-btn {
    background: rgba(165,148,255,0.13) !important;
    color: #a78bfa !important;
}
body.dark .expand-btn:hover {
    background: rgba(124, 58, 237, 0.36) !important;
    color: #fff !important;
}

/* Пустое состояние */
.empty-notifications {
    padding: 40px 20px;
    text-align: center;
    color: #888;
}

.empty-notifications svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-notifications h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #ccc;
}

.empty-notifications p {
    margin: 0;
    font-size: 14px;
    color: #888;
}

/* Модальное окно уведомления */
.notification-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.notification-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.notification-modal:not(.show) .modal-content {
    transform: translate(-50%, -50%) scale(0.9);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #333;
    background: #1f1f1f;
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    flex: 1;
    padding-right: 16px;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-close svg {
    width: 18px;
    height: 18px;
    color: #888;
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-message {
    font-size: 15px;
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 16px;
    word-wrap: break-word;
}

.modal-message a {
    color: #3b82f6;
    text-decoration: none;
}

.modal-message a:hover {
    text-decoration: underline;
}

.modal-time {
    font-size: 13px;
    color: #888;
    padding-top: 16px;
    border-top: 1px solid #2a2a2a;
}

/* Адаптивность */
@media (max-width: 480px) {
    .notifications-dropdown {
        width: calc(100vw - 32px);
        right: 16px;
        left: 16px;
    }
    
    .modal-content {
        width: calc(100vw - 32px);
        margin: 16px;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
}

/* Анимации появления */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-item {
    animation: slideInDown 0.3s ease;
}

/* Состояния загрузки */
.notifications-loading {
    padding: 20px;
    text-align: center;
    color: #888;
}

.notifications-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #333;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Бэкдроп для модалки */
.notification-modal-backdrop {
    position: fixed; left: 0; top: 0; right: 0; bottom: 0;
    width: 100vw; height: 100vh;
    background: rgba(27,25,50,0.40);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}

/* Центрированная модалка */
.notification-modal {
    position: relative;
    max-width: 420px;
    width: 96vw;
    max-height: 89vh;
    overflow: auto;
    margin: 0;
    background: rgba(32,34,55,0.98);
    color: #fff;
    border-radius: 20px;
    border: 1.1px solid rgba(109,40,217,0.16);
    padding: 34px 24px 24px 24px;
    box-shadow: 0 14px 70px 0 #232036b5, 0 4px 18px #180b3a6a;
    z-index: 9999;
    font-size: 16px;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
}