/* ==========================================================================
   Стили для страницы автора (author.css)
   ========================================================================== */

/* --- CSS Variables for Dark Theme --- */
:root {
    --background-color: #111827; /* Dark blue background start */
    --text-color: #f8f8f8;      /* Light text */
    --text-strong: #ffffff;     /* Stronger white for headings */
    --text-light: #b0b0b0;      /* Slightly dimmer light text */
    --accent-color: #a991d4;    /* Lavender accent, from style.css author-mode-active */
    --background-alt: #1d2a4a;  /* Dark blue background end */
    --border-color: rgba(169, 145, 212, 0.3); /* Border for dark theme */
    --shadow-light: 0 8px 25px rgba(0, 0, 0, 0.3); /* Darker shadows */
    --shadow-card: 0 4px 15px rgba(0, 0, 0, 0.2);
}

html {
    /* Задаем базовый темный фон для всего документа, чтобы избежать белой полосы на iOS */
    background-color: var(--background-color);
}

/* --- Общие стили страницы --- */
.author-page-active {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

/* --- Контейнер страницы --- */
.author-page-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 9rem 1.5rem 6rem; /* Увеличиваем отступ сверху, чтобы было больше "воздуха" */
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Защита контента --- */
.protection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5; /* Выше изображения, но ниже кнопок */
    background: transparent; /* Невидимый слой */
    pointer-events: none; /* Игнорируем клики мыши, чтобы они проходили "сквозь" слой */
}

/* --- Стили для печати (скрываем контент) --- */
@media print {
    body * {
        visibility: hidden;
    }
    /* Можно добавить сообщение для печати, если нужно */
}

/* Запрет выделения и перетаскивания */
img { -webkit-user-drag: none; user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; }

/* --- Спиннер загрузки --- */
.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border-left-color: var(--accent-color, #007bff);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Шапка автора --- */
.author-header {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2.5rem; /* Уменьшаем отступ */
}

.author-photo-container {
    flex-shrink: 0;
    /* ИЗМЕНЕНИЕ: Уменьшаем размер фото на десктопе для лучшего баланса */
    width: 220px;
    height: 220px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: var(--shadow-light);
    border: 5px solid var(--background-alt);
    position: relative;
}

.author-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.author-photo-container:hover .author-photo {
    transform: scale(1.05);
}

.author-info {
    flex-grow: 1;
    padding-top: 1rem;
}

.author-name {
    font-family: 'Playfair Display', serif;
    /* ИЗМЕНЕНИЕ: Немного уменьшаем размер для лучшего баланса */
    font-size: 2.6rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: var(--text-strong);
}

.author-bio {
    font-size: 1rem;
    color: var(--text-light);
    max-width: 75ch; /* Slightly wider for better readability on dark theme */
}

/* --- Статистика автора --- */
.author-stats-container {
    display: grid;
    /* ИЗМЕНЕНИЕ: Уменьшаем минимальную ширину карточек для лучшей адаптивности */
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3.5rem;
}

.author-stat-card {
    background-color: var(--background-alt);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.author-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.stat-card-value {
    font-size: 2.5rem;
    font-weight: 600;
    font-family: 'Playfair Display', serif;
    color: var(--accent-color);
}

.stat-card-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 1rem; /* Add space above the label */
    text-align: center; /* Center the label text */
}

.stat-painting-card {
    flex-direction: column; /* Stack body and label vertically */
    align-items: center;
    cursor: pointer;
    display: flex;
    justify-content: center;
}

.stat-painting-body {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1.5rem; /* Increase gap between image and info */
    width: 100%;
}

.stat-painting-thumb {
    /* ИЗМЕНЕНИЕ: Уменьшаем размер превью для компактности */
    width: 100px;
    height: 80px;
    object-fit: contain; /* Сохраняем пропорции, вписывая в контейнер */
    border-radius: 8px;
    flex-shrink: 0;
    background-color: #000; /* Черный фон для режима contain */
}

.stat-painting-info {
    flex-grow: 1; /* Allow info to take remaining space */
    text-align: left;
    min-width: 0; /* Позволяет flex-элементу сжиматься меньше его содержимого */
}

.stat-painting-title {
    font-weight: 500;
    color: var(--text-strong);
    margin-bottom: 0.25rem;
    white-space: nowrap; /* Запрещаем перенос текста */
    overflow: hidden; /* Скрываем то, что не помещается */
    text-overflow: ellipsis; /* Добавляем многоточие */
}

.stat-painting-count {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.stat-painting-count svg {
    color: var(--accent-color);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* --- Секция с работами автора --- */
.author-works-section {
    margin-top: 3rem;
}

.author-works-title {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 2rem;
    text-align: left; /* Align left for better flow */
    color: var(--text-strong);
}

.author-works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.author-painting-item {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    background: transparent; /* Фон карточки прозрачный */
    border: none;
    box-shadow: var(--shadow-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.author-painting-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.author-painting-image-wrapper {
    width: 100%;
    height: 250px; /* Or adjust as needed */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.15); /* Полупрозрачный фон для обертки изображения */
}

.author-painting-item .gallery-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.author-painting-info {
    padding: 1rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

.no-works-message {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
    background: var(--background-alt);
    border-radius: 12px;
}

/* --- Секция с пролистываемыми фото автора --- */
.author-photo-slider-section {
    margin-top: 3rem;
    margin-bottom: 3rem;
    /* Добавляем боковые отступы здесь, чтобы ограничить ширину слайдера */
    padding: 1.5rem 1rem;
    background: var(--background-alt);
    border-radius: 12px;
    box-shadow: var(--shadow-light);
    overflow: hidden; /* Возвращаем, чтобы скруглённые углы слайдов не вылезали */
}

.author-photo-slider-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-strong);
}

.swiper-container-author-photos {
    width: 100%;
    height: auto;
    /* Возвращаем overflow: hidden, чтобы скрыть лишние слайды */
    overflow: hidden;
    position: relative;
    /* Добавляем отступ сверху для "воздуха" между заголовком и слайдером */
    margin-top: 1rem;
    padding: 0; /* Убираем отступы, чтобы Swiper сам рассчитывал ширину */
}

.swiper-slide-author-photo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    /* Убираем margin, так как отступы теперь управляются через Swiper.js (spaceBetween) */
    margin: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.swiper-slide-author-photo:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.swiper-slide-author-photo img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 8px;
}

.swiper-slide-author-photo .slide-description {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--text-light);
    text-align: center;
    width: 100%;
    background: var(--background-alt);
    border-radius: 0 0 8px 8px;
}

.swiper-button-prev-author-photos,
.swiper-button-next-author-photos {
    color: var(--accent-color);
    background: rgba(26, 26, 26, 0.6);
    border-radius: 50%;
    width: 44px !important; /* Используем !important для переопределения стилей Swiper */
    height: 44px !important; /* Используем !important для переопределения стилей Swiper */
    transition: all 0.3s ease;
    position: absolute;
    top: 50%;
    transform: translateY(-calc(50% + 1rem)); /* 1rem - примерная половина высоты текста */
    z-index: 10;
}

.swiper-button-prev-author-photos:hover,
.swiper-button-next-author-photos:hover {
    background: var(--accent-color);
    color: var(--text-strong);
}

/* Позиционируем кнопки внутри контейнера с отступами */
.swiper-button-prev-author-photos { left: 1rem; }
.swiper-button-next-author-photos { right: 1rem; }

@media (max-width: 768px) {
    .author-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .author-photo-container {
        width: 200px;
        height: 200px;
    }

    .author-name {
        font-size: 2.0rem; /* Уменьшаем шрифт заголовка */
    }

    .author-bio {
        font-size: 0.9rem; /* Уменьшаем шрифт биографии */
    }
}

@media (max-width: 480px) {
    .author-page-container {
        /* ИЗМЕНЕНИЕ: Уменьшаем отступы для мобильных */
        padding: 7rem 1rem 4rem;
    }

    .author-photo-container {
        width: 150px;
        height: 150px;
    }
    
    /* ИЗМЕНЕНИЕ: Уменьшаем размер заголовка и центрируем */
    .author-name {
        font-size: 1.8rem; /* Уменьшаем шрифт заголовка */
        text-align: center;
    }

    /* ИЗМЕНЕНИЕ: Центрируем биографию */
    .author-bio {
        text-align: center;
    }

    /* ИЗМЕНЕНИЕ: Делаем карточки статистики на всю ширину */
    .author-stats-container {
        grid-template-columns: 1fr;
    }

    .author-works-grid {
        grid-template-columns: repeat(2, 1fr); /* ИЗМЕНЕНИЕ: Две колонки на мобильных */
        gap: 1rem;
    }

    .author-works-title {
        font-size: 1.6rem; /* Уменьшаем шрифт заголовка секции */
    }

    .stat-card-value {
        font-size: 2.2rem; /* Уменьшаем шрифт цифр в статистике */
    }

    .stat-painting-title {
        font-size: 0.9rem; /* Уменьшаем шрифт названий картин в статистике */
    }

    .stat-painting-count {
        font-size: 0.8rem; /* Уменьшаем шрифт счетчиков в статистике */
    }

    .author-photo-slider-section {
        padding: 1.5rem 0;
    }

    .author-photo-slider-title {
        font-size: 1.4rem; /* Уменьшаем шрифт заголовка слайдера */
    }

    .swiper-slide-author-photo img {
        height: 200px;
    }

    .swiper-button-prev-author-photos,
    .swiper-button-next-author-photos {
        width: 36px !important;
        height: 36px !important;
        transform: translateY(-calc(50% + 0.8rem));
    }
    
    /* На мобильных кнопки всегда внутри */
    .swiper-button-prev-author-photos { left: 0.5rem; }
    .swiper-button-next-author-photos { right: 0.5rem; }
}


/* ==========================================================================
   Перенесенные стили из style.css для модального окна и кнопки "Назад"
   ========================================================================== */

/* --- Кнопка "Назад в галерею" --- */
.back-to-gallery-button {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--background-alt);
    backdrop-filter: blur(15px);
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-light);
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.back-to-gallery-button:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--text-strong);
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .back-to-gallery-button {
        /* ИЗМЕНЕНИЕ: Позиционируем кнопку внутри панели навигации */
        top: calc(0.75rem + env(safe-area-inset-top));
        left: 1rem;
        padding: 0.5rem;
        width: 44px;
        height: 44px;
        justify-content: center;
        background: transparent; /* Убираем фон, так как он есть у панели */
    }
    .back-to-gallery-button span {
        display: none; /* Скрываем текст на мобильных, оставляем иконку */
    }
}

/* --- Модальное окно --- */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none; /* Управляется JS */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.image-modal.active {
    display: flex;
    opacity: 1;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    width: 90vw;
    height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalSlideIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-image-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.modal-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.modal-close {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--background-alt);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-close:hover {
    background: var(--accent-color, #007bff);
    color: var(--text-strong);
    transform: rotate(90deg) scale(1.1);
    border-color: var(--accent-color, #007bff);
}

/* --- Внешние кнопки навигации --- */
.modal-nav-external {
    position: fixed;
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    width: 60px; /* Увеличиваем размер для соответствия */
    height: 60px;
    background: rgba(15, 15, 15, 0.5);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    cursor: pointer;
    z-index: 100; /* Уменьшаем z-index, т.к. они не в модальном окне */
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-nav-external:hover {
    background: rgba(169, 145, 212, 0.15); /* Используем цвет из style.css */
    border-color: var(--accent-color); /* Используем переменную accent-color */
    transform: translateY(-50%) scale(1);
}

.modal-nav-external.prev { left: 2vw; }
.modal-nav-external.next { right: 2vw; }

/* Используем SVG для стрелок, как в style.css */
.modal-nav-external::before {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.7)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'%3E%3C/polyline%3E%3C/svg%3E");
    transform: scale(0.6);
    opacity: 1;
    transition: all 0.3s ease;
}

.modal-nav-external:hover::before {
    transform: scale(0.7);
}

.modal-nav-external.next::before {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.7)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E");
}

@media (max-width: 768px) {
    .modal-nav-external {
        width: 44px;
        height: 44px;
        background: rgba(0, 0, 0, 0.7);
    }
    .modal-nav-external.prev { left: 1rem; }
    .modal-nav-external.next { right: 1rem; }

    .modal-close {
        top: 0;
        right: 0;
    }
}

/* --- НОВАЯ ВЕРХНЯЯ НАВИГАЦИЯ ПО АВТОРАМ (ЛЕНТА) --- */
.author-nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 90;
    /* ИЗМЕНЕНИЕ: Используем переменную цвета фона с прозрачностью */
    background: linear-gradient(to bottom, var(--background-color) 70%, transparent 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1rem 0;
    padding-top: calc(1rem + env(safe-area-inset-top)); /* Учет "челки" на iPhone */
    display: none; /* Скрываем, пока JS не заполнит */
}

.author-nav-scroll-container {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    /* Отступ слева будет равен ширине кнопки "назад" + отступы */
    padding: 0.5rem 2rem 0.5rem calc(2rem + 160px); /* Добавляем отступы сверху/снизу и увеличиваем левый */
    -webkit-overflow-scrolling: touch; /* Плавный скролл на iOS */
    scrollbar-width: none; /* Firefox */
}

.author-nav-scroll-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

.author-nav-item {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    width: 64px;
}

.author-nav-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.author-nav-item.active .author-nav-avatar {
    border-color: var(--accent-color);
    transform: scale(1.1);
}

.author-nav-item:hover .author-nav-avatar {
    transform: scale(1.1);
}

.author-nav-name {
    font-size: 0.75rem;
    color: var(--text-light);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    transition: color 0.3s ease;
}

.author-nav-item.active .author-nav-name {
    color: var(--text-strong);
    font-weight: 500;
}

@media (max-width: 768px) {
    /* Сдвигаем основной контент вниз, чтобы он не перекрывался панелью */
    .author-page-container {
        padding-top: 9rem; /* Увеличиваем отступ и на мобильных */
    }    
    /* ИЗМЕНЕНИЕ: Улучшаем позиционирование навбара и кнопки "назад" */
    .author-nav-bar {
        padding: 0.75rem 0;
        padding-top: calc(0.75rem + env(safe-area-inset-top));
        /* Добавляем немного места слева для кнопки "назад" */
        padding-left: 70px; 
    }
    .author-nav-scroll-container {
        /* Убираем левый паддинг, так как он теперь на родительской панели */
        padding: 0.5rem 1rem;
    }
}


/* ==========================================================================
   Стили для страницы владельца (kolesnik)
   ========================================================================== */

.owner-page {
    /* Новый темно-зеленый фон */
    --background-color: #122015;
    /* Более светлый зеленый для карточек */
    --background-alt: #2f4f34;
    /* Новый мятный акцентный цвет */
    --accent-color: #d4af37; /* Золотой акцент */
    /* Цвет для границ, сочетающийся с акцентом */
    --border-color: rgba(212, 175, 55, 0.3);
    /* Тень делаем чуть более зеленоватой */
    --shadow-light: 0 8px 25px rgba(23, 39, 26, 0.4);
    --shadow-card: 0 4px 15px rgba(23, 39, 26, 0.3);
}

/* Убираем лишний отступ на странице владельца, где нет блока статистики автора */
.owner-page .author-header {
    margin-bottom: 0;
    padding-bottom: 2rem; /* Можно немного уменьшить и этот отступ */
}

/* Убираем лишний отступ внизу основного контейнера на странице владельца */
.owner-page .author-page-container {
    padding-bottom: 0;
}

/* ==========================================================================
   Стили для блока статистики всей галереи
   ========================================================================== */

#galleryStatsContainer {
    display: none; /* Скрываем по умолчанию */
    max-width: 1100px; /* Уменьшаем верхний отступ */
    margin: 4rem auto 2rem;
    padding: 2.5rem;
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-light);
}

.gallery-stats-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--accent-color);
}

.gallery-stats-summary {
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* Разрешаем перенос на мобильных */
    gap: 3rem;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.summary-item {
    text-align: center;
}

.summary-item span {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.summary-item strong {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-strong);
}

.gallery-stats-main-chart {
    margin-bottom: 3rem;
    padding: 1.5rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}
.gallery-stats-main-chart canvas {
    max-height: 150px; /* Уменьшаем высоту основного графика */
    width: 100% !important;
    height: auto !important;
}

.recent-paintings-section {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.recent-paintings-row {
    display: flex;
    overflow-x: auto;
    justify-content: center; /* Центрируем элементы, если они не занимают всю ширину */
    gap: 1.5rem;
    padding: 1rem 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) rgba(255, 255, 255, 0.1);
}

.recent-paintings-row::-webkit-scrollbar { height: 8px; }
.recent-paintings-row::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); border-radius: 4px; }
.recent-paintings-row::-webkit-scrollbar-thumb { background-color: var(--accent-color); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }

.gallery-stats-charts-bottom {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
    margin-top: 3rem;
}

.chart-container {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 12px;
}

.stats-top-lists {
    display: flex; /* Используем flexbox для лучшей адаптивности */
    flex-wrap: wrap; /* Разрешаем перенос элементов */
    justify-content: center; /* Центрируем элементы */
    gap: 2.5rem;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}
.stats-column {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 12px;
}


.stats-column-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-strong);
}

.stats-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stats-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.stats-list-item[data-painting-id]:hover,
.stats-list-item[data-author-id]:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    cursor: pointer;
}

.stats-item-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.stats-item-thumb.author-avatar {
    border-radius: 50%;
}

.stats-item-info {
    flex-grow: 1;
    min-width: 0;
}

.stats-item-title {
    display: block;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stats-item-author {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
}

.stats-item-count {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
    color: var(--accent-color);
    flex-shrink: 0;
}

.stats-item-counts-author {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.stats-item-counts-author span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.stats-item-counts-author svg {
    color: var(--accent-color);
}

.recent-painting-item {
    flex-direction: column;
    width: 150px;
    flex-shrink: 0;
    text-align: center;
}

.recent-painting-item .stats-item-thumb {
    width: 100%;
    height: 120px;
}

/* ==========================================================================
   Стили для подписи (футера)
   ========================================================================== */

.site-footer { /* Изменено для нового вида */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 1rem 1rem 3rem;
    opacity: 0;
    animation: fadeIn 1s ease-out 0.5s forwards;
}

.site-credit { /* Новый класс для текста и ссылки */
    font-family: 'Playfair Display', serif;
    font-size: 0.9rem;
    color: var(--text-light);
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.site-credit:hover {
    opacity: 1;
}

.site-credit a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.site-credit a:hover {
    border-bottom-color: var(--accent-color);
}

/* Адаптация для мобильных устройств */
@media (max-width: 768px) {
    #galleryStatsContainer {
        padding: 1.5rem; /* Уменьшаем padding на мобильных */
        margin: 2rem auto; /* Уменьшаем отступы */
    }

    .gallery-stats-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    .gallery-stats-summary {
        /* Возвращаем flex-wrap для лучшего отображения на планшетах */
        gap: 2rem;
        margin-bottom: 2rem;
    }

    .summary-item strong {
        font-size: 1.8rem;
    }

    .gallery-stats-main-chart {
        padding: 1rem;
        margin-bottom: 2rem;
    }

    .stats-top-lists,
    .gallery-stats-charts-bottom {
        flex-direction: column; /* Элементы в столбец */
        gap: 1.5rem;
    }
    .stats-column, .chart-container {
        padding: 1rem;
    }
}
