/* Основные стили страницы ресурса */
.resource-page-title {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--text-color);
}

/* Блок просмотра файлов */
.resource-viewer {
    position: relative;
    width: 100%;
    height: 500px;
    margin-bottom: 3rem;
    overflow: hidden;
}

.viewer-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.viewer-item {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.viewer-item.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Изображения */
.image-viewer {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: pointer;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
}

/* PDF */
.pdf-viewer {
    width: 70%;
    height: 100%;
    border: none;
}

/* Аудио */
.audio-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.audio-info {
    text-align: center;
    margin-bottom: 30px;
}

.audio-info h4 {
    font-family: var(--header-font);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 10px;
    max-width: 400px;
    word-wrap: break-word;
}

.audio-info p {
    font-size: 1rem;
    color: var(--subtle-text-color);
    margin: 0;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.audio-player {
    width: 100%;
    max-width: 500px;
    height: 60px;
    margin-bottom: 25px;
    border-radius: var(--border-radius-sm);
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    outline: none;
}

.audio-player:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(33, 37, 41, 0.1);
}

/* Файлы для скачивания */
.file-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.file-icon {
    font-size: 4rem;
    color: var(--subtle-text-color);
    margin-bottom: 1rem;
}

.file-container h4 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    transition: all 0.3s ease;
}

.download-btn:hover {
    background: var(--subtle-text-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md-hover);
    color: white;
}

/* Навигация по файлам */
.viewer-nav {
    position: static;
    left: auto;
    transform: none;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 15px;
    background-color: var(--bg-color);
    border-radius: var(--border-radius-md);
}

.nav-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-dot.active,
.nav-dot:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.nav-arrow:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.nav-prev {
    left: 1rem;
}

.nav-next {
    right: 1rem;
}

/* Двухколоночный блок */
.resource-info {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 3rem;
    margin-bottom: 4rem;
    align-items: start;
}

/* Метаданные */
.resource-meta {
    position: sticky;
    top: 120px;
}

.edit-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.edit-btn:hover {
    background: var(--subtle-text-color);
    color: white;
}

.meta-item {
    margin-bottom: 1.5rem;
}

.meta-item strong {
    display: block;
    color: var(--subtle-text-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.meta-item span,
.meta-item a {
    color: var(--text-color);
    font-weight: 500;
}

.meta-item a:hover {
    color: var(--accent-color);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.tag:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white !important;
}

/* Описание */
.resource-description h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.description-content {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-color);
    text-align: justify;
}

.description-content p {
    margin-bottom: 1rem;
}

/* Похожие ресурсы */
.similar-resources {
    margin-top: 2rem;
}

.similar-resources h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.similar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.similar-card {
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    text-decoration: none;
    transition: all 0.3s ease;
    display: block;
}

.similar-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md-hover);
    border-color: var(--accent-color);
}

.similar-preview {
    height: 200px;
    overflow: hidden;
}

.similar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.similar-card:hover .similar-preview img {
    transform: scale(1.05);
}

.similar-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    color: var(--border-color);
    font-size: 4rem;
    font-weight: 600;
}

.similar-info {
    padding: 1rem;
}

.similar-info h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.similar-info p {
    font-size: 0.9rem;
    color: var(--subtle-text-color);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.similar-type {
    font-size: 0.8rem;
    color: var(--subtle-text-color);
    text-transform: uppercase;
    font-weight: 500;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 2rem;
    width: 90%;
    max-width: 1200px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.modal-image {
    max-width: 100%;
    max-height: 80%;
    object-fit: contain;
    border-radius: var(--border-radius-md);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 2rem;
    color: white;
    font-size: 2.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--accent-color);
}

.modal-caption {
    color: white;
    text-align: center;
    padding: 1rem;
    font-size: 1.1rem;
    max-width: 80%;
}

/* Стили для разных типов файлов */
.file-icon .fa-file-word { color: #2b579a; }
.file-icon .fa-file-excel { color: #217346; }
.file-icon .fa-file-pdf { color: #dc3545; }
.file-icon .fa-file { color: var(--subtle-text-color); }

/* Адаптивность */
@media (max-width: 992px) {
    .resource-viewer {
        height: 400px;
    }
    
    .nav-arrow {
        display: none;
    }
    
    .resource-info {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .resource-meta {
        position: static;
        order: 2;
    }
    
    .resource-description {
        order: 1;
    }
}

@media (max-width: 768px) {
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: flex;
    }

    .mobile-only.file-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 40px 20px;
        width: 100%;
        height: 100%;
        box-sizing: border-box;
        position: absolute;
        top: 0;
        left: 0;
    }
    
    .mobile-only .file-icon {
        font-size: 3rem;
        margin-bottom: 15px;
    }
    
    .mobile-only .file-container h4 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .mobile-only .download-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        min-width: 140px;
    }

    .resource-page-title {
        font-size: 2rem;
    }
    
    .resource-viewer {
        height: 350px;
        margin-bottom: 2rem;
    }
    
    .resource-info {
        display: block;
        gap: 0;
        margin-bottom: 3rem;
    }
    
    .audio-container {
        padding: 1.5rem;
    }
    
    .audio-info h4 {
        font-size: 1.3rem;
    }
    
    .file-container {
        padding: 1.5rem;
    }
    
    .file-icon {
        font-size: 3rem;
    }
    
    .file-container h4 {
        font-size: 1.2rem;
    }
    
    .similar-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .similar-preview {
        height: 180px;
    }
    
    .pdf-viewer {
        display: none;
    }
    
    .pdf-viewer + .file-container {
        display: flex;
    }
}

@media (max-width: 480px) {
    .resource-page-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    .mobile-only.file-container {
        padding: 30px 15px;
    }
    
    .mobile-only .file-icon {
        font-size: 2.5rem;
        margin-bottom: 10px;
    }
    
    .mobile-only .file-container h4 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    .mobile-only .download-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
        min-width: 120px;
    }
    
    .resource-viewer {
        height: 300px;
        margin-bottom: 1.5rem;
    }
    
    .resource-info {
        gap: 1rem;
        margin-bottom: 2rem;
    }
    
    .audio-container {
        padding: 1rem;
    }
    
    .audio-info h4 {
        font-size: 1.1rem;
    }
    
    .audio-player {
        max-width: 100%;
    }
    
    .file-container {
        padding: 1rem;
    }
    
    .file-icon {
        font-size: 2.5rem;
    }
    
    .file-container h4 {
        font-size: 1.1rem;
    }
    
    .download-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .similar-grid {
        grid-template-columns: 1fr;
    }
    
    .similar-resources h2 {
        font-size: 1.6rem;
        margin-bottom: 1.5rem;
    }
    
    .modal-content {
        padding: 1rem;
    }
    
    .modal-close {
        top: 0.5rem;
        right: 1rem;
        font-size: 2rem;
    }
}

/* Анимации */
.viewer-item {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.viewer-item.active {
    opacity: 1;
}


.audio-player::-webkit-media-controls-panel {
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius-sm);
}

.audio-player::-webkit-media-controls-play-button,
.audio-player::-webkit-media-controls-pause-button {
    border-radius: 50%;
    margin: 0 10px;
}

.audio-player::-webkit-media-controls-timeline {
    border-radius: 25px;
    margin: 0 10px;
}

.audio-player::-webkit-media-controls-current-time-display,
.audio-player::-webkit-media-controls-time-remaining-display {
    color: var(--text-color);
    font-family: var(--body-font);
    font-size: 0.9rem;
}

.audio-player::-webkit-media-controls-volume-slider {
    background-color: var(--bg-color);
    border-radius: 25px;
}

/* Улучшенная стилизация для Firefox */
@-moz-document url-prefix() {
    .audio-player {
        background: var(--card-bg-color);
        border: 1px solid var(--border-color);
    }
}

/* Показывать только на десктопе */
.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}