/* ========== МОДАЛЬНОЕ ОКНО (БАЗОВОЕ) ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    max-width: 550px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    
    /* Скрываем скроллбар */
    scrollbar-width: none;
    -ms-overflow-style: none;
    
    border-radius: 48px;
    padding: 48px 40px;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    box-shadow: 0 40px 60px rgba(0,0,0,0.3);
    border: 1px solid #ccfbf1;
}

.modal-content::-webkit-scrollbar {
    display: none;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 24px;
    right: 28px;
    font-size: 1.8rem;
    cursor: pointer;
    color: #94a3b8;
    transition: 0.2s;
    background: none;
    border: none;
    font-weight: 300;
    z-index: 10;
}

.modal-close:hover {
    color: #0f766e;
}

.modal-icon {
    font-size: 4rem;
    color: #0f766e;
    margin-bottom: 20px;
    text-align: center;
}

.modal-content h2 {
    font-size: 2rem;
    color: #115e59;
    margin-bottom: 16px;
    text-align: center;
}

.modal-description {
    color: #334155;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 24px;
    text-align: center;
}

.modal-features {
    list-style: none;
    margin: 24px 0;
    background: #f0fdfa;
    padding: 24px;
    border-radius: 28px;
}

.modal-features li {
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #115e59;
}

.modal-features li i {
    color: #10b981;
    font-size: 1.2rem;
    width: 24px;
}

.modal-price {
    font-size: 1.8rem;
    font-weight: 800;
    color: #0f766e;
    text-align: center;
    margin: 20px 0;
}

.modal-price span {
    font-size: 1rem;
    font-weight: 400;
    color: #64748b;
}

.modal-btn {
    width: 100%;
    background: #0f766e;
    color: white;
    border: none;
    padding: 16px;
    border-radius: 48px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: 0.2s;
    margin-top: 16px;
}

.modal-btn:hover {
    background: #0d5c56;
    transform: translateY(-2px);
}

/* ========== МОДАЛЬНОЕ ОКНО ПОРТФОЛИО С ГАЛЕРЕЕЙ ========== */
.portfolio-modal-content {
    max-width: 1100px;
    width: 95%;
    padding: 40px;
    max-height: 90vh;
    overflow-y: auto;
    
    /* Скрываем скроллбар */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.portfolio-modal-content::-webkit-scrollbar {
    display: none;
}

.portfolio-modal-grid {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

/* Левая часть — галерея */
.portfolio-modal-gallery {
    flex: 1.2;
    min-width: 400px;
}

.gallery-main {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 118, 110, 0.15);
    border: 1px solid #ccfbf1;
    margin-bottom: 16px;
    cursor: zoom-in;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-main img {
    width: 100%;
    height: auto;
    min-height: 350px;
    max-height: 500px;
    object-fit: contain;
    object-position: center;
    display: block;
    background: #f8fafc;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #0f766e;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid #ccfbf1;
}

.gallery-nav:hover {
    background: #0f766e;
    color: white;
    transform: translateY(-50%) scale(1.05);
}

.gallery-nav.prev {
    left: 16px;
}

.gallery-nav.next {
    right: 16px;
}

.gallery-counter {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 6px 14px;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
}

/* Миниатюры */
.gallery-thumbnails {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 4px;
    
    /* Скрываем скроллбар */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.gallery-thumbnails::-webkit-scrollbar {
    display: none;
}

.thumbnail-item {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    opacity: 0.7;
}

.thumbnail-item:hover {
    opacity: 1;
}

.thumbnail-item.active {
    border-color: #0f766e;
    opacity: 1;
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.2);
}

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

/* Правая часть — информация */
.portfolio-modal-info {
    flex: 0.9;
    min-width: 280px;
}

.portfolio-modal-category {
    display: inline-block;
    background: #f0fdfa;
    color: #0f766e;
    padding: 6px 16px;
    border-radius: 40px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 12px;
    border: 1px solid #ccfbf1;
}

.portfolio-modal-info h2 {
    font-size: 1.8rem;
    color: #115e59;
    margin-bottom: 12px;
    text-align: left;
}

.portfolio-modal-info p {
    color: #334155;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.portfolio-modal-features {
    list-style: none;
    margin: 16px 0;
    padding: 0;
    background: transparent;
}

.portfolio-modal-features li {
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #115e59;
    font-size: 0.9rem;
}

.portfolio-modal-features li i {
    color: #10b981;
    font-size: 1rem;
    margin-top: 3px;
    min-width: 18px;
}

.portfolio-modal-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0 24px;
}

.portfolio-modal-tech span {
    background: #e6f7f3;
    color: #0f766e;
    padding: 6px 14px;
    border-radius: 40px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid #a7f3d0;
}

/* ========== ЛАЙТБОКС — УВЕЛИЧЕННОЕ ИЗОБРАЖЕНИЕ ========== */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.show {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    width: 70%;
    height: 70%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 24px;
    right: 32px;
    font-size: 2.5rem;
    color: white;
    cursor: pointer;
    background: none;
    border: none;
    transition: 0.2s;
    z-index: 10;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
    font-size: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.prev {
    left: 32px;
}

.lightbox-nav.next {
    right: 32px;
}

.lightbox-counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 20px;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
}

/* ========== АДАПТИВ ДЛЯ ВСЕХ РАЗРЕШЕНИЙ ========== */

/* Адаптив для лайтбокса */
@media (max-width: 768px) {
    .lightbox-content {
        width: 90%;
        height: 80%;
    }
    
    .lightbox-nav {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
    
    .lightbox-nav.prev {
        left: 16px;
    }
    
    .lightbox-nav.next {
        right: 16px;
    }
    
    .lightbox-close {
        top: 16px;
        right: 16px;
        font-size: 2rem;
        width: 40px;
        height: 40px;
    }
}

/* Адаптив для модалки портфолио */
@media (max-width: 900px) {
    .portfolio-modal-grid {
        flex-direction: column;
    }
    
    .portfolio-modal-gallery {
        min-width: 100%;
        width: 100%;
    }
    
    .gallery-main {
        width: 100%;
        border-radius: 20px;
    }
    
    .gallery-main img {
        width: 100%;
        height: auto;
        min-height: 200px;
        max-height: 350px;
        object-fit: contain;
        object-position: center;
        background: #f8fafc;
    }
    
    .portfolio-modal-content {
        padding: 20px 16px;
        max-height: 95vh;
    }
    
    .portfolio-modal-info h2 {
        font-size: 1.5rem;
    }
}

/* Для мобильных устройств */
@media (max-width: 767px) {
    .gallery-main img {
        min-height: 180px;
        max-height: 300px;
        object-fit: contain;
    }
    
    .gallery-nav {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .gallery-nav.prev {
        left: 10px;
    }
    
    .gallery-nav.next {
        right: 10px;
    }
    
    .gallery-counter {
        padding: 4px 12px;
        font-size: 0.75rem;
        bottom: 12px;
        right: 12px;
    }
    
    .thumbnail-item {
        width: 60px;
        height: 45px;
        border-radius: 8px;
    }
    
    .thumbnail-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 575px) {
    .gallery-main {
        border-radius: 16px;
    }
    
    .gallery-main img {
        min-height: 150px;
        max-height: 250px;
        object-fit: contain;
    }
    
    .gallery-nav {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .thumbnail-item {
        width: 50px;
        height: 38px;
    }
    
    .portfolio-modal-info h2 {
        font-size: 1.2rem;
    }
    
    .portfolio-modal-info p {
        font-size: 0.85rem;
    }
    
    .portfolio-modal-features li {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }
    
    .portfolio-modal-tech span {
        padding: 4px 10px;
        font-size: 0.65rem;
    }
    
    .modal-btn {
        padding: 12px;
        font-size: 0.9rem;
    }
}

/* Для очень маленьких экранов по высоте */
@media (max-height: 600px) and (max-width: 900px) {
    .gallery-main img {
        max-height: 200px;
    }
    
    .portfolio-modal-content {
        max-height: 95vh;
    }
    
    .portfolio-modal-info {
        max-height: 300px;
        overflow-y: auto;
        
        /* Скрываем скроллбар */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .portfolio-modal-info::-webkit-scrollbar {
        display: none;
    }
}

/* Адаптив для модального окна услуг */
@media (max-width: 880px) {
    .modal-content { 
        padding: 32px 24px;
        max-height: 85vh;
    }
    .modal-content h2 { 
        font-size: 1.6rem; 
    }
}

@media (max-width: 575px) {
    .modal-content {
        padding: 24px 18px;
        max-height: 80vh;
        width: 95%;
    }
}

/* Дополнительные стили для изображений на мобильных */
@media (max-width: 900px) {
    .gallery-main {
        background: #f8fafc;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .gallery-main img {
        width: 100%;
        height: auto;
        object-fit: contain !important;
    }
}

@media (max-width: 480px) {
    .gallery-main img {
        max-height: 250px !important;
    }
}