/* ==========================================================================
   1. IMPORTAÇÕES E VARIÁVEIS
   ========================================================================== */
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;500;700&display=swap");

:root {
  /* --- TEMA ESCURO (PADRÃO) --- */
  --bg-deep: #050505;
  --bg-gradient: radial-gradient(circle at 50% 0%, #1a0b2e 0%, #000000 80%);

  --console-bg: rgba(10, 10, 12, 0.7);
  --panel-left-bg: rgba(0, 0, 0, 0.4);
  --panel-right-bg: radial-gradient(
    circle at top right,
    rgba(123, 44, 191, 0.12),
    transparent 70%
  );

  --border-light: rgba(255, 255, 255, 0.1);
  --input-bg: rgba(255, 255, 255, 0.03);

  --text-main: #ffffff;
  --text-dim: #94a3b8;

  /* NEON ACCENTS */
  --purple-glow: #7b2cbf;
  --accent-cyan: #00f0ff;
  --accent-pink: #ff007c;
  --success: #00ff9d;
  --danger: #ff2a6d;

  --shadow-strong: 0 40px 80px rgba(0, 0, 0, 0.7);
}

/* --- TEMA CLARO (OVERRIDE) --- */
[data-theme="light"] {
  --bg-deep: #eef2f6;
  --bg-gradient: linear-gradient(135deg, #eef2f6 0%, #e0e7ff 100%);

  --console-bg: rgba(255, 255, 255, 0.85);
  --panel-left-bg: rgba(255, 255, 255, 0.5);
  --panel-right-bg: radial-gradient(
    circle at top right,
    rgba(123, 44, 191, 0.05),
    transparent 70%
  );

  --border-light: rgba(0, 0, 0, 0.08);
  --input-bg: #ffffff;

  --text-main: #1e293b;
  --text-dim: #64748b;

  --success: #059669;
  --accent-cyan: #0891b2;

  --shadow-strong: 0 20px 60px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   2. RESET E ESTRUTURA BASE
   ========================================================================== */
* {
  box-sizing: border-box;
}

body {
  background-color: var(--bg-deep);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  transition: background 0.5s ease;
}

/* ==========================================================================
   3. LAYOUT DO CONSOLE
   ========================================================================== */
.console-container {
  width: 100%;
  max-width: 1300px;
  background: var(--console-bg);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--border-light);
  border-radius: 30px;
  box-shadow: var(--shadow-strong);
  display: grid;
  grid-template-columns: 420px 1fr;
  overflow: hidden;
  position: relative;
  transition: background 0.3s ease;
}

/* Barra Neon Superior */
.console-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--accent-cyan),
    var(--purple-glow),
    var(--accent-pink)
  );
  z-index: 10;
}

/* Painel Esquerdo (Controles) */
.left-panel {
  background: var(--panel-left-bg);
  padding: 60px;
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 25px;
}

/* Painel Direito (Visor) */
.right-panel {
  padding: 40px;
  background: var(--panel-right-bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ==========================================================================
   4. COMPONENTES: CABEÇALHO E MARCA
   ========================================================================== */
.brand-area {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.brand {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand span {
  color: var(--accent-pink);
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.user-tag {
  font-size: 0.9rem;
  color: var(--text-dim);
  background: var(--input-bg);
  padding: 8px 15px;
  border-radius: 30px;
  border: 1px solid var(--border-light);
}

/* Botão Tema (Sol/Lua) */
.theme-toggle {
  background: var(--input-bg);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 10px;
  border-radius: 50%;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.3s;
}
.theme-toggle:hover {
  background: var(--purple-glow);
  color: #fff;
}

/* ==========================================================================
   5. COMPONENTES: FORMULÁRIOS E INPUTS
   ========================================================================== */
label {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  display: block;
  font-weight: 600;
}

.cyber-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 16px 20px;
  border-radius: 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
  transition: 0.3s;
}
.cyber-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
}

/* Seletor de Modo (Abas) */
.mode-switch {
  display: flex;
  background: var(--input-bg);
  padding: 5px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
}
.mode-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 12px;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 8px;
  transition: 0.3s;
  font-weight: 700;
}
.mode-btn.active {
  background: var(--purple-glow);
  color: #fff;
  box-shadow: 0 5px 15px rgba(123, 44, 191, 0.4);
}

/* ==========================================================================
   6. COMPONENTES: BOTÕES DE AÇÃO
   ========================================================================== */
/* Botão Iniciar/Calcular */
.btn-launch {
  width: 100%;
  padding: 20px;
  background: linear-gradient(135deg, var(--accent-pink), #d6006e);
  border: none;
  color: white;
  border-radius: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  cursor: pointer;
  margin-top: auto;
  transition: 0.3s;
  text-transform: uppercase;
  font-size: 1.1rem;
  box-shadow: 0 5px 20px rgba(255, 0, 124, 0.3);
}
.btn-launch:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(255, 0, 124, 0.5);
}
/* Estado Desativado (Sessão Iniciada) */
.btn-launch:disabled {
  background: #333;
  cursor: not-allowed;
  color: #777;
  box-shadow: none;
  transform: none;
  border: 1px solid #444;
}

/* Botão Reset */
.btn-reset {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: 0.3s;
  letter-spacing: 1px;
  font-weight: 700;
}
.btn-reset:hover {
  background: var(--danger);
  color: #fff;
}

/* Botões Win/Loss */
.actions-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.action-btn {
  padding: 25px;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  transition: 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  letter-spacing: 2px;
}
.btn-win {
  background: rgba(0, 255, 157, 0.1);
  border: 2px solid var(--success);
  color: var(--success);
}
.btn-loss {
  background: rgba(255, 42, 109, 0.1);
  border: 2px solid var(--danger);
  color: var(--danger);
}
.btn-win:hover {
  background: var(--success);
  color: #fff;
}
.btn-loss:hover {
  background: var(--danger);
  color: #fff;
}

/* Botões travados na meta */
.action-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  border-color: #555;
  color: #777;
  background: transparent;
}

/* ==========================================================================
   7. COMPONENTES: DASHBOARD E STATS
   ========================================================================== */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}
.stat-card {
  background: var(--input-bg);
  border: 1px solid var(--border-light);
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s;
}
.stat-val {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  margin-top: 10px;
  color: var(--text-main);
}
.val-money {
  color: var(--success);
}
.val-entry {
  color: var(--accent-cyan);
}

/* Barra de Progresso */
.progress-section {
  margin-bottom: 40px;
}
.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 1.1rem;
  color: var(--text-main);
}
.progress-bg {
  width: 100%;
  height: 10px;
  background: var(--input-bg);
  border: 1px solid var(--border-light);
  border-radius: 5px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--purple-glow));
  transition: width 0.6s ease;
}

/* Placar e Banners */
.scoreboard {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-dim);
}
.score-w {
  color: var(--success);
}
.score-l {
  color: var(--danger);
}

.banner-win,
.banner-loss {
  padding: 25px;
  border-radius: 15px;
  text-align: center;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 1px;
  margin-top: 20px;
  animation: pulseBanner 2s infinite;
  border: 2px solid;
}
.banner-win {
  background: rgba(0, 255, 157, 0.15);
  border-color: var(--success);
  color: var(--success);
  text-shadow: 0 0 15px var(--success);
}
.banner-loss {
  background: rgba(255, 42, 109, 0.15);
  border-color: var(--danger);
  color: var(--danger);
  text-shadow: 0 0 15px var(--danger);
}

/* ==========================================================================
   8. ALERTA E MODAIS
   ========================================================================== */
.alert-inline {
  background: rgba(239, 68, 68, 0.1);
  border-left: 4px solid var(--danger);
  color: var(--danger);
  padding: 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  text-align: start;
  margin-bottom: 20px;
  font-weight: 500;
  animation: fadeIn 0.4s ease;
}
.alert-inline::before {
  content: "⚠️ ";
}

/* Login Modal */
.login-overlay {
  position: fixed;
  inset: 0; /* Correção do inset: 2 para 0 */
  background: #000;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
}
.login-box {
  width: 90%;
  max-width: 380px;
  text-align: center;
}

/* Loader Overlay */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top: 3px solid var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
  box-shadow: 0 0 15px var(--accent-cyan);
}
.loading-text {
  color: #fff;
  font-size: 0.9rem;
  letter-spacing: 2px;
  font-weight: 600;
  animation: pulseText 1.5s infinite;
}

/* ==========================================================================
   9. ANIMAÇÕES E UTILITÁRIOS
   ========================================================================== */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
@keyframes pulseText {
  0% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.5;
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes pulseBanner {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.02);
    opacity: 0.9;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   10. RESPONSIVIDADE (MOBILE)
   ========================================================================== */
@media (max-width: 1024px) {
  .console-container {
    max-width: 900px;
    grid-template-columns: 350px 1fr;
  }
  .stat-val {
    font-size: 2rem;
  }
  .action-btn {
    font-size: 1.2rem;
    padding: 20px;
  }
}

@media (max-width: 800px) {
  body {
    padding: 0;
    align-items: flex-start;
  }

  .console-container {
    grid-template-columns: 1fr;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border-light);
    box-shadow: none;
    height: auto;
    min-height: 100vh;
  }

  .left-panel {
    padding: 20px 20px 30px 20px;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    gap: 15px;
  }

  .brand-area {
    margin-bottom: 15px;
  }
  .brand {
    font-size: 1.5rem;
  }
  .cyber-input {
    padding: 14px;
    font-size: 1rem;
  }
  .btn-launch {
    padding: 16px;
    font-size: 1rem;
  }

  .right-panel {
    padding: 20px;
    gap: 20px;
  }
  .top-bar {
    margin-bottom: 20px;
  }
  .stats-row {
    gap: 10px;
    margin-bottom: 20px;
  }
  .stat-card {
    padding: 15px;
  }
  .stat-val {
    font-size: 1.6rem;
    margin-top: 5px;
  }
  .stat-label {
    font-size: 0.7rem;
  }
  .progress-section {
    margin-bottom: 25px;
  }
  .actions-area {
    gap: 15px;
  }
  .action-btn {
    padding: 20px;
    font-size: 1.2rem;
  }
  .banner-win,
  .banner-loss {
    font-size: 1.1rem;
    padding: 20px;
  }
}
