:root {
    --selected-color: #3b82f6;
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #111827;
    color: #f3f4f6;
    overflow-x: hidden;
}

/* Responsividade: Divide ao meio no PC, empilha no Mobile */
@media (min-width: 768px) {
    body {
        flex-direction: row;
    }
    .preview-section, .control-section {
        width: 50vw;
        height: 100vh;
    }
}

/* Metade Superior / Esquerda: Visualizador da Cor */
.preview-section {
    flex: 1;
    background-color: var(--selected-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 40vh;
    transition: background-color 0.1s ease;
}
.main-action-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.4);
    padding: 16px 32px;
    border-radius: 50px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    transition: transform 0.2s, background 0.2s;
}
.main-action-btn:active {
    transform: scale(0.95);
}
#image-fallback {
    display: none;
}

/* Metade Inferior / Direita: Painel de Controle e Cópia */
.control-section {
    flex: 1.2;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    background-color: #111827;
}

/* Sliders de Ajuste Grosso para o Polegar */
.sliders-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.slider-group {
    display: flex;
    align-items: center;
    gap: 12px;
}
.slider-group span {
    width: 24px;
    font-weight: bold;
    font-size: 1.1rem;
}
input[type="range"] {
    flex: 1;
    height: 12px;
    border-radius: 6px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background: #374151;
}
input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* No celular, mantém o comportamento original de empilhar um abaixo do outro */
.formats-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Comportamento responsivo para computadores e telas maiores que 768px */
@media (min-width: 768px) {
    /* Transforma o container em duas colunas perfeitas de 50% de largura descontando o espaçamento (gap) */
    .formats-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    /* Garante que o painel da direita ocupe a tela inteira sem scroll */
    .control-section {
        justify-content: space-between;
        height: 100vh;
        overflow: hidden; /* Corta a rolagem indesejada no computador */
    }
}
.format-row {
    background: #1f2937;
    padding: 16px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border: 1px solid #374151;
    position: relative;
    overflow: hidden;
    transition: background 0.2s;
}
.format-row:active {
    background: #374151;
}
.format-label {
    font-size: 0.85rem;
    color: #9ca3af;
    text-transform: uppercase;
    font-weight: bold;
}
.format-value {
    font-size: 1.2rem;
    font-family: monospace;
    color: #fff;
}

/* Pequeno balão de aviso "Copiado!" */
.toast {
    position: absolute;
    right: 16px;
    background: #10b981;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s ease;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}
/* ==========================================================================
   ESTILOS RESERVADOS PARA O GOOGLE ADSENSE (CORRIGIDO)
   ========================================================================== */

.adsense-wrapper {
    background-color: #1f2937;
    border: 1px dashed #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 90px;
    max-height: 90px; /* Trava a altura para não crescer desordenadamente */
    overflow: hidden;
    border-radius: 8px;
    position: relative;
    width: 100%;
}

.adsense-wrapper::before {
    content: "ANÚNCIO";
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 0.6rem;
    color: #4b5563;
    letter-spacing: 1px;
}

/* No celular, esconde o anúncio do topo para focar nos controles */
.ads-top {
    display: none;
}

/* No celular, fixa o anúncio na base da tela */
.ads-bottom-sticky {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    z-index: 999;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    background-color: #0f172a;
}

body {
    padding-bottom: 95px; 
}

/* Ajustes específicos e limpos para o Computador */
@media (min-width: 768px) {
    .ads-top {
        display: flex;
    }
    
    /* Remove a fixação do rodapé para que ele vire um bloco comum dentro do painel direito */
    .ads-bottom-sticky {
        position: relative;
        bottom: auto;
        left: auto;
        width: 100%;
        border-radius: 8px;
        border: 1px dashed #374151;
        background-color: #1f2937;
    }
    
    body {
        padding-bottom: 0;
    }

    /* Garante que o painel direito distribua bem os blocos sem criar espaços vazios gigantes */
    .control-section {
        justify-content: space-between;
        height: 100vh;
        overflow-y: auto;
    }
}
.permission-hint {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 8px;
    font-weight: 400;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
/* Esconde o aviso no celular já que ele não usa a lupa de tela */
@media (max-width: 767px) {
    .permission-hint { display: none; }
}
/* Alinha o título do formato e a dica lado a lado */
.format-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

/* Estilização da dica discreta "Click to copy" */
.click-hint {
    font-size: 0.7rem;
    color: #6b7280; /* Um tom cinza mais escuro/sutil */
    text-transform: none;
    font-weight: normal;
    opacity: 0.8;
}

/* Efeito sutil: quando o usuário passa o mouse na linha, o "Click to copy" ganha um leve destaque */
.format-row:hover .click-hint {
    color: #9ca3af;
}

/* ==========================================================================
   COLOR HISTORY RECENT BLOCK (CORRIGIDO)
   ========================================================================== */
.history-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #111827; /* ALTERADO: Agora usa o mesmo azul escuro do fundo da tela */
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #374151; /* ALTERADO: Contorno fino de 1px no azul acinzentado mais claro */
}

.history-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-title {
    font-size: 0.8rem;
    color: #9ca3af;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.clear-history-btn {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.2s;
}

.clear-history-btn:hover {
    color: #ef4444;
}

.history-swatches {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    min-height: 46px;
    /* CORREÇÃO DO CORTE: Adiciona margem de segurança interna para o crescimento do círculo */
    padding: 4px 6px; 
    margin-left: -6px;
    margin-right: -6px;
}

/* Esconde a barra de rolagem horizontal feia no Windows para manter o visual limpo */
.history-swatches::-webkit-scrollbar {
    display: none;
}

/* Estilo do círculo do histórico */
.history-item {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.15);
    position: relative;
    /* Transição suave tanto para o tamanho quanto para a borda */
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s;
}

/* Rollover: O círculo cresce perfeitamente sem cortes nas bordas ou nas laterais */
.history-item:hover {
    transform: scale(1.15);
    border-color: rgba(255,255,255,0.8);
    z-index: 10; /* Garante que o círculo fique por cima se houver sobreposição */
}

/* Ícone sutil de prancheta centralizado */
.history-item::after {
    content: "📋";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 0.7rem;
    transition: transform 0.15s;
    pointer-events: none;
}

.history-item:hover::after {
    transform: translate(-50%, -50%) scale(1);
}

/* ==========================================================================
   PRIVACY POLICY MODAL STYLES
   ========================================================================== */
.privacy-footer-link {
    text-align: center;
    padding: 0;
    font-size: 0.75rem;
}
.privacy-footer-link a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s;
}
.privacy-footer-link a:hover {
    color: #9ca3af;
}

/* Fundo escurecido que cobre a tela inteira */
.modal-overlay {
    display: none; /* Começa escondido */
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
/* Caixa branca/escura com o texto */
.modal-content {
    background: #1f2937;
    border: 1px solid #374151;
    color: #f3f4f6;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}
.modal-content h2 { margin-bottom: 16px; font-size: 1.5rem; color: #fff; }
.modal-content h3 { margin: 20px 0 8px 0; font-size: 1.1rem; color: #3b82f6; }
.modal-content p { font-size: 0.9rem; line-height: 1.6; color: #9ca3af; margin-bottom: 12px; }
.modal-content a { color: #3b82f6; }

/* Botão de fechar (X) */
.modal-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none; border: none;
    color: #9ca3af; font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.2s;
}
.modal-close:hover { color: #fff; }

/* Classe utilitária para ativar o modal via JavaScript */
.modal-overlay.active {
    display: flex;
}
