/* === ЦВЕТОВАЯ ПАЛИТРА ИЗ CHALLENGE_PR.CSS === */
:root {
    --primary: #1a73e8;
    --primary-dark: #0d47a1;  /* Основной темно-синий цвет */
    --primary-light: #e8f0fe;
    --secondary: #34a853;
    --secondary-light: #e6f4ea;
    --accent: #ea4335;
    --light-bg: #f8f9fa;
    --card-bg: #ffffff;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-tertiary: #80868b;
    --border: #dadce0;
    --border-light: #e8eaed;
    --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.1);
    --shadow-md: 0 2px 6px 2px rgba(60, 64, 67, 0.15);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 24px rgba(60, 64, 67, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === БАЗОВЫЕ СТИЛИ === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--light-bg);
    min-height: 100vh;
    font-size: 16px;
}

/* === ДЕТАЛЬНАЯ СТРАНИЦА НОВОСТИ (СКРЫТА ИЗНАЧАЛЬНО) === */
.news-detail-page {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--light-bg);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.news-detail-container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.news-detail-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.news-detail-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.news-detail-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.news-detail-back {
    background: var(--primary-dark);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
}

.news-detail-back:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.news-detail-date {
    font-size: 1rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === ГАЛЕРЕЯ ИЗОБРАЖЕНИЙ === */
.gallery-section {
    margin-bottom: 30px;
    display: none;
}

.carousel-container {
    position: relative;
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: #f5f5f5;
    height: 400px;
    margin-bottom: 15px;
}

.carousel {
    display: flex;
    height: 100%;
    position: relative;
    transition: transform 0.3s ease;
}

.carousel-slide {
    flex: 0 0 100%;
    height: 100%;
    display: none;
}

.carousel-slide.active {
    display: block;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f5f5f5;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--primary-dark);
    transition: var(--transition);
    z-index: 10;
    box-shadow: var(--shadow-md);
}

.carousel-nav:hover {
    background: var(--primary-dark);
    color: white;
}

.carousel-prev {
    left: 15px;
}

.carousel-next {
    right: 15px;
}

.carousel-dots {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 10;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.carousel-dot.active {
    background: white;
    transform: scale(1.2);
}

/* === ТЕКСТ НОВОСТИ === */
.news-detail-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.news-detail-text p {
    margin-bottom: 1.5em;
}

.news-detail-text img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}

/* === ОСНОВНОЙ КОНТЕНТ === */
#main-content-area {
    padding: 20px;
}

/* ШАПКА В СТИЛЕ CHALLENGE */
.news-header {
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 24px 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
}

.header-logo h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.header-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ОСНОВНОЙ КОНТЕЙНЕР */
.news-container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

/* ФИЛЬТРЫ И СОРТИРОВКА */
.news-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-light);
    flex-wrap: wrap;
    gap: 15px;
}

.news-stats {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.news-stats i {
    color: var(--primary-dark);
}

.news-stats strong {
    color: var(--text-primary);
    font-weight: 600;
}

.news-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-btn:hover {
    border-color: var(--primary-dark);
    color: var(--primary-dark);
    background: rgba(13, 71, 161, 0.05);
    transform: translateY(-1px);
}

.filter-btn.active {
    background: var(--primary-dark);
    color: white;
    border-color: var(--primary-dark);
}

/* СЕТКА НОВОСТЕЙ */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.news-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-dark);
}

.news-image-container {
    position: relative;
    height: 200px;
    overflow: hidden;
    flex-shrink: 0;
}

.news-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.news-card:hover .news-image {
    transform: scale(1.05);
}

.no-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    gap: 10px;
}

.no-image i {
    font-size: 2rem;
    opacity: 0.5;
}

.no-image span {
    font-size: 0.875rem;
    font-weight: 500;
}

/* БЕЙДЖ ДАТЫ */
.news-date-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    z-index: 2;
}

.news-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.news-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 12px;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-excerpt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.news-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
}

/* === КНОПКА "ЧИТАТЬ" КАК В CHALLENGE_PR.PHP === */
.news-read-btn {
    background: transparent;
    color: var(--primary-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

.news-read-btn:hover {
    background: var(--primary-dark);
    color: white;
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.news-read-btn i {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.news-read-btn:hover i {
    transform: translateX(3px);
}

.news-read-btn:focus-visible {
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
}

.news-id {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-family: monospace;
}

/* ПАГИНАЦИЯ */
.news-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--border-light);
}

.page-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary-dark);
    color: var(--primary-dark);
    background: rgba(13, 71, 161, 0.05);
    transform: translateY(-1px);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent !important;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.page-number {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    text-decoration: none;
}

.page-number:hover:not(.active) {
    background: rgba(13, 71, 161, 0.05);
    color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.page-number.active {
    background: var(--primary-dark);
    color: white;
    border-color: var(--primary-dark);
}

.page-dots {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
}

/* СООБЩЕНИЯ */
.no-news-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 2px dashed var(--border);
}

.no-news-message i {
    font-size: 3rem;
    color: var(--text-tertiary);
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-news-message h3 {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.no-news-message p {
    color: var(--text-tertiary);
    max-width: 400px;
    margin: 0 auto;
}

.error-message {
    text-align: center;
    padding: 40px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--primary-dark);
}

.error-message i {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 20px;
}

/* АДАПТИВНОСТЬ */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    #main-content-area {
        padding: 15px;
    }
    
    .news-detail-page {
        padding: 15px;
    }
    
    .news-detail-container {
        padding: 20px;
    }
    
    .news-detail-title {
        font-size: 1.5rem;
    }
    
    .carousel-container {
        height: 300px;
    }
    
    .news-container {
        padding: 20px;
    }
    
    .news-grid {
        grid-template-columns: 1fr;
    }
    
    .news-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .news-filters {
        overflow-x: auto;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }
    
    .filter-btn {
        white-space: nowrap;
    }
    
    .news-pagination {
        flex-wrap: wrap;
    }
    
    .page-btn span {
        display: none;
    }
}

@media (max-width: 480px) {
    .news-image-container {
        height: 180px;
    }
    
    .news-content {
        padding: 16px;
    }
    
    .news-title {
        font-size: 1rem;
    }
    
    .carousel-container {
        height: 250px;
    }
    
    .page-number {
        min-width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }
    
    .news-read-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* === ТЕМНАЯ ТЕМА === */
@media (prefers-color-scheme: dark) {
    :root {
        --light-bg: #121212;
        --card-bg: #1e1e1e;
        --text-primary: #e8eaed;
        --text-secondary: #9aa0a6;
        --text-tertiary: #80868b;
        --border: #3c4043;
        --border-light: #5f6368;
        --primary-light: rgba(26, 115, 232, 0.1);
        --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
        --shadow-md: 0 2px 6px 2px rgba(0, 0, 0, 0.4);
        --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.6);
    }
    
    .news-header {
        background-color: #1e1e1e;
        border-bottom-color: #3c4043;
    }
    
    .no-image {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    }
    
    .news-date-badge {
        background: rgba(30, 30, 30, 0.9);
        color: var(--text-primary);
    }
    
    /* Прозрачные кнопки в темной теме */
    .filter-btn {
        background: transparent;
        color: var(--text-secondary);
        border-color: var(--border);
    }
    
    .filter-btn:hover {
        background: rgba(13, 71, 161, 0.1);
        color: var(--primary);
        border-color: var(--primary);
    }
    
    .filter-btn.active {
        background: var(--primary-dark);
        color: white;
    }
    
    /* Кнопка "Читать" в темной теме */
    .news-read-btn {
        color: var(--primary);
        border-color: var(--border);
    }
    
    .news-read-btn:hover {
        background: var(--primary-dark);
        color: white;
        border-color: var(--primary-dark);
    }
    
    .page-btn, .page-number {
        background: transparent;
        color: var(--text-secondary);
        border-color: var(--border);
    }
    
    .page-btn:hover:not(:disabled),
    .page-number:hover:not(.active) {
        background: rgba(13, 71, 161, 0.1);
        color: var(--primary);
    }
}

/* === АКСЕССИБИЛЬНОСТЬ === */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
    
    .news-read-btn:hover {
        transform: none;
    }
    
    .news-read-btn:hover i {
        transform: none;
    }
}

:focus-visible {
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

