/* ============================================================
   CUSTOM STYLES - ДЛЯ ПЕРЕОПРЕДЕЛЕНИЯ СТИЛЕЙ NEXT.JS
   ============================================================ */

/* ============================================================
   1. ОБЩИЕ СТИЛИ
   ============================================================ */

/* Переопределение базовых стилей */
body {
    background: #FFFDF8;
    font-family: system-ui, -apple-system, sans-serif;
}

/* Анимации */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeUp 0.8s ease forwards;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-left {
    opacity: 0;
    transform: translateX(-30px);
    animation: fadeLeft 0.8s ease forwards;
}

@keyframes fadeLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-right {
    opacity: 0;
    transform: translateX(40px) scale(0.97);
    animation: fadeRight 0.8s ease forwards;
}

@keyframes fadeRight {
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.scale-in {
    opacity: 0;
    transform: scale(0.98);
    animation: scaleIn 0.8s ease forwards;
}

@keyframes scaleIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================================
   2. HEADER - ЭФФЕКТ ПРИ СКРОЛЛЕ
   ============================================================ */

header {
    background: #FFFDF8;
    transition: background 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease;
}

header.scrolled {
    background: rgba(255, 253, 248, 0.92) !important;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   3. СЕРВИСЫ - КАРТОЧКИ
   ============================================================ */

.service-card {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeUp 0.6s ease forwards;
}

.service-card:nth-child(1) {
    animation-delay: 0.05s;
}

.service-card:nth-child(2) {
    animation-delay: 0.10s;
}

.service-card:nth-child(3) {
    animation-delay: 0.15s;
}

.service-card:nth-child(4) {
    animation-delay: 0.20s;
}

.service-card:nth-child(5) {
    animation-delay: 0.25s;
}

.service-card:nth-child(6) {
    animation-delay: 0.30s;
}

/* Обложка карточки */
.service-cover-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #E8DED4;
}

.service-cover-wrapper .service-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transition: transform 0.7s ease;
}

.service-card:hover .service-cover-wrapper .service-cover {
    transform: scale(1.05);
}

/* Миниатюры в карточках */
.thumbnail {
    position: relative;
    aspect-ratio: 1/1;
    overflow: hidden;
    border-radius: 0.75rem;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.thumbnail .thumbnail-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.thumbnail.active {
    border-color: transparent !important;
    opacity: 1;
    box-shadow: none !important;
}

.thumbnail.active .thumbnail-img {
    outline: 2px solid #7E3D46;
    outline-offset: 2px;
}

.thumbnail:not(.active) {
    border-color: transparent;
    opacity: 0.65;
}

.thumbnail:not(.active):hover {
    opacity: 1;
}

/* ============================================================
   4. МОДАЛЬНОЕ ОКНО
   ============================================================ */

#serviceModal {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#serviceModal:not(.hidden) {
    display: flex !important;
    opacity: 1;
}

.modal-content {
    transform: scale(0.95);
    transition: transform 0.25s ease;
    max-width: 1200px;
    width: 100%;
    height: 90vh;
    max-height: 90vh;
}

#serviceModal:not(.hidden) .modal-content {
    transform: scale(1);
}

/* Стрелки навигации в модалке */
#modalPrev,
#modalNext {
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease, transform 0.3s ease;
    z-index: 20;
    padding: 12px;
    border-radius: 50%;
    background: rgba(52, 52, 52, 0.4);
    color: white;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
    border: none;
    outline: none;
}

#serviceModal:not(.hidden) #modalPrev,
#serviceModal:not(.hidden) #modalNext {
    opacity: 1;
}

#modalPrev:hover,
#modalNext:hover {
    background: rgba(52, 52, 52, 0.6);
    transform: translateY(-50%) scale(1.1);
}

#modalPrev {
    left: 20px;
    top: 60%;
    transform: translateY(-50%);
}

#modalNext {
    right: 20px;
    top: 60%;
    transform: translateY(-50%);
}

/* Точки навигации */
.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 253, 248, 0.5);
    transition: all 0.2s ease;
    cursor: pointer;
}

.dot.active {
    width: 32px;
    background: #FFFDF8;
}

/* Модальное изображение */
#modalMainImage {
    position: relative;
    background: #E8DED4;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4/3;
    min-height: 400px;
    overflow: hidden;
    flex-shrink: 0;
}

#modalMainImage img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Модальные миниатюры */
#modalThumbnails {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    flex: 1;
    align-content: start;
}

#modalThumbnails .modal-thumb {
    position: relative;
    aspect-ratio: 1/1;
    overflow: hidden;
    border-radius: 0.75rem;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.modal-thumb.border-\[\#7E3D46\] {
    border-color: transparent !important;
}

.modal-thumb.border-\[\#7E3D46\] .modal-thumb-img {
    outline: 2px solid #7E3D46;
    outline-offset: 2px;
}

#modalThumbnails .modal-thumb .modal-thumb-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

/* ============================================================
   5. WORKSHOPS - МАСТЕР-КЛАССЫ
   ============================================================ */

/* Иконки мастер-классов */
.workshop-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: #7E3D46;
    color: #FFFDF8;
    transition: transform 0.3s ease;
}

.group:hover .workshop-icon {
    transform: scale(1.1);
}

/* ============================================================
   6. ГАЛЕРЕЯ МАСТЕР-КЛАССОВ
   ============================================================ */

/* Точки для галереи мастер-классов */
.workshop-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    outline: none;
}

.workshop-dot.active {
    width: 32px;
    background: #FFFDF8;
}

/* Модальное окно для галереи мастер-классов */
#workshopGalleryModal .modal-content {
    transform: scale(0.95);
    transition: transform 0.25s ease;
}

#workshopGalleryModal:not(.hidden) .modal-content {
    transform: scale(1);
}

/* Миниатюры для мастер-классов */
#modalThumbnailsMobile .modal-thumb-mobile {
    position: relative;
    aspect-ratio: 1/1 !important;
    overflow: hidden;
    border-radius: 0.5rem;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #E8DED4;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    flex-shrink: 0;
}

#modalThumbnailsMobile .modal-thumb-mobile.active {
    border-color: #FFFDF8;
    box-shadow: 0 0 15px rgba(255, 253, 248, 0.4);
    transform: scale(1.03);
}

#modalThumbnailsMobile .modal-thumb-mobile .thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
    transition: background 0.3s ease;
    pointer-events: none;
}

#modalThumbnailsMobile .modal-thumb-mobile.active .thumb-overlay {
    background: rgba(0, 0, 0, 0.2);
}

/* ============================================================
   7. АДАПТИВНОСТЬ - МОБИЛЬНАЯ ВЕРСИЯ
   ============================================================ */

@media (max-width: 768px) {

    /* Модальное окно на мобильных */
    #serviceModal .modal-content {
        max-height: 80vh;
        max-width: 95vw;
        border-radius: 1.5rem;
        height: 80vh;
    }

    #modalMainImage {
        min-height: 200px;
        aspect-ratio: 4/3;
    }

    #modalPrev,
    #modalNext {
        padding: 8px;
        width: 40px;
        height: 40px;
    }

    #modalPrev svg,
    #modalNext svg {
        width: 20px;
        height: 20px;
    }

    #modalPrev {
        left: 8px;
        top: 55%;
    }

    #modalNext {
        right: 8px;
        top: 55%;
    }

    /* Иконки в workshops */
    .workshop-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .workshop-icon svg {
        width: 20px;
        height: 20px;
    }

    /* Мобильная версия модалки для мастер-классов */
    #workshopGalleryModal .modal-content {
        height: 95vh;
        max-height: 95vh;
        border-radius: 0;
        max-width: 100vw;
        width: 100%;
        overflow: hidden;
        background: #FAF7F2 !important;
    }

    #workshopGalleryModal #modalMainImage {
        width: 100% !important;
        height: 100% !important;
        min-height: auto;
        aspect-ratio: auto;
        border-radius: 0 !important;
        flex: 1;
        background: #E8DED4;
        align-items: flex-start !important;
        justify-content: center;
        padding-top: 0;
    }

    #workshopGalleryModal #modalMainImage img {
        max-height: 100%;
        width: 100%;
        height: auto;
        object-fit: contain;
        object-position: top center;
    }

    #workshopGalleryModal #modalTitleMobile {
        font-size: 1.75rem !important;
        font-weight: 700 !important;
        bottom: auto !important;
        top: 16px !important;
        left: 16px !important;
        right: 16px !important;
        text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
        z-index: 15;
        color: #fff;
        background: linear-gradient(to right, rgba(0, 0, 0, 0.4), transparent);
        padding: 12px 16px;
        border-radius: 0.75rem;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        display: inline-block;
        max-width: 80%;
    }

    #modalThumbnailsMobile {
        position: absolute;
        bottom: 12px !important;
        left: 12px !important;
        right: 12px !important;
        padding: 0;
        z-index: 20;
        background: linear-gradient(to top, rgba(250, 247, 242, 1) 60%, rgba(250, 247, 242, 0) 100%);
        border-radius: 0 0 1.5rem 1.5rem;
    }

    #modalThumbnailsMobileGrid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
        width: 100%;
    }

    #modalThumbnailsMobile .modal-thumb-mobile {
        aspect-ratio: 1/1 !important;
        border-radius: 0.5rem;
    }

    #modalThumbnailsMobile .service-details-btn {
        margin-top: 10px;
        font-size: 0.9rem;
        padding: 10px 16px;
        border-radius: 0.75rem;
        background: rgba(126, 61, 70, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        transition: all 0.3s ease;
        color: white !important;
        font-weight: 600;
        letter-spacing: 0.3px;
        width: 100%;
        justify-content: center;
    }

    #modalThumbnailsMobile .service-details-btn:hover {
        background: rgba(126, 61, 70, 1);
        transform: translateY(-1px);
    }

    #workshopGalleryModal #modalPrev,
    #workshopGalleryModal #modalNext {
        padding: 10px;
        width: 44px;
        height: 44px;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    #workshopGalleryModal #modalPrev svg,
    #workshopGalleryModal #modalNext svg {
        width: 22px;
        height: 22px;
    }

    #workshopGalleryModal #modalPrev {
        left: 12px;
    }

    #workshopGalleryModal #modalNext {
        right: 12px;
    }

    #workshopGalleryModal #modalDots {
        display: none;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    #modalThumbnailsMobile {
        bottom: 8px !important;
        left: 8px !important;
        right: 8px !important;
    }

    #modalThumbnailsMobileGrid {
        gap: 5px !important;
    }

    #modalThumbnailsMobile .modal-thumb-mobile {
        border-radius: 0.375rem;
        border-width: 2px;
    }

    #workshopGalleryModal #modalTitleMobile {
        font-size: 1.4rem !important;
        top: 12px !important;
        left: 12px !important;
        right: 12px !important;
        padding: 8px 12px;
        max-width: 85%;
    }

    #workshopGalleryModal #modalPrev,
    #workshopGalleryModal #modalNext {
        padding: 8px;
        width: 36px;
        height: 36px;
    }

    #workshopGalleryModal #modalPrev svg,
    #workshopGalleryModal #modalNext svg {
        width: 18px;
        height: 18px;
    }

    #workshopGalleryModal #modalPrev {
        left: 8px;
    }

    #workshopGalleryModal #modalNext {
        right: 8px;
    }

    #modalThumbnailsMobile .service-details-btn {
        font-size: 0.8rem;
        padding: 8px 12px;
        margin-top: 8px;
        border-radius: 0.5rem;
    }
}

/* Для больших мобильных экранов */
@media (min-width: 481px) and (max-width: 768px) {
    #modalThumbnailsMobileGrid {
        gap: 10px !important;
    }

    #modalThumbnailsMobile {
        bottom: 16px !important;
        left: 16px !important;
        right: 16px !important;
    }

    #modalThumbnailsMobile .modal-thumb-mobile {
        border-radius: 0.625rem;
    }

    #workshopGalleryModal #modalTitleMobile {
        font-size: 2rem !important;
        top: 20px !important;
        left: 20px !important;
        right: 20px !important;
        padding: 14px 20px;
    }

    #modalThumbnailsMobile .service-details-btn {
        font-size: 1rem;
        padding: 12px 20px;
        margin-top: 12px;
    }
}

/* Для экранов с высотой меньше 700px */
@media (max-height: 700px) {
    #workshopGalleryModal .modal-content {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0 !important;
    }

    #workshopGalleryModal #modalTitleMobile {
        font-size: 1.2rem !important;
        top: 8px !important;
        left: 10px !important;
        right: 10px !important;
        padding: 6px 10px;
        max-width: 90%;
    }

    #modalThumbnailsMobile {
        bottom: 6px !important;
        left: 8px !important;
        right: 8px !important;
    }

    #modalThumbnailsMobileGrid {
        gap: 4px !important;
    }

    #modalThumbnailsMobile .modal-thumb-mobile {
        border-radius: 0.25rem;
        border-width: 1.5px;
    }

    #modalThumbnailsMobile .service-details-btn {
        font-size: 0.7rem;
        padding: 5px 10px;
        margin-top: 5px;
        border-radius: 0.375rem;
    }

    #workshopGalleryModal #modalPrev,
    #workshopGalleryModal #modalNext {
        padding: 6px;
        width: 30px;
        height: 30px;
    }

    #workshopGalleryModal #modalPrev svg,
    #workshopGalleryModal #modalNext svg {
        width: 14px;
        height: 14px;
    }

    #workshopGalleryModal #modalPrev {
        left: 6px;
    }

    #workshopGalleryModal #modalNext {
        right: 6px;
    }
}

/* ============================================================
   8. ГАЛЕРЕЯ (ОСНОВНАЯ) - ДОПОЛНИТЕЛЬНЫЕ СТИЛИ
   ============================================================ */

/* Точки для основной галереи */
.main-gallery-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    outline: none;
}

.main-gallery-dot.active {
    background: #FFFFFF;
    border-color: #FFFFFF;
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.main-gallery-dot:hover {
    background: rgba(255, 255, 255, 0.6);
}

/* Модальное окно основной галереи */
#mainGalleryModal .modal-content {
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

#mainGalleryModal:not(.hidden) .modal-content {
    transform: scale(1);
}

/* Адаптив для основной галереи */
@media (max-width: 768px) {
    .main-gallery-dot {
        width: 8px;
        height: 8px;
    }

    #mainGalleryPrev,
    #mainGalleryNext {
        padding: 10px;
    }

    #mainGalleryPrev svg,
    #mainGalleryNext svg {
        width: 24px;
        height: 24px;
    }

    #mainGalleryPrev {
        left: 8px;
    }

    #mainGalleryNext {
        right: 8px;
    }

    #closeMainGallery {
        padding: 10px;
        top: 12px;
        right: 12px;
    }

    #closeMainGallery svg {
        width: 22px;
        height: 22px;
    }

    .main-gallery-dot {
        width: 8px;
        height: 8px;
    }

    #mainGalleryTitle {
        font-size: 1.25rem !important;
    }

    #mainGalleryCategory {
        font-size: 0.75rem !important;
    }
}

@media (max-width: 480px) {
    .main-gallery-dot {
        width: 6px;
        height: 6px;
    }

    #mainGalleryTitle {
        font-size: 1rem !important;
    }

    #mainGalleryCategory {
        font-size: 0.65rem !important;
    }
}

/* ============================================================
   9. СКРОЛЛ В МОДАЛКЕ
   ============================================================ */

#modalInfo::-webkit-scrollbar {
    width: 4px;
}

#modalInfo::-webkit-scrollbar-track {
    background: transparent;
}

#modalInfo::-webkit-scrollbar-thumb {
    background: #B08B57;
    border-radius: 4px;
}

/* ============================================================
   10. УТИЛИТЫ
   ============================================================ */

.text-shadow-lg {
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}