/* ============================================================
   paletas.css
   CSS EXCLUSIVO

   Contém: a faixa de cor no topo da página (hero-strip), o
   grid de 5 cores (palette-row / swatch), o cadeado de travar
   cor, os controles de exportar código, e a área de upload de
   imagem com spinner de carregamento.
   ============================================================ */

/* ----------------------------------------------------------
   HERO-STRIP — faixa de cor full-bleed logo abaixo da topbar,
   mostra ao vivo a paleta atual (aleatória ou extraída de
   imagem). Lógica em js/paletas.js, função syncHeroStrip().
   ---------------------------------------------------------- */
.hero-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: 96px;
    width: 100%;
}

.hero-cell {
    background: var(--accent);
    transition: background-color 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (max-width: 520px) { .hero-strip { height: 64px; } }

/* ----------------------------------------------------------
   PALETTE-ROW / SWATCH — o grid de 5 blocos de cor, usado
   tanto no modo aleatório quanto no resultado da extração por
   imagem (dois <div class="palette-row"> diferentes no HTML,
   mesmo CSS pros dois)
   ---------------------------------------------------------- */
.palette-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    height: 180px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 14px;
}

#panel-image .palette-row { margin-top: 18px; }

/* no celular, quebra pra 2 colunas com altura fixa por linha
   em vez de dividir uma altura fixa entre 5 blocos espremidos */
@media (max-width: 560px) {
    .palette-row {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 110px;
        height: auto;
    }
}

/* cada bloco de cor clicável (clique = copia o hex) */
.swatch {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    cursor: pointer;
    border: none;
    padding: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.swatch:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
    z-index: 1;
}

.swatch:active { transform: translateY(-1px); }

/* botão de cadeado sobre cada cor (só aparece no modo
   aleatório — o resultado por imagem não tem cadeado) */
.swatch-lock {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    border-radius: 99px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.38);
    color: #FFFFFF;
    transition: 0.15s ease;
}

.swatch-lock:hover { background: rgba(0, 0, 0, 0.55); }
.swatch-lock.locked { background: rgba(0, 0, 0, 0.62); }

.swatch-lock svg {
    width: 14px;
    height: 14px;
}

/* código hex mostrado embaixo de cada cor, com ícone de copiar */
.swatch-hex-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 600;
    padding: 10px 0 14px;
    width: 100%;
    justify-content: center;
    letter-spacing: 0.02em;
}

.swatch-hex-row svg {
    width: 12px;
    height: 12px;
    opacity: 0.6;
}

/* balãozinho "copiado!" que aparece rapidamente ao clicar numa cor */
.swatch-copied {
    position: absolute;
    top: 44px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 10.5px;
    background: rgba(0, 0, 0, 0.6);
    color: #FFFFFF;
    padding: 3px 8px;
    border-radius: 99px;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.swatch-copied.show { opacity: 1; }

/* ----------------------------------------------------------
   BOTÕES DE AÇÃO DA PALETA — linha "Gerar paleta / Copiar
   tudo / Exportar código" abaixo do grid de cores
   ---------------------------------------------------------- */
.palette-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* dica "aperte espaço pra gerar de novo", só no modo aleatório */
.kbd-hint {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--muted);
    margin-left: auto;
}

.kbd-hint kbd {
    background: var(--paper-dim);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: var(--font-mono);
    font-size: 11px;
}

/* no celular, os botões continuam lado a lado numa única linha
   (só encolhem um pouco); a dica de atalho quebra pra linha de
   baixo, alinhada à esquerda em vez de empurrada pro canto */
   @media (max-width: 520px) {
    .palette-actions { gap: 8px; }

    .palette-actions .btn-primary,
    .palette-actions .btn-secondary {
        padding: 9px 12px;
        font-size: 12px;
    }

    .kbd-hint {
        flex: 1 1 100%;
        margin-left: 0;
        margin-top: 4px;
    }
}

/* ----------------------------------------------------------
   PREVIEW DA IMAGEM — aparece depois que a pessoa sobe uma
   imagem no modo "a partir de imagem", antes de clicar em
   "Gerar paleta desta imagem"
   ---------------------------------------------------------- */
.preview-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-top: 16px;
}

.preview-img {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--paper-dim);
    flex-shrink: 0;
}

.preview-info { flex: 1; }

.preview-name {
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 2px;
}

.preview-dims {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 12px;
}

/* link "trocar imagem", volta a mostrar a dropzone */
.change-img-link {
    font-size: 12.5px;
    color: var(--accent-ink);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-family: var(--font-body);
    margin-left: 10px;
}

/* spinner girando dentro do botão "Analisando…" durante a extração */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 99px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #FFFFFF;
    animation: spin 0.7s linear infinite;
    margin-right: 7px;
    vertical-align: -2px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ----------------------------------------------------------
   EXPORTAR CÓDIGO — bloco que abre ao clicar em "Exportar
   código", com abas CSS Variables / Tailwind Config
   ---------------------------------------------------------- */
.export-block {
    margin-top: 16px;
    display: none;
}

.export-block.show { display: block; }

.export-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.export-tabs button {
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--card-bg);
    color: var(--muted);
    cursor: pointer;
}

.export-tabs button.active {
    background: var(--paper-dim);
    color: var(--ink);
    border-color: var(--accent-soft-line);
}

.export-code {
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.7;
    background: var(--paper-dim);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
    white-space: pre;
    overflow-x: auto;
    color: var(--ink);
}