/* ===================================
   СБРОС И БАЗОВЫЕ СТИЛИ
   =================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Убираем подсветку при тапе на мобильных */
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    /* Предотвращаем зум при повороте на iOS */
    text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background: #000;
    color: #fff;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Улучшаем скролл на iOS */
    -webkit-overflow-scrolling: touch;
    /* Фикс высоты для мобильных браузеров */
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* Поддержка safe area для iPhone X+ */
@supports (padding: max(0px)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

img {
    display: block;
    max-width: 100%;
    height: auto;
    border: 0;
    /* Предотвращаем сохранение изображений длинным тапом */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ===================================
   ОСНОВНАЯ СТРУКТУРА
   =================================== */
.page {
    max-width: 100vw;
    min-width: 320px;
    margin: 0 auto;
    position: relative;
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* Контейнер для создания высоты скролла */
.scroll-container {
    height: 400vh;
    position: relative;
    z-index: -10;
    pointer-events: none;
    /* Оптимизация для мобильных */
    will-change: auto;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* ===================================
   КОНТЕЙНЕР ФОНОВЫХ ИЗОБРАЖЕНИЙ
   =================================== */
.backgrounds-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh; /* Новая единица для динамической высоты */
    overflow: hidden;
    z-index: -1;
    will-change: contents;
    /* Оптимизация для мобильных GPU */
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
}

/* ===================================
   СЛОИ ФОНОВЫХ ИЗОБРАЖЕНИЙ
   =================================== */
.background-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    z-index: 1;
    will-change: opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Оптимизация для мобильных */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Адаптивные изображения */
.responsive-image {
    display: block;
    position: relative;
    width: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    overflow: hidden;
}

.responsive-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.5s ease-out;
    transform-origin: center center;
    transform: scale(1.1);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* ===================================
   ОВЕРЛЕЙ ЭЛЕМЕНТЫ (TANYA)
   =================================== */
.overlay-element {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    pointer-events: none;
}

.tanya-bg {
    width: 100%;
    height: 100%;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 478px;
    opacity: 0.4;
    transition: transform 0.5s ease-out, opacity 2s ease-in-out;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Фикс background-attachment: fixed для iOS */
@supports (-webkit-touch-callout: none) {
    .tanya-bg {
        background-attachment: scroll;
    }
}

/* Позиционирование для разных секций */
.background-layer[data-bg="gallery"] .tanya-bg {
    background-position: 70% center;
}

/* ===================================
   ФОНОВЫЕ ИЗОБРАЖЕНИЯ TANYA
   =================================== */

/* Main секция */
.background-layer[data-bg="main"] .tanya-bg {
    background-image: url(../images/design/tanya/tanya.webp);
}

/* Gallery секция */
.background-layer[data-bg="gallery"] .tanya-bg {
    background-image: url(../images/design/tatyana/tatyana.webp);
}

/* Page секция */
.background-layer[data-bg="page"] .tanya-bg {
    background-image: url(../images/design/tanychka/tanychka.webp);
}

/* Fallback для браузеров без WebP */
.no-webp .background-layer[data-bg="main"] .tanya-bg {
    background-image: url(../images/design/tanya/tanya.png);
}

.no-webp .background-layer[data-bg="gallery"] .tanya-bg {
    background-image: url(../images/design/tatyana/tatyana.png);
}

.no-webp .background-layer[data-bg="page"] .tanya-bg {
    background-image: url(../images/design/tanychka/tanychka.png);
}

/* ===================================
   RETINA ПОДДЕРЖКА
   =================================== */
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
       only screen and (min-resolution: 144dpi),
       only screen and (min-resolution: 1.5dppx) {
    
    .background-layer[data-bg="main"] .tanya-bg {
        background-image: url(../images/design/tanya/tanya@2.webp);
    }
    
    .background-layer[data-bg="gallery"] .tanya-bg {
        background-image: url(../images/design/tatyana/tatyana@2.webp);
    }
    
    .background-layer[data-bg="page"] .tanya-bg {
        background-image: url(../images/design/tanychka/tanychka@2.webp);
    }
    
    .no-webp .background-layer[data-bg="main"] .tanya-bg {
        background-image: url(../images/design/tanya/tanya@2.png);
    }
    
    .no-webp .background-layer[data-bg="gallery"] .tanya-bg {
        background-image: url(../images/design/tatyana/tatyana@2.png);
    }
    
    .no-webp .background-layer[data-bg="page"] .tanya-bg {
        background-image: url(../images/design/tanychka/tanychka@2.png);
    }
}

/* ===================================
   ИНДИКАТОР ПРОГРЕССА
   =================================== */
.scroll-indicator {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    opacity: 0;
    animation: fadeIn 1s ease-out 0.5s forwards;
    -webkit-animation: fadeIn 1s ease-out 0.5s forwards;
}

.scroll-indicator__track {
    width: 4px;
    height: 200px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.scroll-indicator__progress {
    width: 100%;
    background: linear-gradient(
        to bottom, 
        rgba(255, 255, 255, 0.9), 
        rgba(255, 255, 255, 0.6)
    );
    border-radius: 2px;
    position: absolute;
    top: 0;
    height: 0%;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.scroll-indicator__dots {
    position: absolute;
    right: 20px;
    top: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.scroll-indicator__dots .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    cursor: default;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.scroll-indicator__dots .dot.active {
    background: #fff;
    border-color: #fff;
    transform: scale(1.5);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

/* ===================================
   АНИМАЦИИ
   =================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

@-webkit-keyframes fadeIn {
    from {
        opacity: 0;
        -webkit-transform: translateY(-50%) translateX(20px);
    }
    to {
        opacity: 1;
        -webkit-transform: translateY(-50%) translateX(0);
    }
}

/* ===================================
   СОСТОЯНИЯ
   =================================== */
.js-enabled .background-layer {
    animation: none;
}

.content-loaded .background-layer {
    transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Класс для мобильных устройств */
.is-mobile-device .background-layer {
    transition: opacity 1.5s ease-in-out;
}

.is-mobile-device .responsive-image img {
    transform: scale(1.05); /* Меньше масштаб для мобильных */
}

/* ===================================
   АДАПТИВНОСТЬ - ПЛАНШЕТЫ
   =================================== */
@media screen and (max-width: 1024px) {
    .tanya-bg {
        background-size: 400px;
    }
    
    .scroll-indicator {
        right: 20px;
    }
}

@media screen and (min-width: 768px) and (max-width: 1024px) {
    /* iPad и большие планшеты */
    .responsive-image img {
        transform: scale(1.08);
    }
}

/* ===================================
   АДАПТИВНОСТЬ - МОБИЛЬНЫЕ
   =================================== */
@media screen and (max-width: 768px) {
    .tanya-bg {
        background-size: 320px;
        opacity: 0.35;
        background-attachment: scroll; /* Фикс для мобильных */
    }
    
    .background-layer {
        transition: opacity 1.5s ease-in-out;
    }
    
    .background-layer img,
    .tanya-bg {
        transition: transform 0.3s ease-out;
    }
    
    .responsive-image img {
        transform: none; /* Убираем масштабирование на мобильных */
    }
    
    .scroll-indicator {
        right: 15px;
    }
    
    .scroll-indicator__track {
        width: 3px;
        height: 150px;
    }
    
    .scroll-indicator__dots {
        right: 15px;
    }
    
    .scroll-indicator__dots .dot {
        width: 10px;
        height: 10px;
    }
}

@media screen and (max-width: 576px) {
    .tanya-bg {
        background-size: 240px;
        opacity: 0.3;
        background-position: center;
    }
    
    .background-layer[data-bg="gallery"] .tanya-bg {
        background-position: center;
    }
    
    .scroll-indicator {
        right: 10px;
    }
    
    .scroll-indicator__track {
        height: 120px;
    }
}

/* iPhone SE и маленькие Android */
@media screen and (max-width: 375px) {
    .tanya-bg {
        background-size: 200px;
        opacity: 0.25;
    }
}

@media screen and (max-width: 320px) {
    .tanya-bg {
        background-size: 180px;
        opacity: 0.25;
    }
    
    .scroll-indicator {
        right: 5px;
    }
    
    .scroll-indicator__dots .dot {
        width: 8px;
        height: 8px;
    }
}

/* ===================================
   АЛЬБОМНАЯ ОРИЕНТАЦИЯ
   =================================== */
@media screen and (orientation: landscape) {
    /* Общие стили для альбомной ориентации */
    .responsive-image img {
        object-position: center center;
    }
}

@media screen and (orientation: landscape) and (max-height: 500px) {
    .tanya-bg {
        background-size: 250px;
        opacity: 0.2;
    }
    
    .scroll-indicator {
        transform: translateY(-50%) scale(0.8);
        -webkit-transform: translateY(-50%) scale(0.8);
    }
    
    .scroll-indicator__track {
        height: 100px;
    }
}

/* Скрываем индикатор на очень маленьких экранах в альбоме */
@media screen and (orientation: landscape) and (max-height: 400px) {
    .scroll-indicator {
        display: none;
    }
}

/* ===================================
   iPhone X+ и устройства с NOTCH
   =================================== */
@supports (padding: max(0px)) {
    @media screen and (min-width: 375px) and (min-height: 812px) {
        .scroll-indicator {
            right: max(30px, env(safe-area-inset-right));
        }
        
        .scroll-indicator__track {
            height: 250px;
        }
    }
}

/* iPhone 12/13/14 Pro Max */
@media screen and (min-width: 428px) and (min-height: 926px) {
    .scroll-indicator__track {
        height: 280px;
    }
}

/* ===================================
   ANDROID СПЕЦИФИЧНЫЕ СТИЛИ
   =================================== */
/* Samsung Galaxy S20+ и подобные */
@media screen and (min-width: 384px) and (max-width: 414px) {
    .tanya-bg {
        background-size: 260px;
    }
}

/* ===================================
   ДОСТУПНОСТЬ
   =================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .background-layer {
        transition: opacity 0.5s ease-in-out !important;
    }
    
    .background-layer img,
    .tanya-bg {
        transition: none !important;
        transform: none !important;
    }
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
    .scroll-indicator__track {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* ===================================
   TOUCH УСТРОЙСТВА
   =================================== */
@media (hover: none) and (pointer: coarse) {
    /* Оптимизация для тач-устройств */
    .background-layer {
        transition: opacity 1.2s ease-in-out;
    }
    
    .responsive-image img {
        transition: none;
        transform: none;
    }
}

/* ===================================
   УТИЛИТЫ
   =================================== */
@media (max-width: 576px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 1025px) {
    .hide-desktop {
        display: none !important;
    }
}

/* ===================================
   ОПТИМИЗАЦИЯ ПРОИЗВОДИТЕЛЬНОСТИ
   =================================== */
.backgrounds-container {
    contain: layout style paint;
}

.background-layer {
    contain: layout style;
}

/* Отключаем сложные эффекты на слабых устройствах */
@media (max-width: 768px) {
    .backgrounds-container,
    .background-layer {
        contain: strict;
    }
    
    .responsive-image img {
        will-change: auto;
    }
}

/* ===================================
   CSS ПЕРЕМЕННЫЕ
   =================================== */
:root {
    --scroll-progress: 0%;
    --vh: 1vh; /* Будет обновляться через JS для iOS */
}

/* ===================================
   РЕЖИМ ОТЛАДКИ
   =================================== */
.debug-mode .background-layer {
    border: 2px solid red;
}

.debug-mode .tanya-bg {
    border: 2px solid yellow;
    opacity: 0.8 !important;
}

.debug-mode .background-layer::before {
    content: attr(data-bg);
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    z-index: 9999;
    font-size: 12px;
    font-weight: bold;
}

/* ===================================
   ПЕЧАТЬ
   =================================== */
@media print {
    .scroll-indicator,
    .tanya-bg {
        display: none !important;
    }
    
    .backgrounds-container {
        position: static !important;
    }
    
    .background-layer {
        position: static !important;
        opacity: 1 !important;
        page-break-after: always;
    }
}


/* ===================================
   ГАЛЕРЕЯ
   =================================== */

.gallery-section {
    position: relative;
    min-height: 100vh;
    padding: 80px 20px;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    z-index: 10;
    margin-top: 400vh; /* После всех фоновых секций */
}

.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Заголовок галереи */
.gallery-title {
    text-align: center;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 300;
    letter-spacing: 0.1em;
    margin-bottom: 3rem;
    color: #fff;
    position: relative;
    animation: fadeInUp 1s ease-out;
}

.gallery-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #fff, transparent);
}

/* Фильтры */
.gallery-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 3rem;
    animation: fadeInUp 1s ease-out 0.2s both;
}

.filter-btn {
    padding: 0.75rem 2rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.filter-btn:hover,
.filter-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.1);
}

/* Сетка галереи */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Элемент галереи */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    animation: fadeInUp 0.6s ease-out;
    transition: all 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.gallery-item-inner {
    position: relative;
    width: 100%;
    padding-bottom: 75%; /* Соотношение 4:3 */
    overflow: hidden;
}

.gallery-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Оверлей с подписью */
.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    color: #fff;
    padding: 1.5rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    transform: translateY(0);
}

.gallery-caption {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.gallery-description {
    font-size: 0.9rem;
    opacity: 0.8;
    line-height: 1.4;
}

/* Кнопка "Показать ещё" */
.gallery-load-more {
    display: block;
    margin: 0 auto;
    padding: 1rem 3rem;
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    font-size: 1rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-load-more:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

/* Скрытие элементов при фильтрации */
.gallery-item.hidden {
    display: none;
}

.gallery-item.show {
    animation: fadeInUp 0.5s ease;
}

/* ===================================
   МОДАЛЬНОЕ ОКНО ГАЛЕРЕИ
   =================================== */

.gallery-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

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

.gallery-modal-content {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    animation: zoomIn 0.3s ease;
}

.gallery-modal-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #fff;
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    z-index: 10000;
    transition: all 0.3s ease;
}

.gallery-modal-close:hover {
    transform: rotate(90deg);
}

.gallery-modal-caption {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    text-align: center;
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    max-width: 80%;
}

/* Навигация в модальном окне */
.gallery-modal-prev,
.gallery-modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    font-size: 3rem;
    padding: 0 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 80px;
    backdrop-filter: blur(5px);
}

.gallery-modal-prev {
    left: 20px;
}

.gallery-modal-next {
    right: 20px;
}

.gallery-modal-prev:hover,
.gallery-modal-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===================================
   АНИМАЦИИ ГАЛЕРЕИ
   =================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===================================
   АДАПТИВНОСТЬ ГАЛЕРЕИ
   =================================== */

@media (max-width: 768px) {
    .gallery-section {
        padding: 60px 15px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .filter-btn {
        padding: 0.5rem 1.5rem;
        font-size: 0.85rem;
    }
    
    .gallery-modal-prev,
    .gallery-modal-next {
        font-size: 2rem;
        padding: 0 15px;
        height: 60px;
    }
    
    .gallery-modal-close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-title {
        font-size: 1.8rem;
    }
    
    .gallery-filters {
        gap: 0.5rem;
    }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .gallery-modal-prev,
    .gallery-modal-next {
        display: none; /* Скрываем на маленьких экранах */
    }
}

/* Поддержка touch-устройств */
@media (hover: none) {
    .gallery-overlay {
        transform: translateY(0);
        background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    }
    
    .gallery-item:active img {
        transform: scale(0.95);
    }
}

/* ===================================
   КНОПКА ДОБАВЛЕНИЯ ФОТО
   =================================== */

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

.gallery-add-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.gallery-add-btn:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.1));
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.1);
}

.gallery-add-btn svg {
    width: 20px;
    height: 20px;
}

/* ===================================
   МОДАЛЬНОЕ ОКНО ЗАГРУЗКИ
   =================================== */

.upload-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    overflow-y: auto;
}

.upload-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.upload-modal-content {
    background: linear-gradient(135deg, #1a1a1a, #0a0a0a);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.3s ease;
}

.upload-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.upload-modal-header h3 {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 300;
}

.upload-modal-close {
    color: rgba(255, 255, 255, 0.6);
    font-size: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
}

.upload-modal-close:hover {
    color: #fff;
    transform: rotate(90deg);
}

.upload-modal-body {
    padding: 1.5rem;
}

/* ===================================
   ЗОНА ЗАГРУЗКИ (DROPZONE)
   =================================== */

.upload-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
}

.upload-dropzone:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.05);
}

.upload-dropzone.dragover {
    border-color: #4facfe;
    background: rgba(79, 172, 254, 0.1);
}

.upload-dropzone-content {
    pointer-events: none;
}

.upload-icon {
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 1rem;
}

.upload-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.upload-browse-btn {
    background: none;
    border: none;
    color: #4facfe;
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
    pointer-events: all;
}

.upload-browse-btn:hover {
    color: #7fc4fd;
}

.upload-hint {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
}

/* ===================================
   ПРЕДПРОСМОТР ЗАГРУЖЕННЫХ ФОТО
   =================================== */

.upload-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
    max-height: 200px;
    overflow-y: auto;
}

.upload-preview:empty {
    display: none;
}

.preview-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 1;
    animation: fadeInUp 0.3s ease;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
}

.preview-item:hover .preview-item-remove {
    opacity: 1;
}

.preview-item-remove:hover {
    background: rgba(255, 0, 0, 0.7);
    transform: scale(1.1);
}

/* ===================================
   ФОРМА ЗАГРУЗКИ
   =================================== */

.upload-form {
    display: none;
}

.upload-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: #4facfe;
    background: rgba(255, 255, 255, 0.08);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-select {
    cursor: pointer;
}

.form-select option {
    background: #1a1a1a;
    color: #fff;
}

/* ===================================
   КНОПКИ ФОРМЫ
   =================================== */

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===================================
   АНИМАЦИИ
   =================================== */

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===================================
   АДАПТИВНОСТЬ
   =================================== */

@media (max-width: 768px) {
    .gallery-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .gallery-add-btn {
        width: 100%;
        justify-content: center;
    }
    
    .upload-modal-content {
        width: 95%;
        margin: 1rem;
        max-height: 95vh;
    }
    
    .upload-dropzone {
        padding: 2rem 1rem;
    }
    
    .upload-preview {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

@media (max-width: 480px) {
    .gallery-add-btn span {
        display: none;
    }
    
    .gallery-add-btn {
        width: 50px;
        height: 50px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
        position: fixed;
        bottom: 30px;
        right: 30px;
        z-index: 100;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    }
}
