/* ==========================================================================
   1. ESTRUTURA GERAL E LAYOUT
   ========================================================================== */
body { 
    background: #f8f9fa; 
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.product-box {
    background: #fff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.08);
}

.section { 
    margin-top: 40px; 
    padding-top: 20px; 
    border-top: 1px solid #eee; 
}

.section h4 { 
    margin-bottom: 20px; 
    font-weight: 700;
    color: #333;
}

/* ==========================================================================
   2. GALERIA DE IMAGENS E VÍDEOS
   ========================================================================== */
.galeria-container {
    display: flex;
    gap: 15px;
    height: 500px;
    align-items: flex-start;
}

/* Coluna de Miniaturas (Esquerda) */
#thumb-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 80px;
    min-width: 80px;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}
/* Scrollbar bonita */
#thumb-container::-webkit-scrollbar { width: 5px; }
#thumb-container::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
#thumb-container::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
#thumb-container::-webkit-scrollbar-thumb:hover { background: #0d6efd; }

.thumb-item {
    width: 75px; height: 75px;
    border: 1px solid #dee2e6; border-radius: 8px;
    cursor: pointer; position: relative; flex-shrink: 0;
    overflow: hidden; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.thumb-item img, .thumb-item video { width: 100%; height: 100%; object-fit: cover; }
.thumb-item img.active, .video-thumb-wrapper.active { border: 2px solid #0d6efd; }

/* Imagem Principal (Grande) */
#main-media-container {
    flex: 1; height: 500px;
    background: #fff; border: 1px solid #dee2e6; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative;
}
#main-media-container img, #main-media-container video {
    max-width: 100%; max-height: 100%; object-fit: contain;
}

/* Ícone de Play no Thumb de Vídeo */
.video-thumb-wrapper { width: 100%; height: 100%; position: relative; display: block; }
.icon-play {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 24px; color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5); pointer-events: none; z-index: 2;
}

/* Remove efeitos indesejados de zoom do Bootstrap */
.card img, .card-img-top, #main-media-container img { transition: none !important; transform: none !important; }
.card:hover img, .card-img-top:hover, #main-media-container img:hover { transform: none !important; scale: 1 !important; }


/* ==========================================================================
   3. PREÇOS, SELOS E BOTÕES DE AÇÃO
   ========================================================================== */
.price-main { font-size: 2.5rem; font-weight: 700; color: #28a745; line-height: 1; }
.price-old { text-decoration: line-through; color: #6c757d; font-size: 1.2rem; margin-left: 10px; }
.badge-offer { background: #dc3545; color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 1rem; font-weight: 600; }

.price-container-responsive { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 5px; }

/* Selos (Compra Segura, etc) */
.selos-container { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 15px; max-width: 450px; }
.selo { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 8px; font-size: 0.85rem; font-weight: 500; color: #495057; background: #e9ecef; }
.selo i { margin-right: 4px; font-size: 0.95rem; }

/* Tags de Característica */
.caracteristica-pill {
    background-color: #f8f9fa; border: 1px solid #dee2e6; color: #555;
    font-size: 0.8rem; padding: 5px 12px; border-radius: 20px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 5px; transition: 0.2s;
}
.caracteristica-pill i { color: #0d6efd; }
.caracteristica-pill:hover { background-color: #e9ecef; border-color: #cbd3da; }

/* Botões Personalizados */
.btn-primary { background-color: #007bff; border-color: #007bff; transition: all 0.2s; }
.btn-primary:hover { background-color: #0069d9; border-color: #0062cc; }
.btn-outline-primary { border-color: #007bff; color: #007bff; background-color: #fff; transition: all 0.2s; }
.btn-outline-primary:hover { background-color: #007bff; color: #fff; }


/* ==========================================================================
   4. VARIAÇÕES (COR, TAMANHO) E ESTOQUE
   ========================================================================== */
.variation-preview label { font-weight: 600; margin-bottom: 6px; display: block; color: #333; }

.var-thumb-wrapper {
    cursor: pointer; border: 2px solid transparent; border-radius: 12px; padding: 6px;
    min-width: 70px; text-align: center; transition: all 0.2s; background: #f8f9fa;
}
.var-thumb-wrapper.active, .var-thumb-wrapper.border-primary { border-color: #007bff !important; background: #f0f8ff; }
.var-thumb { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; margin-bottom: 4px; }
.var-name { font-size: 13px; color: #555; display: block; line-height: 1.1; }

.estoque-info-wrapper {
    background: #f9f9f9; border-radius: 8px; padding: 8px 12px;
    display: flex; align-items: center; gap: 8px; border: 1px solid #eee;
    margin-top: 5px; transition: background 0.3s ease;
}
.estoque-total { color: #28a745; font-weight: 600; }
.estoque-low { color: #ffc107; font-weight: 600; }
.estoque-zero { color: #dc3545; font-weight: 600; }

.variacoes-grid { display: flex; flex-wrap: wrap; gap: 20px; }
.variacao-box { flex: 1 1 250px; background: #ffffff; border: 2px solid #e0e0e0; border-radius: 12px; padding: 20px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); min-width: 240px; }
.opcao-box { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }


/* ==========================================================================
   5. DESCRIÇÃO DO PRODUTO (EXPANDIR/RECOLHER)
   ========================================================================== */
/* Desktop */
.descricao-desktop-container { position: relative; max-height: 200px; overflow: hidden; transition: max-height 0.5s ease; }
.descricao-desktop-container.expanded { max-height: none; }
.descricao-desktop-overlay {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 80px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
    pointer-events: none; transition: opacity 0.3s;
}
.descricao-desktop-container.expanded .descricao-desktop-overlay { opacity: 0; }
.btn-ver-mais-desktop { background: none; border: none; color: #0d6efd; font-weight: 600; padding: 5px 0; cursor: pointer; display: block; margin-top: 5px; }

/* Mobile */
.descricao-abaixo { max-width: 450px; background: #fff; border-radius: 10px; padding: 20px; position: relative; overflow: hidden; transition: max-height 0.4s ease; }
.descricao-abaixo.collapsed { max-height: 160px; mask-image: linear-gradient(to bottom, black 60%, transparent 100%); -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%); }
.btn-ver-mais { background: none; border: none; color: #007bff; font-weight: 600; cursor: pointer; display: block; margin-top: 10px; padding: 0; }


/* ==========================================================================
   6. FRETE E CEP (VISUAL MODERNO)
   ========================================================================== */
.frete-premium-wrapper {
    background-color: #f8f9fa; border-radius: 10px; padding: 10px 12px;
    margin: 15px 0 20px 0; border: 1px solid #e9ecef; border-left: 4px solid #0d6efd;
    transition: all 0.3s ease;
}
.valor-frete-destaque { color: #198754; font-weight: 700; }

.btn-toggle-frete {
    background: #fff; border: 1px solid #dee2e6; color: #0d6efd; border-radius: 20px;
    font-size: 0.75rem; padding: 3px 10px; font-weight: 600; transition: 0.2s;
}
.btn-toggle-frete:hover { background: #0d6efd; color: #fff; border-color: #0d6efd; }

.input-cep-moderno { border-radius: 20px 0 0 20px !important; height: 34px; font-size: 0.9rem; }
.btn-cep-moderno { border-radius: 0 20px 20px 0 !important; height: 34px; font-size: 0.9rem; }

/* Lista de Opções de Frete */
.frete-opcao-label {
    display: block; cursor: pointer; padding: 8px 10px; border: 1px solid #eee;
    border-radius: 6px; margin-bottom: 6px; transition: all 0.2s; background: #fff;
}
.frete-opcao-label:hover { background-color: #f1f5f9; }
.frete-opcao-label:has(.frete-radio:checked) { border-color: #0d6efd; background-color: #f0f7ff; }
.frete-radio:checked + .frete-opcao-content .frete-opcao-nome { color: #0d6efd; }
.frete-opcao-nome { font-size: 0.8rem; text-transform: uppercase; font-weight: 700; color: #555; }
.frete-opcao-valor { font-weight: 700; font-size: 1rem; color: #333; }
.frete-opcao-prazo { font-size: 0.8rem; color: #444; display: block; margin-top: 1px; }


/* ==========================================================================
   7. COMENTÁRIOS - NOVO ESTILO (MODERNO)
   ========================================================================== */
.comentario-box {
    background-color: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    transition: all 0.3s ease;
}

.comentario-box:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}

/* Estrelas */
.avaliacao-estrelas, .avaliacao-estrelas-edit { display: flex; gap: 4px; font-size: 1.6rem; color: #e0e0e0; cursor: pointer; margin-bottom: 10px; }
.avaliacao-estrelas i, .avaliacao-estrelas-edit i { transition: transform 0.2s; }
.avaliacao-estrelas i:hover, .avaliacao-estrelas-edit i:hover { transform: scale(1.2); }
.avaliacao-estrelas .bi-star-fill, .avaliacao-estrelas-edit .bi-star-fill { color: #ffc107; }

/* Input de Texto */
.comentario-input-wrapper {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s;
}
.comentario-input-wrapper:focus-within {
    background-color: #fff;
    border-color: #0d6efd;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.1);
}

.comentario-input {
    display: block; outline: none; border: none; font-size: 0.95rem; width: 100%;
    min-height: 80px; line-height: 1.5; color: #333; white-space: pre-wrap; word-wrap: break-word;
    background: transparent;
}
/* Placeholder fake via CSS */
.comentario-input[data-placeholder]:empty:before {
    content: attr(data-placeholder); color: #888; pointer-events: none;
}

#contadorCaracteres { font-size: 0.8rem; text-align: right; color: #999; margin-top: 4px; }

/* Botões de Upload (Pílula) */
.btn-midia-upload {
    border-radius: 50px; font-size: 0.85rem; font-weight: 600;
    padding: 8px 16px; border: 1px solid #dee2e6;
    color: #555; background: #fff; transition: 0.2s;
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
}
.btn-midia-upload:hover {
    background-color: #f1f5f9; color: #0d6efd; border-color: #cbd3da;
    transform: translateY(-1px);
}
.btn-midia-upload i { font-size: 1rem; }

/* --- PREVIEW DE MÍDIA (MODERNO) --- */
.preview-wrapper {
    position: relative;
    display: inline-block;
    vertical-align: top;
    margin-right: 12px;
    margin-top: 12px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background: #000;
    border: 1px solid #eee;
}

.preview-wrapper img, 
.preview-wrapper video {
    display: block;
    object-fit: cover;
    /* Tamanho padronizado */
    height: 100px; 
    width: auto;
    min-width: 100px;
}

/* Ajuste específico para vídeo */
.preview-wrapper video {
    object-fit: contain;
    background: #000;
}

/* Botão X de remover */
.preview-wrapper .btn-danger {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px; padding: 0; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: rgba(220, 53, 69, 0.9);
    border: none; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: 0.2s; z-index: 10;
}
.preview-wrapper .btn-danger:hover { background: #dc3545; transform: scale(1.1); }

/* --- LISTA DE COMENTÁRIOS --- */
.comentario-item {
    background: #fff; border: none; border-bottom: 1px solid #f0f0f0;
    padding: 20px 0; margin-bottom: 0 !important;
}
.comentario-item:last-child { border-bottom: none; }

.comentario-texto {
    font-size: 0.95rem; line-height: 1.6; color: #444; margin-top: 8px;
    word-break: break-word;
}


/* ==========================================================================
   8. MODAL, SIDECART E RESPONSIVIDADE
   ========================================================================== */
.modal-midia {
    display: none; position: fixed; z-index: 2000; left: 0; top: 0;
    width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.9); text-align: center;
}
.modal-midia .fechar { position: absolute; top: 15px; right: 25px; color: white; font-size: 40px; font-weight: bold; cursor: pointer; }
.modal-midia .conteudo-modal { display: flex; justify-content: center; align-items: center; height: 100%; }

#sidecart {
    position: fixed; top: 0; right: -400px; width: 350px; height: 100vh;
    background: #fff; box-shadow: -2px 0 8px rgba(0,0,0,0.2); transition: right 0.3s ease;
    z-index: 9999; display: flex; flex-direction: column;
}
#sidecart.open { right: 0; }
#sidecart-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.45); display: none; z-index: 9998;
}

/* Responsividade Mobile */
@media (max-width: 768px) {
    .price-main { font-size: 1.8rem; }
    .price-old { font-size: 0.95rem; }
    .galeria-container { flex-direction: column-reverse; height: auto; }
    #thumb-container { flex-direction: row; width: 100%; height: auto; overflow-x: auto; padding-bottom: 5px; }
    #main-media-container { height: 350px; width: 100%; }
    .comentario-input-wrapper { min-height: 60px; }
    .btn-midia-upload { width: 100%; justify-content: center; }
}

/* Loading Overlay */
#loadingOverlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.9); z-index: 9999;
    display: none; flex-direction: column; align-items: center; justify-content: center;
}
.loading-spinner {
    width: 3rem; height: 3rem; border: 4px solid #f3f3f3;
    border-top: 4px solid #0d6efd; border-radius: 50%;
    animation: spin 1s linear infinite; margin-bottom: 15px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }