/* Базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Экран загрузки */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-brand {
    font-size: 48px;
    font-family: 'UnifrakturCook', cursive;
    color: #212529;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: #333;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Заголовок */
.header {
    background: transparent;
    border-bottom: none;
    padding: 20px 0 0 0;
    margin-bottom: 16px;
    position: sticky;
    top: -16px;
    z-index: 100;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.header.loaded {
    opacity: 1;
    transform: translateY(0);
}

.header.compact {
    background: transparent;
    border-bottom: none;
    padding: 12px 0;
}

.brand-prefix {
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-align: center;
    color: #6c757d;
    font-weight: 500;
    letter-spacing: 3px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

.brand {
    font-size: 64px;
    line-height: 64px;
    font-family: 'UnifrakturCook', cursive;
    text-align: center;
    color: #212529;
    transition: all 0.3s ease;
}

.current-date {
    text-align: center;
    color: #6c757d;
    font-size: 14px;
    opacity: 1;
    transform: translateY(0);
    margin-top: 8px;
    margin-bottom: 16px;
    font-weight: 400;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.header.compact .brand {
    font-size: 24px;
    margin-bottom: 0;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 32px;
    padding: 8px 32px;
    display: block;
    margin: 0 auto;
    width: fit-content;
    line-height: 1.2;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.05);
}

.header.compact .brand-prefix {
    opacity: 0 !important;
    transform: translateY(-20px) !important;
    transition: opacity 0.3s ease, transform 0.3s ease !important;
}

.header.compact .current-date {
    opacity: 0 !important;
    transform: translateY(-20px) !important;
    transition: opacity 0.3s ease, transform 0.3s ease !important;
}

.header.compact .weather-periods {
    opacity: 0 !important;
    transform: translateY(-30px) !important;
    height: 0 !important;
    overflow: hidden !important;
    transition: opacity 0.3s ease, transform 0.3s ease, height 0.3s ease !important;
}

.header.compact .weather-summary {
    opacity: 0 !important;
    transform: translateY(-20px) !important;
    transition: opacity 0.3s ease, transform 0.3s ease !important;
}

/* Основной контент */
.main {
    padding-bottom: 32px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    position: relative;
    z-index: 1;
}

.main.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Секции */
.news-section {
    margin-bottom: 24px;
    max-width: 100%;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #212529;
}

/* Погода */
.weather-periods {
    display: block;
    transition: opacity 0.3s ease, transform 0.3s ease, height 0.3s ease;
    z-index: -1;
    margin-bottom: 12px;
    opacity: 1;
    transform: translateY(0);
}

.period {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 16px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    transition: opacity 0.3s ease;
}

.period-section {
    flex: 1;
    text-align: center;
}

.period-divider {
    width: 1px;
    height: 80px;
    background: rgba(0, 0, 0, 0.1);
    margin: 0 8px;
}

.period.loading {
    opacity: 0.6;
}

.period-time {
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.period-temp {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #212529;
}

.period-desc {
    color: #6c757d;
    font-size: 12px;
}

/* Текстовый блок с прогнозом */
.weather-summary {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.4;
    color: #495057;
    display: flex;
    align-items: top;
    gap: 12px;
}

.weather-emoji {
    font-size: 16px;
    flex-shrink: 0;
}

.weather-text {
    flex: 1;
}

/* Фиксированные фильтры внизу */
.bottom-filters {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 1000;
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    
}

.bottom-filters.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.filter-container {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    padding: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 4px 16px rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 4px;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.filter-chip {
    padding: 10px 16px;
    border: none;
    border-radius: 20px;
    background: transparent;
    color: #000000;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.filter-chip:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #000000;
}

.filter-chip.active {
    background: #000000;
    color: white;
    transform: scale(1.05);
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 100px; /* Отступ для фиксированных фильтров */
    transition: opacity 0.3s ease;
}

.news-list.filtering {
    opacity: 0.5;
}

.news-item {
    display: flex;
    gap: 12px;
    padding: 20px;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    background: white;
    transition: all 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

.news-item.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

.news-item.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.news-item:hover {
    border-color: #dc3545;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.15);
    transform: translateY(-2px);
}

.news-item-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s;
}

/* Убираем дублирующий ховер у ссылки */
/* .news-item-link:hover {
    transform: translateY(-2px);
} */

.news-item-clickable {
    cursor: pointer;
    transition: transform 0.2s;
}

/* Убираем дублирующий ховер у кликабельного элемента */
/* .news-item-clickable:hover {
    transform: translateY(-2px);
} */

.news-image {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: #f8f9fa;
}

.news-content {
    flex: 1;
    min-width: 0;
}

.news-link {
    display: block;
    color: #212529;
    text-decoration: none;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 6px;
}

/* Убираем ховер у заголовка новости */
/* .news-link:hover {
    color: #dc3545;
} */

.news-source {
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.news-meta {
    font-size: 12px;
    color: #6c757d;
    margin-top: 6px;
}

.news-date {
    font-size: 12px;
    color: #6c757d;
    margin-top: 8px;
}

.news-description {
    font-size: 14px;
    color: #495057;
    line-height: 1.4;
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-image-full {
    width: 100%;
    height: auto;
    border-radius: 6px;
    margin-top: 6px;
    margin-bottom: 6px;
    background: #f8f9fa;
}

/* Кнопки */
.btn {
    background: #0d6efd;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
    margin: 0 4px;
}

.btn:hover {
    background: #0b5ed7;
}

.btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}



.news-actions {
    margin-top: 20px;
    text-align: center;
}



/* Загрузка */
.loading {
    color: #6c757d;
    text-align: center;
    padding: 20px;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
}

/* Скрываем фильтры когда открыто модальное окно */
.modal:not([hidden]) ~ .bottom-filters {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
}

.modal-content {
    position: relative;
    background: white;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Ограничение ширины контента на десктопе */
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 16px;
    line-height: 1.6;
    padding-bottom: 160px; /* Увеличенный отступ снизу для блока кнопок */
    max-width: 800px;
    margin: 0 auto;
}

/* Фиксированные кнопки внизу модального окна */
.modal-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    padding: 20px;
    display: flex;
    justify-content: center;
    opacity: 0;
    transform: translateY(100px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.modal-actions.show {
    opacity: 1;
    transform: translateY(0);
}

.modal-actions-container {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 36px;
    padding: 12px;
    display: flex;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.btn-close {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: #000;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.05);
}



.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    margin-bottom: 16px;
    color: #212529;
    line-height: 1.4;
}

.modal-text {
    margin-bottom: 16px;
    padding-bottom: 96px; /* Дополнительный отступ после текста статьи */
}

.modal-text p {
    margin-bottom: 16px;
}

/* Ограничение размера изображений в модальном окне */
.modal-text img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 12px 0;
}

.modal-text figure {
    margin: 16px 0;
}

.modal-text figure img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

/* Стили для ссылок в статьях Meduza */
.modal-text a {
    color: #dc3545;
    text-decoration: none;
}

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

/* Подписи под фотографиями */
.modal-text figcaption {
    font-size: 12px;
    color: #6c757d;
    margin-top: 8px;
    font-style: italic;
    text-align: center;
}

/* Отдельные ссылки (не в параграфах) */
.modal-text > a,
.modal-text li > a:only-child,
.modal-text div > a:only-child {
    display: inline-block;
    background: #f8f9fa;
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

/* Убираем маркеры списка для элементов с выделенными ссылками */
.modal-text li:has(> a:only-child) {
    list-style: none;
}

/* Для браузеров без поддержки :has() используем альтернативный подход */
.modal-text ul li {
    position: relative;
}

.modal-text li > a:only-child {
    margin-left: -20px; /* Компенсируем отступ списка */
}

.modal-text li:has(> a:only-child)::before,
.modal-text li > a:only-child + *::before {
    display: none;
}

.modal-text > a:hover,
.modal-text li > a:only-child:hover,
.modal-text div > a:only-child:hover {
    background: #e9ecef;
    text-decoration: none;
}

/* Дополнительные стили для статей Meduza */
.modal-text h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 20px 0 12px 0;
    color: #495057;
}

.modal-text ul {
    margin: 16px 0;
    padding-left: 20px;
}

.modal-text li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.modal-text blockquote {
    background: #f8f9fa;
    border-left: 4px solid #0d6efd;
    padding: 16px;
    margin: 16px 0;
    font-style: italic;
    color: #495057;
}

/* Ссылки внутри параграфов остаются простыми */
.modal-text p a {
    display: inline;
    background: none;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
}

.modal-text p a:hover {
    background: none;
    text-decoration: underline;
}

/* Стили для кнопок в контейнере действий */
.modal-actions .btn-primary {
    background: #000000;
    color: white;
    border: 1px solid #000000;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.modal-actions .btn-primary:hover {
    background: #333333;
    transform: scale(1.05);
}

/* Адаптивность */
@media (max-width: 480px) {
    /* Ограничение ширины контента на мобильных */
    .modal-body {
        max-width: 100%;
        padding: 16px;
    }
    
    .weather-periods {
        gap: 8px;
        margin-top: 12px;
        z-index: -1;
    }
    
    .period {
        padding: 12px 8px;
        font-size: 12px;
    }
    
    .period-temp {
        font-size: 18px;
    }
    
    .news-item {
        padding: 12px;
        gap: 10px;
    }
    
    .news-image {
        width: 70px;
        height: 50px;
    }
    
    .header.compact .brand {
        font-size: 32px;
    }
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
        color: #e8e9ea;
    }
    
    .brand-prefix {
        color: #8a8d93;
    }
    
    .brand {
        color: #ffffff;
    }
    
    .header.compact .brand {
        background: rgba(0, 0, 0, 0.5);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .current-date {
        color: #8a8d93;
    }
    
    .period {
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.15);
        color: #e8e9ea;
    }
    
    .period-time {
        color: #b0b3b8;
    }
    
    .period-temp {
        color: #ffffff;
    }
    
    .period-desc {
        color: #8a8d93;
    }
    
    .period-divider {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .weather-summary {
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.15);
        color: #e8e9ea;
    }
    
    .news-item {
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: #e8e9ea;
    }
    
    .news-item:hover {
        border-color: #ff6b6b;
        background: rgba(255, 255, 255, 0.12);
        box-shadow: 0 4px 12px rgba(255, 107, 107, 0.2);
        transform: translateY(-2px);
    }
    
    .news-link {
        color: #ffffff;
    }
    
    .news-link:hover {
        color: #ff6b6b;
    }
    
    .news-source {
        color: #8a8d93;
    }
    
    .news-date {
        color: #8a8d93;
    }
    
    .news-description {
        color: #b0b3b8;
    }
    
    .news-meta {
        color: #8a8d93;
    }
    
    .loading {
        color: #8a8d93;
    }
    

    
    /* Фильтры в темной теме */
    .filter-container {
        background: rgba(0, 0, 0, 0.5);
        border: 1px solid rgba(255, 255, 255, 0.15);
    }
    
    .filter-chip {
        color: #ffffff;
    }
    
    .filter-chip:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }
    
    .filter-chip.active {
        background: #ffffff;
        color: #000000;
    }
    
    /* Модальное окно в темной теме */
    .modal-overlay {
        background: #000000;
    }
    
    .modal-content {
        background: #000000;
        color: #e8e9ea;
    }
    
    .modal-header {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .modal-title {
        color: #ffffff;
    }
    
    .modal-actions-container {
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.15);
    }
    
    .btn-close {
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.15);
        color: #ffffff;
    }
    
    .btn-close:hover {
        background: rgba(255, 255, 255, 0.2);
        color: #ffffff;
    }
    
    .modal-actions .btn-primary {
        background: #ffffff;
        color: #000000;
        border: 1px solid #ffffff;
    }
    
    .modal-actions .btn-primary:hover {
        background: #e8e9ea;
        color: #000000;
    }
    
    .modal-body {
        color: #e8e9ea;
    }
    
    /* Стили для ссылок в статьях в темной теме */
    .modal-text a {
        color: #ff6b6b;
    }
    
    .modal-text figcaption {
        color: #8a8d93;
    }
    
    .modal-text > a,
    .modal-text li > a:only-child,
    .modal-text div > a:only-child {
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: #ff6b6b;
    }
    
    .modal-text > a:hover,
    .modal-text li > a:only-child:hover,
    .modal-text div > a:only-child:hover {
        background: rgba(255, 255, 255, 0.12);
    }
    
    .modal-text h4 {
        color: #b0b3b8;
    }
    
    .modal-text blockquote {
        background: rgba(255, 255, 255, 0.05);
        border-left: 4px solid #58a6ff;
        color: #b0b3b8;
    }
    
    /* Загрузочный экран в темной теме */
    .loading-screen {
        background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    }
    
    .loading-brand {
        color: #ffffff;
    }
}

/* Стили для разных источников - убраны цветовые полосы */

/* Дополнительные элементы для Meduza */
.news-length-indicator {
    display: inline-block;
    font-size: 11px;
    color: #6c757d;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.news-read-more {
    margin-top: 8px;
    font-size: 12px;
    color: #6c757d;
}

.read-more-label {
    font-weight: 500;
    margin-right: 4px;
}

.read-more-link {
    color: #dc3545;
    text-decoration: none;
    margin-right: 4px;
}

.read-more-link:hover {
    text-decoration: underline;
}


