/* === TEMA ESCURO PREMIUM (Roxo + Preto) === */
:root {
  --primary-color: #8A2BE2;       /* Roxo principal */
  --secondary-color: #EDEDED;
  --bg-color: #0F0F11;            /* Fundo preto premium */
  --card-bg: #1A1A1D;             /* Cards escuros modernos */
  --text-color: #FFFFFF;
  --input-border: #27272B;
  --shadow: 0 4px 10px rgba(0,0,0,0.7);

  --green: #23D197;  /* Verde soft premium */
  --red: #FF4F4F;    /* Vermelho neon */
  --amber: #FFB84D;
}

/* === TEMA CLARO ROXO PREMIUM === */
.light-theme {
  --primary-color: #8A2BE2;
  --secondary-color: #333;
  --bg-color: #F3F1F7;         /* Roxo claro pastel */
  --card-bg: #FFFFFF;
  --text-color: #222;
  --input-border: #C9C9C9;
  --shadow: 0 2px 6px rgba(0,0,0,0.1);

  --green: #1FB985;
  --red: #E64545;
  --amber: #E6A637;
}
    *,*::before,*::after { box-sizing: border-box; }
    body {
      font-family: 'Poppins', sans-serif;
      background: var(--bg-color);
      color: var(--text-color);
      display: flex;
      flex-direction: column;
      align-items: center;
      min-height: 100vh;
      padding: 20px;
    }
    .card, .form-container, .chart-container, .history-container, .filter-container, #login-container {
      background: var(--card-bg);
      padding: 25px;
      border-radius: 15px;
      box-shadow: var(--shadow);
    }
    #login-container {
      padding: 40px;
      max-width: 400px;
      width: 100%;
      text-align: center;
      margin-top: 50px;
    }
    #app-content { display: none; width: 100%; flex-direction: column; align-items: center; }
    header {
      margin-bottom: 30px;
      text-align: center;
      width: 100%;
      max-width: 1000px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    h1 { color: var(--secondary-color); font-weight: 600; }
    .container {
      width: 100%;
      max-width: 1000px;
      display: block;
    }
    .balance-container { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); margin-bottom: 20px;}
    .card h3 { font-size: 14px; text-transform: uppercase; color: #777; margin-bottom: 10px; }
    .card span { font-size: 24px; font-weight: 600; }
    .money-plus { color: var(--green); }
    .money-minus { color: var(--red); }
    h2 { border-bottom: 1px solid #bbb; padding-bottom: 10px; margin-bottom: 20px; font-size: 18px; }
    .form-control { margin-bottom: 15px; text-align: left; }
    label { display: block; margin-bottom: 5px; font-size: 14px; color: var(--text-color) }
    input, select {
      background: var(--card-bg);
      border: 1px solid var(--input-border);
      color: var(--text-color);
      border-radius: 5px;
      display: block;
      font-size: 16px;
      padding: 10px;
      width: 100%;
      font-family: inherit;
    }
    input::placeholder,
    select option {
      color: var(--text-color);
    }
    input:focus, select:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 6px rgba(138, 43, 226, 0.4);}
    .btn {
      cursor: pointer;
      background-color: var(--primary-color);
      box-shadow: var(--shadow);
      color: #fff;
      border: 0;
      display: block;
      font-size: 16px;
      margin-top: 20px;
      padding: 10px;
      width: 100%;
      border-radius: 5px;
      transition: background 0.3s;
    }
    .btn:hover:not(:disabled) { background-color: #7b43c1; }
    .btn:disabled { background-color: #ccc; cursor: not-allowed; }
    .btn-logout { background: #6C3BAA; width: auto; margin: 0; padding: 8px 15px; font-size: 14px; }
    .btn-logout:hover { background: #7b43c1; }
    .filter-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
    .filter-row .form-control { flex: 1; margin-bottom: 0; min-width: 120px; }
    .filter-actions { display: flex; gap: 10px; margin-top: 15px; }
    .btn-outline { background: #6C3BAA; border: 1px solid color: #fff; }
    .main-row {
      display: flex;
      gap: 20px;
      margin-bottom: 20px;
    }
    .dashboard-row {
      display: flex;
      gap: 20px;
      width: 100%;
      margin-bottom: 20px;
      align-items: flex-start;
    }
    .form-container,.chart-container { flex: 1 1 50%; }
    .filter-container {
      flex: 1 1 35%;
      min-width: 320px;
      max-width: 380px;
    }
    .history-container { flex: 2 1 65%; }
    .list { list-style-type: none; padding: 0; }
    .list li {
      position: relative;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 70px 10px 10px;
      background-color: var(--card-bg);
      margin: 10px 0;
      border-radius: 5px;
      border-right: 5px solid transparent;
      transition: background-color 0.3s, box-shadow 0.3s;
    }
    .list li.plus { border-right-color: var(--green); }
    .list li.minus { border-right-color: var(--red); }
    .actions-right {
      display: flex;
      align-items: center;
      gap: 8px;
      position: absolute;
      right: 10px;
      top: 50%;
      transform: translateY(-50%);
    }
    .actions-right span {
      font-size: 18px;
      font-weight: 600;
      color: var(--secondary-color);
    }
    .edit-btn, .delete-btn {
      position: static !important;
      width: 28px;
      height: 28px;
      margin: 0;
      background: transparent;
      border: 0;
      padding: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      border-radius: 5px;
      cursor: pointer;
      opacity: 1;
      transition: opacity 0.3s, background 0.2s;
    }
    .btn {
      background-color: var(--primary-color);
      transition: 0.2s;
    }

    .btn:hover {
      background-color: #9e47ff; /* Roxo neon mais claro */
    }
    .edit-btn { color: var(--amber); }
    .delete-btn { color: #fff; }
    .edit-btn:hover { background: #2ecc71; }
    .delete-btn:hover { background: #e74c3c; }
    .list-item-info { display: flex; flex-direction: column; }
    .list-item-category { font-size: 12px; color: #888; }
    .list-item-date { font-size: 11px; color: #aaa; margin-top: 2px; }
    .chart-wrapper {
      position: relative;
      height: 250px;
      width: 100%;
      display: flex;
      justify-content: center;
    }
    #offline-banner {
      display: none;
      background: #fff3cd;
      color: #856404;
      padding: 10px;
      text-align: center;
      width: 100%;
      font-size: 14px;
      border-bottom: 1px solid #ffeeba;
    }
    .btn-cancel {
      background: #c0392b !important;
      border: 1px solid #c0392b !important;
      color: #fff !important;
    }
    .btn-cancel:hover {
      background: #ab362a !important;
      color: #fff !important;
      border-color: #ab362a !important;
    }
    #register-modal {
      display: none;
      position: fixed;
      top: 0; left: 0;
      width: 100vw; height: 100vh;
      background: rgba(0,0,0,0.5);
      align-items: center;
      justify-content: center;
      z-index: 99;
    }
    #register-modal .modal-box {
      background: var(--card-bg);
      padding: 32px 28px;
      border-radius: 10px;
      max-width: 350px;
      min-width: 260px;
      margin: auto;
      box-shadow: var(--shadow);
      color: var(--text-color);
    }
    #modal-register-feedback {
      margin-top:8px;
      color:var(--red);
      text-align: center;
      font-size: 14px;
    }
    #modal-register-form .btn { margin-bottom: 0; }

    /* Link "Esqueci minha senha?" */
    #forgot-password-btn {
      margin-top: 10px;
      background: none;
      border: none;
      color: #9ca3af;
      font-size: 14px;
      cursor: pointer;
      text-decoration: underline;
      width: auto;
      display: inline-block;
    }
    #forgot-password-btn:hover {
      color: #d1d5db;
    }

    /* Modal de reset de senha */
    #reset-modal {
      display: none;
      position: fixed;
      top: 0; left: 0;
      width: 100vw; height: 100vh;
      background: rgba(0,0,0,0.5);
      align-items: center;
      justify-content: center;
      z-index: 99;
    }
    #reset-modal .modal-box {
      background: var(--card-bg);
      padding: 32px 28px;
      border-radius: 10px;
      max-width: 350px;
      min-width: 260px;
      margin: auto;
      box-shadow: var(--shadow);
      color: var(--text-color);
    }
    /* === HISTÓRICO COM ALTURA FIXA + SCROLL === */
    .history-container {
      max-height: 480px;        /* altura fixa */
      overflow-y: auto;         /* scroll vertical */
      padding-right: 6px;
      border-radius: 12px;
    }

    /* Scrollbar customizado */
    .history-container::-webkit-scrollbar {
      width: 6px;
    }
    .history-container::-webkit-scrollbar-thumb {
      background: var(--primary-color);
      border-radius: 8px;
    }
    .history-container::-webkit-scrollbar-track {
      background: #1f1f1f;
    }

    #login-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}
    /* === TOGGLE SOL / LUA === */
.theme-toggle {
  background: var(--card-bg);
  border: 2px solid var(--primary-color);
  color: var(--text-color);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: background 0.3s, transform 0.2s;
}

.theme-toggle:hover {
  transform: scale(1.07);
}

#theme-icon {
  font-size: 22px;
  transition: opacity 0.3s, transform 0.3s;
}

/* === INPUTS PREMIUM === */
/* INPUTS DINÂMICOS (seguem o tema) */
input, select {
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  color: var(--text-color);
  
  padding: 12px;
  border-radius: 8px;
  font-size: 15px;
  transition: 0.2s;
}

input::placeholder {
  color: #989898;
}

input:focus, select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 6px rgba(138, 43, 226, 0.4);
}


/* === BOTÕES ROXOS PREMIUM === */
.btn {
  background: linear-gradient(135deg, #8A2BE2, #7B1FE0) !important;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #FFF;
  cursor: pointer;
  transition: 0.25s ease;
  box-shadow: 0 4px 14px rgba(138, 43, 226, 0.3);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(138, 43, 226, 0.45);
}

/* Botões vermelhos */
.btn-cancel {
  background: #FF4F4F !important;
  box-shadow: 0 4px 12px rgba(255, 79, 79, 0.35);
}

.btn-cancel:hover {
  background: #E64545 !important;
  transform: translateY(-2px);
}

/* BOTÃO DE CRIAR CATEGORIA (verde premium) */
#add-category-btn {
  background: linear-gradient(135deg, #23D197, #1FAE7A) !important;
  color: #FFF;
  border: none;
  box-shadow: 0 4px 12px rgba(35, 209, 151, 0.35);
}

#add-category-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(35, 209, 151, 0.5);
}

/* -------------------------------
   BOTÕES MODERNOS DE EXPORTAÇÃO
-------------------------------- */
.export-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.export-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: 0.25s;
  box-shadow: var(--shadow);
  letter-spacing: 0.3px;
}

/* Excel */
.export-btn.excel {
  background: #8A2BE2; /* Roxo premium */
  color: #fff;
}

.export-btn.excel:hover {
  background: #9d4bff;
  transform: translateY(-2px);
}

/* PDF */
.export-btn.pdf {
  background: #FF4F4F; /* Vermelho neon */
  color: #fff;
}

.export-btn.pdf:hover {
  background: #ff6b6b;
  transform: translateY(-2px);
}

/* -------------------------------
     MENU DROPDOWN DE EXPORTAÇÃO
-------------------------------- */

.export-dropdown {
  position: relative;
  display: inline-block;
  margin-bottom: 20px;
}

/* Botão principal (⋮) */
.export-menu-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: 0.3s;
}

.export-menu-btn:hover {
  background: #9d4bff;
  transform: scale(1.05);
}

/* Caixa do menu */
.export-menu {
  position: absolute;
  top: 45px;
  right: -70px;
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  width: 180px;
  padding: 6px 0;
  display: none;
  z-index: 20;
  animation: dropdownFade 0.15s ease-out;
}

/* Animação */
@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}



/* Itens do menu */
.export-item {
  display: block;
  width: 100%;
  background: transparent;
  color: var(--text-color);
  padding: 12px 16px;
  border: none;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s;
}

.export-item:hover {
  background: rgba(255,255,255,0.08);
}

/* Layout geral mobile */
@media (max-width: 600px) {

  body {
    padding: 10px;
  }

  /* Login ocupa toda a largura com menos margem */
  #login-container {
    margin-top: 20px;
    max-width: 100%;
    padding: 28px;
  }

  header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
    align-items: center;
  }

  #logout-btn {
    width: 100%;
  }

  .container {
    max-width: 100%;
  }

  .balance-container {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .main-row,
  .dashboard-row {
    flex-direction: column;
    gap: 15px;
  }

  .form-container,
  .chart-container,
  .filter-container,
  .history-container {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* inputs e selects um pouco maiores para toque */
  input,
  select {
    font-size: 16px;
    padding: 14px;
  }

  /* Botões mais confortáveis */
  .btn {
    padding: 14px;
    font-size: 17px;
    border-radius: 10px;
  }

  /* Legibilidade do histórico */
  .list li {
    padding: 12px 60px 12px 12px;
    font-size: 15px;
  }

  .actions-right span {
    font-size: 16px;
  }

  .edit-btn,
  .delete-btn {
    width: 30px;
    height: 30px;
    font-size: 18px;
  }

  /* Gráfico ajustado */
  .chart-wrapper {
    height: 220px;
  }

  /* Lista de categorias customizadas */
  #custom-category-list div {
    flex-direction: row;
    justify-content: space-between;
    padding: 10px;
  }
}