/**
 * Стили для уведомлений в TGBooster
 * Улучшенные стили для всплывающих уведомлений на всех страницах
 */

/* Контейнер для уведомлений */
.notifications-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

/* Стили для всплывающих уведомлений */
.notification {
    position: relative;
    transform: translateX(120%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 360px;
    opacity: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 1;
    pointer-events: auto;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification {
    display: flex;
    align-items: center;
    border-left: 3px solid var(--color-primary);
    border-radius: 6px;
    padding: 10px 12px;
    background-color: #2a2a2a;
}

/* Цветовые варианты уведомлений */
.success {
    border-left-color: #4caf50;
}

.error {
    border-left-color: #f44336;
}

.warning {
    border-left-color: #ff9800;
}

.info {
    border-left-color: #2196f3;
}

/* Иконка уведомления */
.success i {
    color: #4caf50;
}

.error i {
    color: #f44336;
}

.warning i {
    color: #ff9800;
}

.info i {
    color: #2196f3;
}

.notification i {
    font-size: 18px;
    margin-right: 12px;
}

/* Текст уведомления */
.notification-message {
    color: #ffffff;
    font-size: 14px;
    line-height: 1.4;
    flex: 1;
}

/* Кнопка закрытия */
.notification-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    line-height: 1;
    transition: color 0.2s ease;
}

.notification-close:hover {
    color: #fff;
}

/* Анимация для спиннера загрузки */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(156, 163, 175, 0.2) rgba(17, 17, 17, 0.2);
    border-top-color: rgba(156, 163, 175, 0.2);
    animation: spin 1s linear infinite;
}

/* Улучшенные стили для всплывающего меню уведомлений (колокольчик) */
.notifications-popup {
    position: absolute;
    right: 0;
    top: 100%;
    width: 320px;
    background-color: #252525;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 1px solid #3a3a3a;
    overflow: hidden;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    margin-top: 8px;
}

/* Показать popup при наведении */
#notifications-icon:hover .notifications-popup,
.notifications-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Стили для бейджа с количеством уведомлений */
.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: linear-gradient(135deg, #ff4757, #ff3742);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #252525;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    min-width: 18px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 71, 87, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); }
}

/* Скрыть бейдж, если нет уведомлений */
.notification-badge.hidden {
    display: none !important;
}

/* Управление видимостью через JavaScript */

/* Заголовок всплывающего меню уведомлений */
.notification-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #3a3a3a;
}

.notification-popup-title {
    font-weight: 600;
    color: #fff;
}

/* Стиль для списка уведомлений */
#notifications-popup-list {
    max-height: 320px;
    overflow-y: auto;
}

/* Элемент уведомления в списке */
.notification-popup-item {
    padding: 12px 16px;
    border-bottom: 1px solid #3a3a3a;
    transition: background-color 0.2s ease;
    cursor: pointer;
    position: relative;
}

.notification-popup-item:last-child {
    border-bottom: none;
}

.notification-popup-item:hover {
    background-color: #2a2a2a;
}

.notification-popup-item.unread {
    background-color: rgba(33, 150, 243, 0.1);
    border-left: 3px solid #2196f3;
}

.notification-popup-item .notification-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.notification-popup-item .notification-icon {
    color: #2196f3;
    font-size: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.notification-popup-item .notification-text {
    flex: 1;
    color: #e0e0e0;
    font-size: 13px;
    line-height: 1.4;
}

.notification-popup-item .notification-time {
    color: #888;
    font-size: 11px;
    margin-top: 4px;
}

.notification-popup-item.unread .notification-text {
    color: #fff;
    font-weight: 500;
}

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

.notifications-empty i {
    font-size: 32px;
    margin-bottom: 8px;
    color: #555;
}

/* Футер всплывающего меню с уведомлениями */
.notification-popup-footer {
    padding: 12px 16px;
    text-align: center;
    border-top: 1px solid #3a3a3a;
}

.notification-popup-footer a {
    color: #2196f3;
    font-size: 14px;
    text-decoration: none;
}

.notification-popup-footer a:hover {
    text-decoration: underline;
}

/* Упрощенная и надежная система z-index для уведомлений */

/* Основной контейнер уведомлений */
.notifications-container {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 9999 !important;
    max-width: 360px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    pointer-events: none !important;
}

/* Каждое уведомление кликабельно */
.notifications-container .notification {
    pointer-events: auto !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Всплывающее меню уведомлений в шапке */
.notifications-popup {
    z-index: 9998 !important;
}

/* Ограничиваем z-index всех элементов шапки */
header, .header, nav, .nav, .navbar, 
.sticky, .fixed, [class*="fixed"], [class*="sticky"] {
    z-index: 1000 !important;
    max-z-index: 1000 !important;
}

/* Убеждаемся что дочерние элементы шапки не превышают z-index */
header *, .header *, nav *, .nav *, .navbar * {
    z-index: inherit !important;
}

/* Выпадающие меню в шапке */
.user-menu, .dropdown-menu, .mobile-menu {
    z-index: 1001 !important;
}

/* Модальные окна */
.modal, .modal-backdrop, .overlay {
    z-index: 1050 !important;
}

/* Убираем конфликтующие правила позиционирования */
body, html {
    position: static !important;
    z-index: auto !important;
}

/* Стили для пользовательских чекбоксов */
.custom-checkbox {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #555;
  border-radius: 4px;
  margin: 0;
  position: relative;
  cursor: pointer;
  background-color: transparent;
  flex-shrink: 0;
}
.custom-checkbox:checked {
  background-color: #3b82f6;
  border-color: #3b82f6;
}
.custom-checkbox:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}