/* ═══════════════════════════════════════════════════════════════
   SIMULADOR DE UNIFORMES — Chiara Tees
   ═══════════════════════════════════════════════════════════════ */

.simulador-container {
    display: flex;
    height: calc(100vh - 120px);
    background: #f5f5f5;
    overflow: hidden;
}

/* ─── Menu Lateral ─────────────────────────────────────────────── */

.simulador-menu {
    width: 280px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    flex-shrink: 0;
}

.menu-item {
    border-bottom: 1px solid #f0f0f0;
}

.menu-lateral {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #4A4A4A;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.menu-lateral:hover {
    background: #f8f8f8;
    color: #C17A3A;
}

.menu-item.ativo .menu-lateral {
    background: #5D3A1A;
    color: #fff;
}

.box {
    display: none;
    padding: 12px;
    background: #fafafa;
}

.menu-item.ativo .box {
    display: block;
}

/* ─── Upload ───────────────────────────────────────────────────── */

.upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 12px;
}

.upload-area:hover {
    border-color: #C17A3A;
    background: #fff8f0;
}

#pc {
    font-size: 0.9rem;
    color: #666;
}

/* ─── Camadas ──────────────────────────────────────────────────── */

.camadas .titulo {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 8px;
}

.camadas ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.camadas li {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}

.camadas li.selecionado {
    border-color: #C17A3A;
    background: #fff8f0;
}

.camadas li img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    margin-right: 8px;
}

.camadas .remover {
    margin-left: auto;
    color: #999;
    cursor: pointer;
    font-size: 1.1rem;
}

.camadas .remover:hover {
    color: #E01A1A;
}

/* ─── Botão Novo Texto ─────────────────────────────────────────── */

.btn-novo {
    width: 100%;
    padding: 10px;
    background: #5D3A1A;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 10px;
    transition: background 0.2s;
}

.btn-novo:hover {
    background: #C17A3A;
}

/* ─── Controles de Texto ───────────────────────────────────────── */

.tb_texto {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.controles-texto {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fonte-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.fonte-tamanho {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 6px;
    background: #f0f0f0;
    border-radius: 4px;
}

.fonte-tamanho .menos,
.fonte-tamanho .mais {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.1rem;
}

.fonte-tamanho .valor {
    font-weight: 700;
    min-width: 30px;
    text-align: center;
}

.cor_texto {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cor_texto .cor {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.cor_texto .cor.ativo {
    border-color: #5D3A1A;
    transform: scale(1.15);
}

/* ─── Cores do Produto ─────────────────────────────────────────── */

.cores-produto {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.cor-produto {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ddd;
    transition: all 0.2s;
}

.cor-produto:hover {
    transform: scale(1.1);
}

.cor-produto.ativo {
    border-color: #5D3A1A;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #5D3A1A;
}

/* ─── Tamanhos ─────────────────────────────────────────────────── */

.tamanhos-produto {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.item-tamanho {
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.item-tamanho:hover {
    border-color: #C17A3A;
}

.item-tamanho.item-tamanho-selecionado {
    background: #5D3A1A;
    color: #fff;
    border-color: #5D3A1A;
}

/* ─── Quantidade ───────────────────────────────────────────────── */

.quantidade-produto {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 6px;
}

.quantidade-produto .menos,
.quantidade-produto .mais {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.2rem;
}

.quantidade-produto .valor {
    font-size: 1.3rem;
    font-weight: 700;
    min-width: 40px;
    text-align: center;
}

/* ─── Palco Central ────────────────────────────────────────────── */

.simulador-palco {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #e8e8e8;
    overflow: hidden;
}

.angulos {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    overflow: hidden;
}

.angulo {
    padding: 10px 24px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: #666;
    transition: all 0.2s;
}

.angulo.ativo {
    background: #5D3A1A;
    color: #fff;
}

.angulo:hover:not(.ativo) {
    background: #f0f0f0;
}

.palco {
    position: relative;
    width: 500px;
    height: 500px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    background: #fff;
}

.palco .tudo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.palco .fundo_cor {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.palco .imagem_base {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 1;
    pointer-events: none;
}

#camadas, #camadas_costas {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 10;
}

/* ─── Camadas de Imagem/Texto no Palco ─────────────────────────── */

.item_drag {
    position: absolute;
    cursor: move;
    user-select: none;
    z-index: 10;
    background: transparent;
    border: 0;
    touch-action: none;
}

.ajuste-logo { padding: 14px 0; }
.ajuste-logo[hidden] { display: none; }
.ajuste-logo label { font-weight: 600; }
.escala-controles { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.escala-controles input { width: 100%; min-width: 0; }
.escala-controles button { width: 34px; height: 34px; flex-shrink: 0; border: 1px solid #ddd; border-radius: 6px; background: white; cursor: pointer; font-size: 20px; }
.ajuste-logo p, .nota-previa { font-size: 12px; color: #666; line-height: 1.5; }
button.menu-lateral { width: 100%; text-align: left; border: 0; font: inherit; }
.palco .tudo { --cor-produto: #fff; }

.item_drag img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.area_pers {
    position: absolute;
    cursor: move;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 25px;
    font-family: Arial, sans-serif;
    color: #000;
    white-space: nowrap;
    user-select: none;
    z-index: 10;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.area_pers.selecionado,
.item_drag.selecionado {
    outline: 2px dashed #C17A3A;
    outline-offset: 2px;
}

/* ─── Zoom ─────────────────────────────────────────────────────── */

.zoom-controls {
    position: absolute;
    top: 60px;
    right: 16px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: #5D3A1A;
    color: #fff;
}

/* ─── Instrução ────────────────────────────────────────────────── */

.instrucao {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.instrucao.show {
    opacity: 1;
}

/* ─── Painel de Ações (Direito) ─────────────────────────────────── */

.simulador-acoes {
    width: 260px;
    background: #fff;
    border-left: 1px solid #e0e0e0;
    padding: 20px;
    overflow-y: auto;
    flex-shrink: 0;
}

.acoes-box h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: #5D3A1A;
}

.resumo-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.resumo-item span {
    color: #888;
}

.resumo-item.total {
    font-size: 1.1rem;
    font-weight: 700;
    color: #5D3A1A;
}

.acoes-box hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 12px 0;
}

.btn-adicionar-carrinho {
    width: 100%;
    padding: 14px;
    background: #C17A3A;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 16px;
    transition: background 0.2s;
}

.btn-adicionar-carrinho:hover {
    background: #5D3A1A;
}

/* ─── Scrollbar ────────────────────────────────────────────────── */

.simulador-menu::-webkit-scrollbar,
.simulador-acoes::-webkit-scrollbar {
    width: 6px;
}

.simulador-menu::-webkit-scrollbar-thumb,
.simulador-acoes::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* ─── Responsivo ───────────────────────────────────────────────── */

@media (max-width: 900px) {
    .simulador-container {
        flex-direction: column;
        height: auto;
    }

    .simulador-menu,
    .simulador-acoes {
        width: 100%;
        max-height: 300px;
    }

    .simulador-palco {
        min-height: 500px;
    }

    .palco {
        width: 90%;
        max-width: 400px;
        height: 400px;
    }
}

/* Catálogo real: a foto e a máscara compartilham exatamente a mesma área. */
#foto-uniforme, .foto-real, .cor-real { position:absolute; inset:0; width:100%; height:100%; }
.foto-real, .cor-real { object-fit:contain; pointer-events:none; }
.cor-real[hidden] { display:none; }
#box-produtos label { display:block; margin:8px 0 4px; font-size:13px; }
#buscar-uniforme, #categoria-uniforme { width:100%; padding:9px; border:1px solid #ccc; border-radius:6px; }
#lista-uniformes { max-height:360px; overflow:auto; margin-top:12px; }
.opcao-uniforme { display:flex; gap:10px; align-items:center; width:100%; text-align:left; padding:8px; background:white; border:1px solid #ddd; border-radius:5px; margin-bottom:6px; cursor:pointer; font-size:12px; }
.opcao-uniforme[aria-pressed=true] { border:2px solid #5D3A1A; }
.opcao-uniforme img { width:45px; height:55px; object-fit:contain; }
#menu_cores .cor-produto { aspect-ratio:auto; min-width:0; display:flex; align-items:center; gap:8px; width:100%; height:auto; min-height:36px; border-radius:5px; text-align:left; padding:6px 8px; background:white; color:#333; font-size:12px; }
#menu_cores .cor-produto::before { content:''; display:block; width:20px; height:20px; flex-shrink:0; border:1px solid #999; border-radius:50%; background:var(--amostra-cor); }
#menu_cores { grid-template-columns:repeat(2,minmax(0,1fr)); grid-auto-rows:auto; align-items:start; max-height:290px; overflow:auto; padding:4px; }
#menu_cores .cor-produto:hover { transform:none; }
.angulo:disabled { opacity:.55; cursor:default; font:inherit; border:0; }
.simulador-container { min-height:650px; }
@media (max-width:900px) { #lista-uniformes { max-height:170px; } .simulador-menu, .simulador-acoes { max-height:none; } }

#buscar-cor { width:100%;padding:9px;box-sizing:border-box;margin-bottom:8px; }
#menu_cores .cor-produto::before {background-image:var(--amostra-imagem,none);background-size:cover;}
#menu_cores .cor-produto[hidden] {display:none;}

/* A paleta fica abaixo da foto e mantém a posição durante a troca de cor. */
.simulador-palco {
    gap: 8px;
    padding: 12px 0;
    justify-content: flex-start;
}

.simulador-palco .palco {
    width: 90%;
    max-width: 500px;
    height: clamp(220px, calc(100svh - 500px), 400px);
    flex-shrink: 0;
}

.simulador-palco .angulos {
    position: static;
    transform: none;
    margin-bottom: 0;
    flex-shrink: 0;
}

.cores-junto-foto {
    width: 90%;
    max-width: 500px;
    flex-shrink: 0;
    background: white;
    border-radius: 8px;
}

.cores-junto-foto .menu-lateral {
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: white;
}

.cores-junto-foto label {
    display: block;
    font-size: 13px;
}

.cores-junto-foto #menu_cores {
    max-height: 112px;
    overscroll-behavior-y: contain;
}

.cores-junto-foto #menu_cores .cor-produto {
    min-height: 44px;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .simulador-palco {
        order: -1;
        min-height: 0;
    }

    .simulador-palco .palco {
        flex: none;
        height: min(320px, 40svh);
    }

    .simulador-palco .angulo {
        padding: 8px 12px;
    }

    .cores-junto-foto {
        max-width: 400px;
    }
}
