/* assets/css/core.css */

:root {
    --primary-color: #3b82f6;
    --secondary-color: #1d4ed8;
    --accent-color: #10b981;
    
    /* Paleta Dark Nativa */
    --bg-body: #020617;
    --bg-header: rgba(15, 23, 42, 0.8);
    --bg-footer: #020617;
    --bg-card: rgba(30, 41, 59, 0.4);
    
    --text-main: #f1f5f9;
    --text-header: #f1f5f9;
    --text-footer: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    
    --max-app-width: 100%;
    --header-height: 64px;
    --border-radius: 12px;
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg-body);
    color: var(--text-main);    
    margin: 0;
    font-family: 'Inter', -apple-system, sans-serif; /* Unifiquei a fonte */
    /* Removemos o display:flex centralizado do body para permitir layouts full-width como o Tailwind */
}

/* O Container Principal */
#app-shell {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header Dinâmico --- */
.app-header {
    height: var(--header-height);
    background-color: var(--bg-header); /* AGORA É VARIÁVEL */
    backdrop-filter: blur(8px);         /* Efeito vidro */
    border-bottom: 1px solid var(--border-color); /* Borda dinâmica */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: fixed; /* Header fixo no topo */
    top: 0; left: 0; right: 0;
    z-index: 50;
    transition: all 0.3s ease;
}

/* Estado oculto do header (Smart Header) */
.app-header.header-hidden {
    transform: translateY(-100%);
}

.brand-logo {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: -1px;
}

.menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-header); /* AGORA É VARIÁVEL */
}

/* Container Injetado pelo Core (Shell) */
#app-main {
    flex: 1;
    padding-top: var(--header-height);
    padding-bottom: 100px;
    width: 100%;
}

#tool-content {
    width: 100%;
}

/* --- Footer Dinâmico --- */
.app-footer {
    background-color: var(--bg-footer);
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-footer);
    border-top: 1px solid var(--border-color);
}

.app-footer a {
    color: var(--text-footer);
    opacity: 0.8;
}

/* --- Menu Lateral (Drawer) --- */
.side-drawer {
    /* Mantivemos escuro pois é padrão de navegação, mas pode ser variável se quiser */
    position: fixed; top: 0; left: -100%; width: 80%; max-width: 300px; height: 100%;
    background-color: #0f172a; 
    color: white; transition: 0.3s ease; z-index: 200; padding: 2rem 1.5rem;
    box-shadow: 4px 0 15px rgba(0,0,0,0.3);
}
.side-drawer.open { left: 0; }
.drawer-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 150; display: none;
    backdrop-filter: blur(2px);
}
.drawer-overlay.open { display: block; }
.drawer-nav a {
    display: block; color: #cbd5e1; text-decoration: none; padding: 1rem 0;
    border-bottom: 1px solid #1e293b; font-size: 1.1rem;
}

/* --- ADIÇÕES PARA BARRA FLUTUANTE E NAVEGAÇÃO --- */

/* Barra de Ações Flutuante (Glassmorphism) */
.frii-action-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: rgba(15, 23, 42, 0.6); /* Escuro translúcido */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px; /* Pílula */
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.5s ease-out;
}

.frii-action-btn {
    background: none;
    border: none;
    color: #e2e8f0;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.7;
}

.frii-action-btn:hover, .frii-action-btn.active {
    opacity: 1;
    color: var(--accent-color);
    transform: translateY(-2px);
}

.frii-action-btn svg {
    width: 20px;
    height: 20px;
}

/* Divisor vertical na barra */
.frii-bar-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.1);
}

/* Botão Voltar no Header */
.nav-back-btn {
    display: flex;
    align-items: center;
    color: var(--text-header);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.2s;
    margin-right: 1rem;
}
.nav-back-btn:hover { opacity: 1; }

@keyframes slideUp {
    from { transform: translate(-50%, 100%); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

/* Toast Notification (Aviso de "Link Copiado") */
.frii-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #10b981;
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 200;
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}
.frii-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(10px);
}

/* --- CARDS DE INPUT --- */
.frii-input-container {
    background-color: rgba(30, 41, 59, 0.4); /* slate-800/40 */
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1.5rem;
}

/* Card de Resultado (A Recompensa/Ticket Style - Regra 3.9) */
.frii-result-ticket {
    background-color: #f8fafc; /* slate-50 */
    color: #0f172a; /* slate-900 */
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    border-top: 4px solid #3b82f6; /* Accent Blue */
}

/* Estética de "Recibo" (Borda serrilhada opcional no fundo) */
.frii-result-ticket::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 10px;
    background-image: linear-gradient(135deg, #f8fafc 25%, transparent 25%), 
                      linear-gradient(225deg, #f8fafc 25%, transparent 25%);
    background-size: 10px 10px;
}

/* Botão de Preset (Chips de Atalho) */
.frii-preset-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    justify-content: flex-end;
}

.frii-preset-btn {
    font-size: 10px;
    font-weight: 700;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.frii-preset-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.frii-preset-btn:active {
    transform: scale(0.95);
}

.frii-input-pop {
    background-color: rgba(30, 41, 59, 1); /* Slate-800 Solid */
    border: 2px solid rgba(255, 255, 255, 0.05);
    color: white;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.frii-input-pop:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1); /* Anel de foco sutil */
}

/* --- COMPONENTE GLOBAL: INFO POPOVER (TOOLTIP) --- */
/* Centralizado no Core para reutilização em todas as ferramentas */

.info-wrapper { 
    position: relative; 
    display: inline-flex; 
    align-items: center;
    z-index: 10;
}

/* Ícone "i" */
.info-btn {
    /* Aparência padrão resetada */
    appearance: none; border: none; outline: none; cursor: pointer;
    /* Estilo Visual */
    width: 1rem; height: 1rem;
    border-radius: 9999px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.6rem; 
    font-family: serif; font-style: italic;
    background-color: rgba(255,255,255,0.1);
    color: #94a3b8;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.2s;
}

.info-btn:hover, .info-wrapper.active .info-btn {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: rgba(59, 130, 246, 0.1);
}

/* O Balão de Texto */
.info-popover {
    display: none; /* Oculto por padrão */
    position: absolute;
    bottom: 150%; /* Acima do ícone */
    left: 50%;
    transform: translateX(-50%);
    width: 240px; /* Largura padrão confortável */
    
    background-color: #1e293b; /* Slate-800 */
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    
    z-index: 500; /* Alta prioridade */
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.5);
    
    font-size: 0.75rem;
    line-height: 1.4;
    color: #e2e8f0;
    font-weight: 400;
    text-align: left;
    text-transform: none; /* Previne herança de uppercase de labels */
    pointer-events: none; /* Permite clicar através dele se necessário */
}

/* Setinha do Balão */
.info-popover::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
}

/* Lógica de Exibição (Hover Desktop + Classe .active Mobile) */
.info-wrapper:hover .info-popover, 
.info-wrapper.active .info-popover { 
    display: block; 
    animation: fadeInTooltip 0.2s ease-out; 
}

/* Eleva o z-index do wrapper pai quando ativo para evitar clipping */
.info-wrapper:hover, .info-wrapper.active {
    z-index: 50; 
}

@keyframes fadeInTooltip { 
    from { opacity: 0; transform: translateX(-50%) translateY(5px); } 
    to { opacity: 1; transform: translateX(-50%) translateY(0); } 
}

/* Estilização de Labels dentro do Ticket para manter contraste */
.frii-result-ticket label, 
.frii-result-ticket .label-text {
    color: #64748b; /* slate-500 */
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

/* --- FRII EDUCATION SYSTEM (Conteúdo de Apoio Padrão) --- */

.frii-edu-section {
    margin-top: 5rem;
    padding-top: 4rem;
    border-top: 1px solid var(--border-color);
    position: relative;
    padding-bottom: 4rem;
}

/* Título da Seção (SEO H2) */
.frii-edu-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 3rem auto;
}

.frii-edu-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.frii-edu-subtitle {
    font-size: 1rem;
    color: var(--text-footer); /* Usa a cor secundária do tema */
    line-height: 1.6;
}

/* Grid de Cards */
.frii-edu-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
}
@media (min-width: 768px) {
    .frii-edu-grid { grid-template-columns: repeat(2, 1fr); }
}

/* O Card Padrão (Glassmorphism) */
.frii-card {
    background: var(--bg-header); /* Usa o fundo translúcido do tema */
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    height: 100%; /* Garante altura igual no grid */
    display: flex;
    flex-direction: column;
}

/* Hover Effect: Usa a cor primária da ferramenta para o brilho */
.frii-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

/* Ícone do Card */
.frii-icon-box {
    width: 3rem; height: 3rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    transition: background 0.3s, color 0.3s;
}

/* Ao passar o mouse no card, o ícone acende com a cor da ferramenta */
.frii-card:hover .frii-icon-box {
    background: var(--primary-color);
    color: white; /* Contraste forçado para garantir leitura */
    border-color: var(--primary-color);
}

/* Tipografia do Card */
.frii-card-title {
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.frii-card-text {
    color: var(--text-footer);
    font-size: 0.95rem;
    line-height: 1.6;
    flex-grow: 1;
}

/* Listas dentro dos cards */
.frii-card-list {
    padding-left: 1.2rem;
    margin-top: 0.5rem;
    list-style-type: disc;
}
.frii-card-list li {
    margin-bottom: 0.5rem;
}

/* Box de Destaque (Geralmente centralizado abaixo do grid) */
.frii-highlight-box {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
}

/* --- OVERRIDES & PATCHES --- */

.frii-card, 
.glass-panel,
.overflow-fix {
    overflow: visible !important;
}

/* --- MODAL DE EDIÇÃO (Substitui Prompt) --- */
.frii-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(4px);
    z-index: 100; display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.frii-modal-overlay.open { opacity: 1; pointer-events: auto; }

.frii-modal-card {
    background: #1e293b; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px; padding: 24px; width: 90%; max-width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); transform: translateY(20px); transition: transform 0.2s;
}
.frii-modal-overlay.open .frii-modal-card { transform: translateY(0); }

/* --- MENU DE AÇÕES MOBILE (Context Menu) --- */
.frii-context-menu {
    position: fixed; background: #1e293b; border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px; padding: 0; /* Padding removido para controle interno */
    z-index: 999; 
    box-shadow: 0 20px 40px -5px rgba(0,0,0,0.6);
    display: flex; flex-direction: column; 
    min-width: 180px; overflow: hidden; /* Garante bordas arredondadas */
    animation: fadeInMenu 0.1s ease-out;
}
.frii-context-menu.open { display: flex; animation: fadeIn 0.1s ease-out; }
.frii-context-btn {
    text-align: left; padding: 8px 12px; font-size: 12px; color: #cbd5e1;
    border-radius: 6px; transition: background 0.2s; background: transparent; border: none;
}
.frii-context-btn:hover { background: rgba(255,255,255,0.1); color: white; }

/* --- PADRÃO UI: CLEAR BUTTON (X) --- */
.frii-clear-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.5rem;
    color: #475569;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
}

.frii-clear-btn:hover {
    color: var(--primary-color);
    transform: translateY(-50%) scale(1.1);
}

.frii-clear-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Ajuste para Textareas (Topo direita) */
.frii-clear-btn.textarea-pos {
    top: 0.5rem;
    transform: none;
}
.frii-clear-btn.textarea-pos:hover {
    transform: scale(1.1);
}