@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

/* ═══════════════════════════════════════════
   DESIGN TOKENS — FUNNELLUX OS
═══════════════════════════════════════════ */
:root {
  --brand-orange: #FF4500;
  --brand-orange-dim: rgba(255,69,0,0.12);
  --brand-orange-mid: rgba(255,69,0,0.25);
  --neon: var(--brand-orange); /* Aliased to brand for backwards compatibility with base styles */
  --neon-dim: var(--brand-orange-dim);
  --neon-mid: var(--brand-orange-mid);
  --danger: #FF3B30;
  --danger-dim: rgba(255,59,48,0.10);
  --gold: #FFD60A;
  --gold-dim: rgba(255,214,10,0.10);
  --success: #34C759;
  --success-dim: rgba(52,199,89,0.10);
  
  --surface: #0E1419;
  --surface2: #141C24;
  --border: rgba(255,255,255,0.06);
  --border-neon: var(--brand-orange-mid);
  --text-pri: #E8EDF2;
  --text-sec: #6B7885;
  --text-ter: #3D4A55;
  --bg: #050505; /* Blacker background for the orange contrast */
  --radius: 10px;

  /* Aliases legados (manter compatibilidade com dashboard) */
  --app-bg: var(--bg);
  --sub-bg: var(--bg);
  --card-bg: var(--surface);
  --glass-bg: var(--surface2);
  --glass-border: var(--border);
  --primary: var(--neon);
  --glow-neon: var(--neon-mid);
  --red: var(--danger);
  --red-glow: var(--danger-dim);
  --white: #E8EDF2;
}

/* ═══════════════════════════════════════════
   BASE RESET
═══════════════════════════════════════════ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Space Grotesk', sans-serif;
  background-color: var(--bg);
  color: var(--text-pri);
  width: 100vw;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  position: relative;
}

/* ═══════════════════════════════════════════
   LOGIN OVERLAY (SECURITY)
═══════════════════════════════════════════ */
.login-overlay { 
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; 
  background: var(--bg); z-index: 100000; display: flex; 
  align-items: center; justify-content: center; 
  transition: opacity 0.6s ease-out, transform 0.6s ease-in-out; 
}
.login-overlay::before { 
  content: ''; position: absolute; width: 100vw; height: 100vh; 
  background: radial-gradient(circle at center, rgba(42,236,158,0.08) 0%, transparent 60%); 
  pointer-events: none; z-index: 0; 
}
.login-overlay.authenticated { opacity: 0; transform: translateY(-20px); pointer-events: none; visibility: hidden; }

.login-card { 
  background: var(--surface2); padding: 50px 40px; border-radius: var(--radius); 
  border: 1px solid var(--border-neon); box-shadow: 0 0 50px rgba(42,236,158,0.08); 
  display: flex; flex-direction: column; align-items: center; text-align: center; 
  width: 90%; max-width: 380px; position: relative; z-index: 1; 
}

.login-input { 
  background: rgba(0,0,0,0.5); border: 1px solid var(--border); 
  border-radius: 6px; padding: 12px 15px; color: var(--text-pri); 
  font-family: 'DM Mono', monospace; font-size: 14px; text-align: center; 
  outline: none; transition: 0.3s; width: 100%; letter-spacing: 2px;
}
.login-input:focus { border-color: var(--neon); box-shadow: 0 0 10px rgba(42,236,158,0.2); }


/* ═══════════════════════════════════════════
   EFEITOS DE FUNDO
═══════════════════════════════════════════ */
.ambient-glow {
  position: fixed; top: -10%; left: 50%; transform: translateX(-50%);
  width: 150vw; height: 120vh;
  background: radial-gradient(ellipse at center top, rgba(42,236,158,0.04) 0%, rgba(42,236,158,0.01) 40%, transparent 70%);
  pointer-events: none; z-index: 0;
}

/* ═══════════════════════════════════════════
   LAYOUT PRINCIPAL
═══════════════════════════════════════════ */
.layout-wrapper {
  display: flex; flex-direction: column;
  width: 100%; min-height: 100vh;
  max-width: 1100px; padding: 1.5vh 3vw;
  position: relative; z-index: 2;
}

/* ═══════════════════════════════════════════
   HEADER
═══════════════════════════════════════════ */
.main-header {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; margin-bottom: 2vh; flex-shrink: 0;
  border-bottom: 2px solid var(--brand-orange); 
  padding-bottom: 25px; padding-top: 15px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem; font-weight: 700;
  color: var(--text-pri); letter-spacing: 3px;
}

.brand-badge {
  font-family: 'DM Mono', monospace;
  font-size: 9px; font-weight: 500;
  padding: 3px 8px; border-radius: 3px;
  background: var(--neon-dim);
  color: var(--neon);
  border: 1px solid var(--border-neon);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.action-container { display: flex; align-items: center; }

.btn-dashboard {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  letter-spacing: 0.5px;
}

.outline-btn {
  background: transparent; color: var(--text-pri);
  border: 1px solid var(--border);
}

.outline-btn:hover { background: rgba(255,255,255,0.05); transform: translateY(-1px); }

/* ═══════════════════════════════════════════
   HERO TITLES
═══════════════════════════════════════════ */
.hero-titles { text-align: left; margin-bottom: 18px; flex-shrink: 0; }

.page-title {
  font-size: 1.6rem; font-weight: 700;
  color: var(--text-pri); margin-bottom: 4px; letter-spacing: -0.5px;
}

.page-sub {
  font-size: 0.95rem; color: var(--text-sec);
  margin-bottom: 8px; font-weight: 400;
}

.status-indicator { display: flex; align-items: center; gap: 8px; font-family: 'DM Mono', monospace; font-size: 10px; }
.status-text-anim { color: var(--neon); text-transform: uppercase; letter-spacing: 1px; font-weight: 500; }
.pulsing-dot-neon { width: 6px; height: 6px; border-radius: 50%; background: var(--neon); animation: pulse-dot 2s ease-in-out infinite; }

@keyframes pulse-dot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.8); } }

/* ═══════════════════════════════════════════
   CONTENT GRID
═══════════════════════════════════════════ */
.content-wrapper {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

.calc-grid-simple {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 4vw; height: 100%; align-items: start;
}

.inputs-section { width: 100%; display: flex; flex-direction: column; position: relative;}
/* Linha vertical separadora das colunas - sutil */
.inputs-section::after {
  content: ''; position: absolute; right: -2.5vw; top: 0; bottom: 0; width: 1px; background: var(--border);
}

.results-section { width: 100%; display: flex; flex-direction: column; }

/* ═══════════════════════════════════════════
   PANEL LABEL
═══════════════════════════════════════════ */
.panel-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px; letter-spacing: 2px;
  color: var(--text-ter); text-transform: uppercase;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.panel-label .line { flex: 1; height: 1px; background: var(--border); }
.label-neon { color: var(--neon); }

/* ═══════════════════════════════════════════
   INPUTS
═══════════════════════════════════════════ */
.input-grid { display: flex; flex-direction: column; gap: 12px; }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.input-group { display: flex; flex-direction: column; gap: 4px; }

.input-group label {
  font-size: 11px; font-weight: 500;
  color: var(--text-sec); letter-spacing: 0.2px;
}

.input-group input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-pri);
  font-family: 'DM Mono', monospace;
  font-size: 13px; font-weight: 500;
  outline: none; transition: border-color 0.15s; width: 100%;
}

.input-group input:focus { border-color: var(--border-neon); box-shadow: none; }

.input-neon {
  border-color: rgba(42,236,158,0.15) !important;
  color: var(--neon) !important;
  background: rgba(42,236,158,0.03) !important;
}

/* ═══════════════════════════════════════════
   CARDS DE RESULTADO
═══════════════════════════════════════════ */
.resultados-list {
  display: flex; flex-direction: column; gap: 10px;
}

.card-saas {
  padding: 12px 16px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: center;
}

.saas-card-title {
  font-size: 10px; font-family: 'Space Grotesk', sans-serif;
  color: var(--brand-orange); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 4px;
}
.d-flex { display: flex; align-items: center; }
.justify-between { justify-content: space-between; }

.saas-card-value {
  font-family: 'DM Mono', monospace;
  font-size: 1.5rem; font-weight: 500;
  line-height: 1.1; margin: 2px 0;
}

.saas-card-sub {
  font-size: 10.5px; color: var(--text-sec); font-weight: 400; margin-top: 2px;
}

/* Card 1 — Receita Atual (Ouro/Amarelo) */
.card-1 {
  background: var(--gold-dim) !important;
  border: 1px solid rgba(255,214,10,0.3);
}
.text-c1 { color: #FFFFFF; }

/* Card 2 — Projetado (Verde) */
.card-2 {
  border: 1px solid var(--success);
  background: var(--success-dim) !important;
}
.text-c2 { color: #FFFFFF; }
.badge-perc { background: var(--success-dim); color: var(--success); font-family: 'DM Mono', monospace; font-size: 10px; font-weight: 500; padding: 3px 8px; border-radius: 4px; border: 1px solid var(--success); }

/* Card 3 — Falha (Vermelho) */
.card-3 {
  border: 1px solid rgba(255,59,48,0.3);
  background: var(--danger-dim) !important;
}
.text-c3 { color: #FFFFFF; }

/* Card 4 — Anualizado (Verde Forte) */
.card-4 {
  border: 1px solid var(--success);
  background: var(--success) !important;
}
.text-c4 { color: #FFFFFF; }
.text-c4-sub { color: rgba(255,255,255,0.65) !important; }

.font-mono { font-family: 'DM Mono', monospace !important; }
.text-neon { color: var(--neon); }

/* ═══════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════ */
.simple-footer {
  padding: 10px 0 0 0; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  margin-top: auto; flex-shrink: 0;
}

.footer-left { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text-ter); letter-spacing: 0.5px; }
.footer-right { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text-sec); }

/* ═══════════════════════════════════════════
   ANIMAÇÃO DE VALOR ATUALIZADO
═══════════════════════════════════════════ */
@keyframes valueFlash { 0% { opacity: 0.4; } 100% { opacity: 1; } }
.value-updated { animation: valueFlash 0.3s ease-out; }

/* ═══════════════════════════════════════════
   COMPREHENSIVE FOOTER
═══════════════════════════════════════════ */
.comprehensive-footer { background: rgba(5,5,5,0.8); border-top: 1px solid var(--border); padding: 70px 5vw; margin-top: 60px; position: relative; overflow: hidden; }
.comprehensive-footer::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 60%; height: 1px; background: linear-gradient(90deg, transparent, var(--brand-orange), transparent); opacity: 0.5; }
.footer-container { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 5vw; max-width: 1300px; margin: 0 auto; position: relative; z-index: 1; }
.footer-desc { color: var(--text-sec); font-size: 0.9rem; line-height: 1.6; margin-bottom: 20px; max-width: 350px; }
.footer-copyright { color: var(--text-ter); font-size: 0.8rem; letter-spacing: 0.5px; font-family: 'Space Grotesk'; line-height: 1.5; }
.footer-title { color: var(--text-pri); font-size: 0.9rem; font-family: 'Space Grotesk'; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 25px; border-bottom: 1px solid rgba(255,69,0,0.3); padding-bottom: 10px; display: inline-block; }
.footer-links-col { display: flex; flex-direction: column; gap: 12px; }
.footer-link { color: var(--text-sec); text-decoration: none; font-size: 0.9rem; transition: 0.3s; display: block; position: relative; width: fit-content; }
.footer-link:hover { color: var(--brand-orange); transform: translateX(6px); }
.footer-email { color: var(--neon); text-decoration: none; font-family: 'DM Mono'; font-size: 0.9rem; letter-spacing: 1px; transition: 0.3s; display: inline-block; padding: 10px 15px; background: rgba(42,236,158,0.05); border: 1px solid rgba(42,236,158,0.2); border-radius: 8px; font-weight: 500; }
.footer-email:hover { background: rgba(42,236,158,0.1); box-shadow: 0 0 15px rgba(42,236,158,0.2); transform: translateY(-2px); }
.social-links-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.social-btn { background: rgba(255,255,255,0.02); border: 1px solid var(--border); color: var(--text-sec); padding: 8px 16px; border-radius: 6px; text-decoration: none; font-size: 0.75rem; font-family: 'Space Grotesk'; text-transform: uppercase; transition: 0.3s; letter-spacing: 1px; font-weight: 600; }
.social-btn:hover { background: var(--brand-orange); color: #000; border-color: var(--brand-orange); box-shadow: 0 0 15px rgba(255,69,0,0.3); transform: translateY(-2px); }

/* ═══════════════════════════════════════════
   DASHBOARD MODAL & COPILOT
═══════════════════════════════════════════ */
.dashboard-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: var(--bg); z-index: 9999; display: flex; align-items: center; justify-content: center; transition: opacity 0.4s; }
.dashboard-overlay.hidden { opacity: 0; pointer-events: none; visibility: hidden; }

.dashboard-apex { width: 100vw; height: 100vh; max-width: 1500px; background: transparent; display: flex; flex-direction: column; overflow: hidden; position: relative; animation: pop 0.3s ease-out; padding: 2.5vh 3vw;}
.dashboard-apex::before { content: ''; position: absolute; width: 100%; height: 100%; top: -20%; background: radial-gradient(circle at 50% 0%, rgba(42,236,158,0.06), transparent 70%); pointer-events: none; z-index: 0; }
@keyframes pop { from { opacity: 0; } to { opacity: 1; } }

.apex-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 25px; padding-top: 10px; border-bottom: 2px solid var(--brand-orange); background: transparent; flex-shrink: 0; position: relative; z-index: 1; margin-bottom: 3vh; }
.brand-cluster { display: flex; align-items: center; gap: 15px; }

.dashboard-tabs { display: flex; gap: 0.5rem; background: rgba(255,255,255,0.03); padding: 0.4rem; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05); }
.dash-tab { background: transparent; color: var(--text-sec); border: 1px solid transparent; padding: 0.5rem 1.2rem; border-radius: 7px; font-weight: 600; font-family: 'Space Grotesk'; font-size: 0.82rem; cursor: pointer; transition: 0.2s; text-transform: uppercase; letter-spacing: 1px; }
.dash-tab:hover { color: var(--text-pri); background: rgba(255,255,255,0.04); }
.dash-tab.active { background: rgba(42,236,158,0.05); color: var(--neon); border: 1px solid var(--neon); box-shadow: 0 0 12px rgba(42,236,158,0.2) inset; }

.btn-close-dash { background: transparent; border: 1px solid var(--border); color: var(--text-pri); padding: 0.55rem 1.4rem; border-radius: 6px; font-weight: 500; cursor: pointer; transition: 0.2s; font-size: 0.78rem; letter-spacing: 0.5px; font-family: 'Space Grotesk'; }
.btn-close-dash:hover { background: rgba(255,255,255,0.05); transform: translateY(-1px); }

.apex-content { flex: 1; display: flex; flex-direction: column; gap: 3vh; overflow: hidden; position: relative; z-index: 1; }
.apex-4cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1vw; flex-shrink: 0; }

.apex-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2vw; flex: 1; min-height: 0; min-width: 0; transition: all 0.3s ease; }
.apex-box { display: flex; flex-direction: column; height: 100%; min-height: 0; min-width: 0; position: relative; padding-right: 2vw; }
/* Linha vertical divisória nas colunas dos gráficos */
.apex-box:not(:last-child)::after { content: ''; position: absolute; right: -1vw; top: 0; bottom: 0; width: 1px; background: var(--border); }
.chart-container { flex: 1; width: 100%; min-height: 0; min-width: 0; position: relative; padding-bottom: 2vh; }

/* =============== COPILOT UI DRAWER =============== */
.copilot-drawer { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: var(--bg); z-index: 10000; display: flex; flex-direction: column; transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.copilot-drawer.hidden { transform: translateX(100%); }
.copilot-header { padding: 1.5rem; border-bottom: 2px solid var(--brand-orange); display: flex; justify-content: space-between; align-items: center; }
.copilot-chat-area { flex: 1; padding: 2rem 5vw; overflow-y: auto; display: flex; flex-direction: column; gap: 0.2rem; background: rgba(0,0,0,0.15); width: 100%; }
.chat-message { padding: 0.6rem 1.1rem; border-radius: 16px; font-size: 0.92rem; line-height: 1.5; color: var(--text-pri); font-family: 'Space Grotesk'; max-width: 85%; position: relative; animation: fadeInChat 0.3s ease-out; margin-bottom: 0.2rem; white-space: pre-wrap; word-wrap: break-word; }
@keyframes fadeInChat { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.chat-message.bot { background: transparent; border: none; align-self: flex-start; padding-left: 0; color: rgba(232,237,242,0.95); font-weight: 400; }
.chat-message.user { background: var(--neon); color: #050505; align-self: flex-end; border-bottom-right-radius: 4px; font-weight: 600; box-shadow: 0 4px 14px rgba(42,236,158,0.2); margin-bottom: 1rem; margin-top: 0.5rem; }
.copilot-input-area { padding: 1.5rem 5vw 3rem 5vw; border-top: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; gap: 10px; width: 100%; }
#copilotInput { flex: 1; min-height: 60px; max-height: 120px; resize: none; background: rgba(3,3,3,0.8); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; padding: 0.8rem; color: var(--text-pri); font-family: 'Space Grotesk'; font-size: 0.85rem; outline: none; transition: 0.2s; }
#copilotInput:focus { border-color: var(--neon); }
.btn-send { background: var(--neon); border: none; color: #000; padding: 0 1.2rem; border-radius: 8px; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 14px rgba(42,236,158,0.25); }
.btn-send:hover { transform: scale(1.04); box-shadow: 0 0 22px rgba(42,236,158,0.4); }
.loading-dots:after { content: '.'; animation: dots 1.5s steps(5, end) infinite; }
@keyframes dots { 0%, 20% { color: rgba(0,0,0,0); text-shadow: .25em 0 0 rgba(0,0,0,0), .5em 0 0 rgba(0,0,0,0); } 40% { color: white; text-shadow: .25em 0 0 rgba(0,0,0,0), .5em 0 0 rgba(0,0,0,0); } 60% { text-shadow: .25em 0 0 white, .5em 0 0 rgba(0,0,0,0); } 80%, 100% { text-shadow: .25em 0 0 white, .5em 0 0 white; } }

@media (max-width: 1024px) {
  body { overflow: auto; height: auto; display: block; }
  .calc-grid-simple, .apex-grid-3, .apex-4cards { grid-template-columns: 1fr; max-height: none; }
  .inputs-section::after { display: none; }
  .layout-wrapper, .dashboard-apex { padding: 4vw; height: auto; margin-bottom: 2rem; max-width: 100%; }
  .dashboard-overlay { align-items: flex-start; overflow-y: auto; padding: 2vh 0; }
  .dashboard-apex { width: 100vw; height: auto; min-height: 100vh; overflow-y: visible; }
  .ambient-glow { display: none; }
  .main-header { flex-direction: column; gap: 1.5rem; text-align: center; }
  .apex-header { flex-direction: column; gap: 1.5rem; text-align: center; }
  .brand-cluster { justify-content: center; width: 100%; }
  .dashboard-tabs { flex-wrap: wrap; justify-content: center; }
  .btn-close-dash { width: 100%; padding: 1rem; }
  .action-container { flex-direction: column; width: 100%; }
  .action-container button { width: 100%; }
  .input-row { grid-template-columns: 1fr; }
  .saas-card-value { font-size: 1.5rem; }
  .apex-box { margin-bottom: 2rem; padding-right: 0; }
  .apex-box:not(:last-child)::after { display: none; }
  .chart-container { height: 350px; min-height: 350px; position: relative; width: 100%; flex: none; margin-top: 10px; }
  
  .footer-container { grid-template-columns: 1fr; gap: 50px; text-align: center; }
  .footer-title { margin: 0 auto 20px auto; display: block; width: fit-content; }
  .footer-desc { margin-left: auto; margin-right: auto; }
  .footer-link { margin: 0 auto; }
  .footer-link:hover { transform: translateY(-2px); }
  .footer-brand-col { display: flex; flex-direction: column; align-items: center; }
  .social-links-grid { justify-content: center; }
}
