/* ==========================================================================
   ESTRUTURA DO MODAL (SEU CÓDIGO ORIGINAL - NÃO MEXER EM POSIÇÕES)
   ========================================================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    padding: 0;
}

.modal[style*="display: block"],
.modal[style*="display: flex"] {
    display: flex !important;
}

.modal-content {
    background-color: #ffffff;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    box-shadow: none;
}

.modal-body {
    display: flex;
    flex-direction: row;
    height: 100%;
    width: 100%;
    overflow: hidden;
    /* SEM TRANSITION (Troca instantânea) */
}

/* --- ÁREA DA MÍDIA (PAI FIXO) --- */
.modal-media-container {
    flex: 2;
    background-color: #ffffff;
    position: relative;
    /* Setas ficam fixas aqui */
    height: 100%;
    display: block;
    overflow: hidden;
    /* O PAI NÃO ROLA. Quem rola é o filho (.scroll-wrapper) */
    text-align: left;
    /* antes: center; gruda melhor na esquerda */
    /* SEM TRANSITION */
}

/* --- NOVO: O CONTAINER QUE ROLA AS FOTOS --- */
.scroll-wrapper {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    /* Rolagem aqui dentro */
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--color-accent-gold) #f0f0f0;
}

/* --- ESTADO "FITTED" (PC) --- */
.modal-body.layout-fitted .modal-media-container {
    flex: 0 0 auto;
    width: auto;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    /* antes: #fafafa; evita “faixa” diferente */
}

/* No modo Fitted, o wrapper trava a rolagem e centraliza */
.modal-body.layout-fitted .scroll-wrapper {
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
}

/* Estilo dos Slides */
.media-slide {
    display: none;
    background-color: #ffffff;
}

.media-slide.active {
    display: block;
}

/* 1. Imagem no Modo Scroll (Padrão) */
img.media-slide.active {
    width: 100%;
    height: auto;
    object-fit: unset;
    display: block;
}

/* 2. Imagem no Modo Fit (Inteira) */
.modal-body.layout-fitted img.media-slide.active {
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

/* --- 3. VÍDEOS (DESKTOP / PADRÃO): SEM FUNDO PRETO + ALTURA NATURAL --- */
video.media-slide.active {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    background: transparent;
    display: block;
    margin: 0;
}

/* --- 3b. VÍDEO NO MODO "FITTED" (IGUAL FOTO TELA CHEIA) --- */
/* Isso faz o vídeo ocupar 100% da altura e puxar o texto para perto (esquerda) */
.modal-body.layout-fitted video.media-slide.active {
    width: auto !important;
    /* Largura automática para o container encolher */
    height: 100% !important;
    /* Altura total da tela */
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: transparent;
    display: block;
    margin: 0;
}

/* --- SETAS (AGORA FICAM FIXAS NA TELA) --- */
.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--color-accent-gold);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    border: 1px solid #eee;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 20;
    /* Fica acima da foto/vídeo */
    transition: 0.2s;
    user-select: none;
}

.slider-arrow:hover {
    background-color: var(--color-accent-gold);
    color: white;
}

.prev-arrow {
    left: 20px;
}

.next-arrow {
    right: 20px;
}

/* --- TEXTO (LATERAL DIREITA) --- */
.modal-details {
    flex: 0.8;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: #ffffff;
    border-left: 1px solid #f5f5f5;
    z-index: 2;
    /* SEM TRANSITION */
}

.modal-body.layout-fitted .modal-details {
    flex: 1;
    background-color: #ffffff;
    box-shadow: -10px 0 20px -10px rgba(0, 0, 0, 0.05);
}

.modal-close {
    position: absolute;
    right: 30px;
    top: 30px;
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    z-index: 2005;
    border: 1px solid #eee;
    transition: 0.2s;
}

.modal-close:hover {
    transform: scale(1.1);
    background: var(--color-accent-gold);
    color: white;
    border-color: transparent;
}

/* --- BOTÃO DE PLAY (NOVO) --- */
.play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Centraliza exato */

    width: 80px;
    height: 80px;
    background-color: rgba(255, 255, 255, 0.85);
    color: var(--color-accent-gold);
    border-radius: 50%;

    display: flex;
    /* Flex para centralizar o ícone */
    align-items: center;
    justify-content: center;

    font-size: 30px;
    cursor: pointer;
    border: 1px solid #ddd;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);

    z-index: 25;
    /* Fica acima do vídeo e das setas */
    transition: all 0.2s ease;
    opacity: 1;
    visibility: visible;
}

.play-btn:hover {
    background-color: var(--color-accent-gold);
    color: white;
    transform: translate(-50%, -50%) scale(1.1);
}

/* Classe para esconder o botão quando o vídeo estiver rodando */
.play-btn.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    /* Evita clique fantasma */
}

/* --- RESPONSIVE (MOBILE) --- */
@media (max-width: 768px) {

    #cakeModal .modal-content {
        height: 100vh !important;
        background: white !important;
        display: block !important;
        overflow: hidden !important;
    }

    #cakeModal .modal-body {
        display: block !important;
        flex-direction: column !important;
        width: 100% !important;
        height: 100% !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 50px;
        background: white !important;
    }

    #cakeModal .modal-media-container,
    #cakeModal .scroll-wrapper {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        flex: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
        overflow: visible !important;
        text-align: left !important;
    }

    #cakeModal img.media-slide.active {
        width: 100% !important;
        height: auto !important;
        object-fit: unset !important;
        display: block !important;
        margin: 0 !important;
    }

    #cakeModal video.media-slide.active {
        width: 100% !important;
        max-width: 100vw !important;
        height: auto !important;
        object-fit: contain !important;
        background: transparent !important;
        display: block !important;
        margin: 0 !important;
    }

    #cakeModal .modal-details {
        display: block !important;
        padding: 30px 20px 100px 20px !important;
        background: white !important;
        flex: none !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    .slider-arrow {
        width: 40px;
        height: 40px;
        font-size: 20px;
        background-color: rgba(255, 255, 255, 0.8);
        border: 1px solid #eee;
    }

    .prev-arrow {
        left: 10px;
    }

    .next-arrow {
        right: 10px;
    }

    .play-btn {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
}

/* ==========================================================================
   DESIGN DA PARTE BRANCA E MODAIS (O que faltava no seu código)
   ========================================================================== */

/* Estilos de Texto e Layout Interno da "Parte Branca" */
.modal-header-custom {
    text-align: center;
    margin-bottom: 0;
    padding-top: 25px;
}

/* Aumenta o Título (Ex: Doce Fantasia) */
.modal-header-custom h3 {
    font-size: 2.5rem; /* Aumentei de 1.5rem para 2.2rem */
    margin: 0;
    color: #222;
    font-family: var(--font-heading);
}

.modal-subtitle {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
    font-weight: 600;
}

/* Aumenta a Badge (Disponível para Locação) */
.modal-badge {
    background-color: #25D366;
    color: white;
    font-size: 0.9rem; /* Aumentei de 0.7rem para 0.9rem */
    font-weight: 700;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 10px;
}

.modal-details p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 30px;
}

/* Especificações (Ícones) */
.modal-specs {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    padding: 15px 0;
    width: 100%;
}

.spec-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.8rem;
    color: var(--color-text-main);
    gap: 5px;
    min-width: 80px;
}

.spec-item i {
    color: var(--color-accent-gold);
    font-size: 1.2rem;
}

.modal-footer-text {
    margin-top: 15px;
    color: #999;
}

/* Botões de Ação */
.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 0px;
    width: 100%;
}

/* Aumenta texto do botão Encomendar */
.btn-encomendar-modal {
    flex: 1;
    background-color: #25D366;
    color: white;
    font-weight: bold;
    font-size: 1.2rem; /* Aumentei de 1rem para 1.2rem */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px; /* Aumentei o espaço entre icone e texto um pouco */
    padding: 12px 20px;
    border-radius: 50px;
    text-decoration: none;
    transition: transform 0.2s, background-color 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-encomendar-modal:hover {
    background-color: #1ebc57;
    transform: translateY(-2px);
    color: white;
}

.btn-compartilhar-modal {
    width: 50px;
    background-color: #f0f2f5;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-compartilhar-modal:hover {
    background-color: #e4e6eb;
    color: #333;
}

/* ADICIONE ISSO PARA AUMENTAR SÓ O LOGO DO WHATSAPP */
.btn-encomendar-modal i, 
.btn-encomendar-modal svg {
    font-size: 1.6rem; /* Ícone bem visível */
}

/* ==========================================================================
   DARK MODE DO MODAL (DESIGN ESCURO)
   ========================================================================== */

[data-theme="dark"] .modal-content,
[data-theme="dark"] .modal-body,
[data-theme="dark"] .modal-media-container,
[data-theme="dark"] .modal-details,
[data-theme="dark"] .media-slide,
[data-theme="dark"] .scroll-wrapper {
    background-color: #121212 !important;
}

/* Títulos e Textos no Modal Escuro */
[data-theme="dark"] .modal-details h3,
[data-theme="dark"] .modal-header-custom h3 {
    color: #E0E0E0 !important;
}

[data-theme="dark"] .modal-details p,
[data-theme="dark"] .modal-subtitle,
[data-theme="dark"] .spec-item,
[data-theme="dark"] .modal-footer-text {
    color: #B0B0B0 !important;
}

[data-theme="dark"] .modal-specs,
[data-theme="dark"] .modal-details {
    border-color: #333 !important;
}

/* Botões do Modal Escuro */
[data-theme="dark"] .modal-close,
[data-theme="dark"] .btn-compartilhar-modal {
    background: #2D2D2D;
    color: #E0E0E0;
    border-color: #444;
}

/* --- CORREÇÃO FINAL: FORÇAR MODO ESCURO NO CELULAR --- */
/* Cole isso no FINAL do arquivo modais.css */
@media (max-width: 768px) {
    [data-theme="dark"] #cakeModal .modal-content,
    [data-theme="dark"] #cakeModal .modal-body,
    [data-theme="dark"] #cakeModal .modal-media-container,
    [data-theme="dark"] #cakeModal .scroll-wrapper,
    [data-theme="dark"] #cakeModal .modal-details {
        background-color: #121212 !important;
        background: #121212 !important;
    }

    /* Garante que o título e texto fiquem claros no fundo escuro */
    [data-theme="dark"] .modal-header-custom h3,
    [data-theme="dark"] .modal-details p,
    [data-theme="dark"] .spec-item,
    [data-theme="dark"] .modal-subtitle {
        color: #E0E0E0 !important;
    }
}