.modal {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.95);
    align-items: center !important;
    justify-content: center !important;
    z-index: 99999 !important;
    margin: 0 !important;
    padding: 20px !important;
    transform: none !important;
    box-sizing: border-box !important;
    overflow: auto !important;
    cursor: pointer;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 95vw;
    height: 100%;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: default;
}

.modal-main-image {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.modal img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7);
    cursor: default;
    transition: none;
}

.modal-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 18px;
    cursor: pointer;
    z-index: 100002;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-nav-btn:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: translateY(-50%) scale(0.9);
}

.modal-prev {
    left: 20px;
}

.modal-next {
    right: 20px;
}

.modal-counter {
    color: white;
    font-size: 16px;
    font-weight: 500;
    margin: 15px 0 10px 0;
    text-align: center;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.modal-gallery {
    display: flex;
    gap: 8px;
    padding: 10px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.modal-gallery::-webkit-scrollbar {
    height: 6px;
}

.modal-gallery::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.modal-gallery::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.modal-gallery::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.modal-gallery img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.modal-gallery img:hover {
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.modal-gallery img.active {
    border-color: #3498db;
    transform: scale(1.1);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100003;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

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

@media (max-width: 768px) {
    .modal {
        padding: 10px !important;
    }

    .modal-content {
        max-width: 100vw;
        max-height: 100vh;
    }

    .modal-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .modal-prev {
        left: 10px;
    }

    .modal-next {
        right: 10px;
    }

    .modal-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .modal-counter {
        font-size: 14px;
        margin: 10px 0 8px 0;
        padding: 6px 12px;
    }

    .modal-gallery img {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .modal-nav-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    .modal-prev {
        left: 5px;
    }

    .modal-next {
        right: 5px;
    }

    .modal-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }

    .modal-gallery {
        gap: 6px;
        padding: 8px;
    }

    .modal-gallery img {
        width: 45px;
        height: 45px;
    }
}