м/* ========== ПЕРЕМЕННЫЕ ========== */
:root {
    --bg-dark: #2C2C2C;
    --text-dark: #2C2C2C;
    --text-medium: #545454;
    --text-light: #FFFFFF;
    --text-title: #42ace0;
    --accent-color: #1E90FF;
    --border-color: #3D3D3D;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --sort-bg: #111111;
    --sort-text: #FFFFFF;
    --select-bg: #2C2C2C;
    --select-text: #FFFFFF;
    --card-bg: #2C2C2C;
    --card-bg-header: #545454;
    --preview-bg: #2C2C2C;
    --btn-bg: #FFFFFF;
    --btn-text: #2C2C2C;
    --btn-border: #2C2C2C;
    --btn-hover-bg: #42ACE0;
    --btn-hover-text: #FFFFFF;
    --pagination-bg: transparent;
    --pagination-text: #FFFFFF;
    --pagination-current-bg: #2C2C2C;
    --pagination-current-text: #FFFFFF;
    --pagination-hover-bg: rgba(255, 255, 255, 0.2);
    --pagination-circle-size: 25px;
}

/* ========== КОНТЕЙНЕРЫ ========== */
.wikiscore-container {
    font-family: 'Lab Grotesque', sans-serif;
    position: relative;
    color: var(--text-dark);
    min-height: 800px;
}

.wikiscore-header .header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    max-width: 1180px;
    flex-wrap: wrap;
    gap: 10px;
}

/* ========== ЗАГОЛОВОК ========== */
.wikiscore-page-title h1 {
    font-size: 30px;
    margin: 0;
    color: var(--text-title);
}

/* ========== БЛОК УПРАВЛЕНИЯ (ПОИСК + СОРТИРОВКА) ========== */
.wikiscore-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========== ПОИСК ========== */
.wikiscore-search {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wikiscore-search input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--select-bg);
    color: var(--select-text);
    font-size: 14px;
    width: 200px;
}

.wikiscore-search input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.wikiscore-search button {
    background: var(--select-bg);
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    color: white;
    transition: background 0.3s;
}

.wikiscore-search button:hover {
    background: var(--btn-hover-bg);
}

/* ========== СОРТИРОВКА ========== */
.wikiscore-sorting-dropdown {
    position: relative;
    display: inline-block;
    background: var(--sort-bg);
    color: var(--sort-text);
    border-radius: 4px;
    padding: 5px;
}

.sort-select {
    padding: 8px 15px 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--select-bg);
    color: var(--select-text);
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: all 0.3s;
    min-width: 180px;
}

.sort-select:hover,
.sort-select:focus {
    border-color: var(--accent-color);
}

.sort-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(30, 144, 255, 0.2);
}

.wikiscore-sorting-dropdown select::-ms-expand {
    display: none;
}

.sort-arrow {
    padding-left: 10px;
    cursor: pointer;
}

/* ========== ПАГИНАЦИЯ ========== */
.wikiscore-pagination {
    display: flex;
    align-items: center;
}

.pagination-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--pagination-circle-size);
    height: var(--pagination-circle-size);
    background: var(--pagination-bg);
    color: var(--pagination-text);
    border-radius: 50%;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.page-link.current {
    background: var(--pagination-current-bg);
    color: var(--pagination-current-text);
    font-weight: bold;
    border-color: var(--pagination-current-bg);
}

.page-link:hover:not(.current) {
    background: var(--pagination-hover-bg);
}

.page-dots {
    padding: 5px;
    color: var(--text-light);
    opacity: 0.7;
}

.prev-next {
    width: auto;
    padding: 0 12px;
    border-radius: 20px;
    margin: 0 5px;
    white-space: nowrap;
}

.wikiscore-pagination.bottom {
    margin-top: 30px;
    justify-content: center;
}

/* ========== СЕТКА КАРТОЧЕК ========== */
.wikiscore-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 50px;
}

.wikiscore-item {
    width: 260px;
    height: 420px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
    overflow: visible;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s;
    color: var(--text-light);
}

.wikiscore-item:hover {
    transform: translateY(-5px);
}

/* ========== ШАПКА КАРТОЧКИ ========== */
.item-header {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg-header);
    line-height: .4;
}

.meta-top {
    display: flex;
    justify-content: space-between;
}

.format {
    margin-right: 5px;
    color: var(--text-light);
    margin-bottom: 8px;
    font-size: 16px;
}

.item-pages {
    font-size: 14px;
}

.project-title {
    font-size: 16px;
    margin-bottom: 6px;
    line-height: 1;
    font-weight: bold;
}

.year {
    font-style: italic;
    font-size: 14px;
    font-weight: normal;
}

.item-awards {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 6px;
}

.item-composer {
    font-size: 16px;
    color: var(--text-light);
    line-height: 1;
    font-weight: bold;
}

/* ========== ПРЕВЬЮ (МИНИАТЮРА / PDF) ========== */
.item-preview-container {
    position: relative;
    flex-grow: 1;
    margin: 10px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.pdf-preview-wrapper {
    width: 100%;
    background: var(--preview-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.pdf-preview-canvas {
    width: 170px;
    object-fit: contain;
    transition: transform 0.3s;
}

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    cursor: pointer;
}

.preview-overlay:hover {
    background: rgba(0, 0, 0, 0.5);
}

.preview-overlay .expand-icon {
    font-size: 24px;
    color: white;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.item-preview-container:hover .preview-overlay {
    opacity: 1;
}

/* ========== ПОДВАЛ КАРТОЧКИ ========== */
.item-footer {
    padding: 12px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.download-btn {
    display: inline-block;
    padding: 8px 20px;
    background: var(--btn-bg);
    color: var(--btn-text);
    border: 1px solid var(--btn-border);
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
    margin-bottom: 8px;
}

.download-btn:hover {
    background: var(--btn-hover-bg);
    color: var(--btn-hover-text);
}

.download-count {
    font-size: 12px;
    color: var(--text-light);
    opacity: 0.7;
}

.no-items {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-medium);
    font-style: italic;
}

/* ========== МОДАЛЬНОЕ ОКНО PDF ========== */
.modal-open {
    overflow: hidden;
}

.modal-blur-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 999;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 1000;
    overflow-y: auto;
    animation: fadeIn 0.3s forwards;
}

.pdf-modal-container {
    position: relative;
    background: var(--card-bg);
    border-radius: 8px;
    width: 100%;
    max-width: 85%;
    margin: 20px auto;
    padding: 20px;
    box-shadow: 0 5px 15px var(--shadow-color);
    animation: slideIn 0.3s forwards;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 24px;
    cursor: pointer;
    z-index: 1001;
}

.pdf-modal-header {
    margin-bottom: 20px;
    text-align: center;
}

.pdf-modal-header h3 {
    margin: 0 0 5px;
    color: var(--text-light);
    font-size: 1.5rem;
}

.pdf-modal-header p {
    margin: 0;
    color: var(--text-light);
    opacity: 0.8;
}

.pdf-modal-content {
    margin: 20px 0;
    min-height: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.pdf-modal-count {
    text-align: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.zoom-controls-container {
    text-align: center;
    margin: 10px 0 20px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.1);
    padding: 5px 15px;
    border-radius: 20px;
}

.zoom-controls button {
    background: var(--accent-color);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-controls button:hover {
    background: var(--btn-hover-bg);
}

.zoom-percent {
    color: var(--text-light);
    min-width: 50px;
    text-align: center;
    font-size: 14px;
}

/* ========== МИНИАТЮРЫ ========== */
.pdf-thumbnail {
    width: 170px;
    height: auto;
    object-fit: cover;
}

.image-modal-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image {
    max-width: none;
}

/* ========== МОДАЛЬНОЕ ОКНО КОМПОЗИТОРА ========== */
.composer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.composer-modal-content {
    position: relative;
    background: var(--card-bg);
    color: var(--text-light);
    max-width: 500px;
    width: 90%;
    margin: 20px auto;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 5px 15px var(--shadow-color);
    animation: slideIn 0.3s;
}

.composer-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.composer-modal-body {
    padding: 10px 20px 20px;
    max-height: 90vh;
    overflow-y: auto;
}

.composer-modal-body h3 {
    margin: 0 0 15px;
    padding-right: 20px;
}

.composer-modal-body p {
    margin-top: 10px;
}

.composer-modal-body ul {
    margin-top: 0;
    padding-left: 20px;
    list-style: disc;
    max-height: 300px;
    overflow-y: auto;
}

.composer-modal-body li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    word-break: break-word;
}

.composer-info-trigger {
    cursor: pointer;
}

.composer-info-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
}

.composer-work-item {
    cursor: pointer;
    transition: background 0.2s;
    padding: 5px;
    margin: 0 -5px;
    border-radius: 4px;
}

.composer-work-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.composer-photo {
    text-align: center;
    margin-bottom: 15px;
}

.composer-photo-img {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
    object-fit: contain;
    border: 2px solid var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.composer-modal-body h3 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 15px;
}

/* ========== КАСТОМНЫЙ ТУЛТИП ========== */
.composer-info-trigger {
    position: relative;
}

.composer-info-trigger:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 1px;
    padding: 6px 12px;
    background: #333;
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    animation: tooltipFadeIn 0.15s ease-in-out 0.2s forwards;
}

.composer-info-trigger:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 0px;
    border-width: 6px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    animation: tooltipFadeIn 0.15s ease-in-out 0.2s forwards;
}

@keyframes tooltipFadeIn {
    to { opacity: 1; }
}

/* ========== АДАПТИВНЫЕ СТИЛИ ========== */
/* Планшеты и мобильные устройства */
@media (max-width: 1200px) {
    .wikiscore-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .wikiscore-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-row {
        flex-direction: column;
        align-items: stretch;
    }
    .wikiscore-page-title {
        text-align: center;
    }
    .wikiscore-controls {
        justify-content: center;
        flex-direction: column;
        align-items: stretch;
    }
    .wikiscore-search {
        width: 100%;
        order: 1;
    }
    .wikiscore-search input {
        flex: 1;
    }
    .wikiscore-sorting-dropdown {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        order: 2;
        margin: 0;
    }
    .wikiscore-sorting-dropdown select {
        flex: 1;
        margin-right: 10px;
        width: auto;
    }
    .sort-arrow {
        padding-left: 0;
    }
}

@media (max-width: 600px) {
    .wikiscore-grid {
        grid-template-columns: 1fr;
    }
    .wikiscore-item {
        width: 100%;
        max-width: 260px;
        margin: 0 auto;
    }
    .pagination-links {
        justify-content: center;
    }
}