/* --- Overlay e Estrutura Principal --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    opacity: 0; /* Para animação de fade in */
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex !important;
    opacity: 1;
}

.modal-content {
    background-color: var(--cor-fundo);
    width: 95%;
    max-width: 1100px;
    /* Altura dinâmica com limite */
    height: auto;
    max-height: 90vh;
    border-radius: 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--cor-borda);
}

.modal-body {
    display: flex;
    flex-direction: row;
    /* Altura fixa ajuda a manter o layout do swiper estável no desktop */
    height: 600px;
}

/* --- Botão Fechar --- */
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 100; /* Acima do Swiper */
    color: var(--cor-vinho);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: var(--cor-dourado);
}

/* --- Galeria (Esquerda) --- */
.modal-gallery-container {
    flex: 1.5; /* Dá mais destaque para a foto */
    background-color: #000;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Fix para flexbox e swiper */
    position: relative;
}

/* Swiper Ajustes */
.swiper {
    width: 100%;
    height: 100%;
    --swiper-navigation-color: var(--cor-dourado);
    --swiper-pagination-color: var(--cor-dourado);
}

.mySwiper2 {
    height: 80% !important;
    width: 100%;
}

.mySwiper {
    height: 20% !important;
    box-sizing: border-box;
    padding: 10px;
    background: #111;
}

.mySwiper .swiper-slide {
    opacity: 0.4;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    transition: opacity 0.3s;
}

.mySwiper .swiper-slide-thumb-active {
    opacity: 1;
    border: 2px solid var(--cor-dourado);
}

.swiper-slide img {
    display: block;
    width: 100%;
    height: 100%;
    /* 'Cover' deixa a foto bonita preenchendo tudo. 
       Se a foto precisar aparecer inteira sem corte, mude para 'contain' */
    object-fit: cover;
}

/* Botões de navegação do Swiper mais discretos */
.swiper-button-next,
.swiper-button-prev {
    transform: scale(0.7);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* --- Infos (Direita) --- */
.modal-info {
    flex: 1;
    padding: 2.5rem;
    background-color: var(--cor-fundo);
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Permite scroll apenas no texto se for longo */
    position: relative;
}

/* Estilização da Scrollbar (Chrome/Safari/Edge) */
.modal-info::-webkit-scrollbar {
    width: 8px;
}
.modal-info::-webkit-scrollbar-track {
    background: transparent;
}
.modal-info::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}
.modal-info:hover::-webkit-scrollbar-thumb {
    background-color: var(--cor-dourado);
}

/* Tipografia e Elementos */
.modal-title-custom {
    color: var(--cor-texto);
    font-family: var(--fonte-principal);
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.modal-price-custom {
    color: var(--cor-vinho);
    font-family: var(--fonte-secundaria);
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 1rem;
}

.modal-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.modal-meta p {
    color: var(--cor-texto-suave, #555);
    font-family: var(--fonte-secundaria);
    font-size: 0.95rem;
    background: rgba(0, 0, 0, 0.03);
    padding: 5px 10px;
    border-radius: 4px;
    margin: 0;
}

.modal-meta i {
    color: var(--cor-dourado);
    margin-right: 5px;
}

.modal-desc-box {
    background: #f8f9fa; /* Ou use var(--cor-fundo-secundario) */
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--cor-dourado);
    margin-bottom: 2rem;
    color: var(--cor-texto);
    font-family: var(--fonte-secundaria);
    line-height: 1.6;
}

.modal-desc-box h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--cor-vinho);
    font-size: 1.1rem;
}

.btn-action {
    margin-top: auto;
    background: var(--cor-vinho);

    /* FORÇAR A COR BRANCA E REMOVER SUBLINHADO DE LINK */
    color: #ffffff !important;
    text-decoration: none !important;

    border: none;
    padding: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    font-family: var(--fonte-secundaria);
    transition: all 0.3s;

    /* GARANTIR CENTRALIZAÇÃO PERFEITA DO TEXTO */
    display: flex;
    justify-content: center;
    align-items: center;

    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-action:hover {
    background: var(--cor-dourado);
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* --- Mobile Responsivo --- */
@media (max-width: 900px) {
    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        flex-direction: column;
        height: 100%; /* Ocupa altura total */
        overflow-y: auto; /* Scroll na página inteira do modal */
    }

    /* Galeria no topo */
    .modal-gallery-container {
        flex: none; /* Remove flex ratio */
        height: 40vh; /* Ocupa 40% da tela */
        width: 100%;
    }

    .modal-close {
        color: #fff;
        background: rgba(0, 0, 0, 0.5); /* Mais contraste no mobile */
        top: 10px;
        right: 10px;
    }

    /* Info embaixo */
    .modal-info {
        flex: none; /* Remove flex ratio */
        min-height: auto;
        padding: 1.5rem;
        overflow-y: visible; /* Scroll gerenciado pelo modal-body */
    }

    .modal-title-custom {
        font-size: 1.6rem;
    }

    .mySwiper2 {
        height: 100% !important; /* Remove thumbs no mobile se quiser economizar espaço */
    }

    /* Opcional: Esconder as miniaturas no mobile para dar mais foco */
    .mySwiper {
        display: none;
    }
}
