:root {
    --background: #0a0b1b;
    --foreground: #ffffff;
    --muted: rgba(255, 255, 255, 0.6);
    --primary: #ff1cf7;
    --primary-gradient: linear-gradient(to right, #18bfe3, #b249f8);
    --border-color: rgba(255, 255, 255, 0.1);
}

body {
    background-color: #3678cf;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    scroll-behavior: auto;
}

.news-item:focus {
    scroll-margin: 0;
    scroll-padding: 0;
}

#new-news-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Desktop: 3 колонки Masonry с отступами */
@media (min-width: 768px) {
    #new-news-container {
        column-count: 3;
        column-gap: 20px;
        column-fill: balance;
    }

    #new-news-container .news-item {
        margin: 0 0 20px 0;
        max-width: none;
        break-inside: avoid;
        page-break-inside: avoid;
        display: inline-block;
        width: 100%;
        vertical-align: top;
    }
}

/* Tablet: 2 колонки с отступами */
@media (min-width: 480px) and (max-width: 767px) {
    #new-news-container {
        column-count: 2;
        column-gap: 15px;
        column-fill: balance;
    }

    #new-news-container .news-item {
        margin: 0 0 15px 0;
        break-inside: avoid;
        page-break-inside: avoid;
        display: inline-block;
        width: 100%;
        vertical-align: top;
    }
}

/* Mobile: вертикально с отступами */
@media (max-width: 479px) {
    #new-news-container {
        display: block;
    }
    
    #new-news-container .news-item {
        margin: 0 0 15px 0;
    }
}

#news-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Desktop: 3 колонки */
@media (min-width: 768px) {
    #news-container {
        column-count: 3;
        column-gap: 20px;
        column-fill: balance;
    }
}

/* Tablet: 2 колонки */
@media (min-width: 480px) and (max-width: 767px) {
    #news-container {
        column-count: 2;
        column-gap: 15px;
        column-fill: balance;
    }
}

/* Mobile: вертикально */
@media (max-width: 479px) {
    #news-container {
        display: block;
    }
}

.news-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 20px;
    margin: 0 0 20px 0;
    max-width: 900px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: inline-block;
    width: 100%;
    vertical-align: top;
    box-sizing: border-box;
}

.news-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.news-media {
    max-width: 100%;
    border-radius: 10px;
    margin: 15px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.news-media.video {
    width: 100%;
    height: auto;
}

.news-text {
    margin: 15px 0;
    font-size: 16px;
    line-height: 1.7;
}

.news-date {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.news-date::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url('/iconmedia/time.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-right: 8px;
}

/* Read More Button */
.read-more {
    display: inline-block;
    margin-top: 10px;
    color: #4a9eff;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
    padding: 8px 16px;
    background: rgba(74, 158, 255, 0.1);
    border-radius: 20px;
    border: 1px solid #4a9eff;
}

.read-more:hover {
    color: #2d7fd8;
    background: rgba(74, 158, 255, 0.2);
    text-decoration: none;
}

#pagination-container {
    margin-top: 40px;
    padding: 0 10px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination a {
    text-decoration: none;
    color: #ffffff;
    background: #d08907;
    padding: 12px 25px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(208, 137, 7, 0.3);
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.pagination a:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(208, 137, 7, 0.5);
}

.pagination strong {
    background: #d08907;
    padding: 12px 25px;
    border-radius: 25px;
    color: white;
    font-weight: bold;
}

.load-more-container {
    display: flex;
    justify-content: center;
    margin: 30px 0;
}

.load-more-btn {
    background: #d08907;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(208, 137, 7, 0.3);
    position: relative;
    overflow: hidden;
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(208, 137, 7, 0.4);
}

.load-more-btn:active {
    transform: translateY(0);
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.no-more-news {
    text-align: center;
    color: var(--muted);
    padding: 20px;
    font-style: italic;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #3376d1;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
    position: relative;
}

.nav-links a:hover {
    color: var(--foreground);
}

.nav-links a.active {
    color: #18bfe3;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, #18bfe3, #b249f8);
    border-radius: 1px;
}

.menu-button {
    display: none;
    background: none;
    border: none;
    color: var(--foreground);
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.8rem;
}

.page-title {
    text-align: center;
    margin: 80px 0 30px 0;
    font-size: 2.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: bold;
}

.page-subtitle {
    text-align: center;
    color: var(--muted);
    margin-bottom: 40px;
    font-size: 1.1rem;
}

.source-link {
    color: #ffa500;
    font-size: 14px;
    text-align: right;
    margin-top: 15px;
    padding: 8px 0;
    border-top: 1px solid rgba(255, 165, 0, 0.2);
}

.source-link a {
    color: #ffa500;
    text-decoration: none;
    font-weight: 500;
}

.source-link a:hover {
    text-decoration: underline;
    color: #ffd700;
}

.loading {
    text-align: center;
    padding: 50px;
    color: var(--muted);
}

.error-message {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 10px;
    padding: 20px;
    margin: 20px auto;
    max-width: 600px;
    text-align: center;
}

@media (max-width: 768px) {
    .menu-button {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 4rem;
        left: 0;
        right: 0;
        background: #3376d1;
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    }

    .nav-links.active {
        display: flex;
    }

    .page-title {
        font-size: 2rem;
        margin: 70px 0 20px 0;
    }

    .news-item {
        margin: 10px;
        padding: 15px;
    }

    .pagination a {
        padding: 10px 20px;
        margin: 0 5px;
        font-size: 13px;
    }
}

a {
    color: #18bfe3;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #b249f8;
    text-decoration: underline;
}

.stats {
    text-align: center;
    margin: 20px 0;
    color: var(--muted);
    font-size: 14px;
}

.media-album {
    display: grid;
    gap: 8px;
    margin: 15px 0;
    border-radius: 12px;
    overflow: hidden;
}

.media-album.single {
    grid-template-columns: 1fr;
}

.media-album.single img,
.media-album.single video {
    width: 100%;
    height: auto;
    border-radius: 12px;
    display: block;
}

.media-album.double {
    grid-template-columns: 1fr 1fr;
}

.media-album.triple {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.media-album.triple :nth-child(1) {
    grid-row: 1 / -1;
}

.media-album.triple :nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}

.media-album.triple :nth-child(3) {
    grid-column: 2;
    grid-row: 2;
}

.media-album.quad {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.media-album.grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

@media (min-width: 768px) {
    .media-album.triple {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: 1fr;
    }

    .media-album.triple :nth-child(1) {
        grid-row: 1;
        grid-column: 1;
    }

    .media-album.triple :nth-child(2) {
        grid-column: 2;
        grid-row: 1;
    }

    .media-album.triple :nth-child(3) {
        grid-column: 3;
        grid-row: 1;
    }

    .media-album.quad {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: auto;
    }

    .media-album.grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: auto;
    }
}

.media-album img,
.media-album video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.media-album img:hover,
.media-album video:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.media-album video {
    background: #000;
}

.media-type-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(4px);
}

.media-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.media-item.play-button::after {
    content: "▶";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.single-media {
    border-radius: 10px;
    margin: 15px 0;
}

/* Стили для карусели */
.media-carousel {
    position: relative;
    width: 100%;
    margin: 15px 0;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.carousel-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-slide.active {
    opacity: 1;
    z-index: 1;
}

.carousel-media {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    cursor: pointer;
}

.carousel-media.video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 30px;
    padding: 10px 15px;
    cursor: pointer;
    z-index: 10;
    border-radius: 5px;
    transition: background 0.3s ease;
    backdrop-filter: blur(5px);
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

.carousel-indicators {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.carousel-indicators .indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-indicators .indicator:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.2);
}

.carousel-indicators .indicator.active {
    background: #ffffff;
    width: 12px;
    height: 12px;
}

.carousel-counter {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 500;
    z-index: 10;
    backdrop-filter: blur(5px);
}

@media (max-width: 768px) {
    .carousel-btn {
        font-size: 24px;
        padding: 8px 12px;
    }
    
    .carousel-prev {
        left: 5px;
    }
    
    .carousel-next {
        right: 5px;
    }
    
    .carousel-counter {
        top: 10px;
        right: 10px;
        font-size: 12px;
        padding: 4px 10px;
    }
}

/* Fullscreen styles */
.fullscreen-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.fullscreen-overlay.active {
    display: flex;
}

.fullscreen-overlay img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.fullscreen-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    z-index: 10001;
}
