/* ==========================================================================
   B3 Rebalanceamento & IA — Modern Dark Theme
   ========================================================================== */

/* -- Tokens ------------------------------------------------------------ */
:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.12);
  --yellow: #f59e0b;
  --yellow-bg: rgba(245, 158, 11, 0.12);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.12);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.12);
  --sidebar-w: 260px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.25);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* -- Reset ------------------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background gradient blobs */
body::before {
  content: '';
  position: fixed;
  top: -40%;
  left: -20%;
  width: 70vw;
  height: 70vw;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  bottom: -30%;
  right: -15%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* -- Sidebar ----------------------------------------------------------- */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border-glass);
}
.sidebar-logo { font-size: 2rem; }
.sidebar-title {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--text-primary);
}
.sidebar-title small {
  font-weight: 400;
  color: var(--accent-light);
  font-size: 0.8rem;
}
.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all var(--transition);
  position: relative;
}
.nav-link:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}
.nav-link.active {
  background: var(--accent-glow);
  color: var(--accent-light);
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: -0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 2px;
}
.nav-icon { font-size: 1.15rem; }
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-glass);
}

/* -- Mobile header ----------------------------------------------------- */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-glass);
  align-items: center;
  padding: 0 1rem;
  z-index: 150;
  gap: 0.75rem;
}
.hamburger {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}
.mobile-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 190;
}
.overlay.show { display: block; }

/* -- Main content ------------------------------------------------------ */
.main-content {
  margin-left: var(--sidebar-w);
  padding: 2rem 2.5rem 3rem;
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* -- Pages ------------------------------------------------------------- */
.page { display: none; animation: fadeUp 0.4s ease; }
.page.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -- Page header ------------------------------------------------------- */
.page-header { margin-bottom: 2rem; }
.page-header h1 {
  font-size: 1.85rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* -- Glass card -------------------------------------------------------- */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card {
  padding: 1.5rem;
  border-radius: var(--radius);
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}
.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* -- Stats grid -------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.stats-grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.stat-card {
  padding: 1.25rem;
  text-align: center;
  transition: transform var(--transition);
}
.stat-card:hover { transform: translateY(-3px); }
.stat-icon { font-size: 1.75rem; margin-bottom: 0.25rem; }
.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.stat-value {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-primary);
}
.stat-value.accent { color: var(--accent-light); }
.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }

/* -- Charts ------------------------------------------------------------ */
.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.25rem;
}
.chart-card { padding: 1.5rem; }
.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

/* -- Toolbar ----------------------------------------------------------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.form-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.form-inline label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* -- Buttons ----------------------------------------------------------- */
.btn {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-glass);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}
.btn-secondary {
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-glass);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--bg-glass);
  border-color: var(--text-muted);
}
.btn-danger-sm {
  background: var(--red-bg);
  color: var(--red);
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all var(--transition);
}
.btn-danger-sm:hover {
  background: var(--red);
  color: #fff;
}
.btn-glow {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-glow:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--accent-glow);
}
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  width: 100%;
}

/* -- Tables ------------------------------------------------------------ */
.table-responsive { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
thead {
  border-bottom: 2px solid var(--border-glass);
}
th {
  padding: 0.75rem 0.65rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
td {
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid var(--border-glass);
  white-space: nowrap;
}
tbody tr {
  transition: background var(--transition);
}
tbody tr:hover {
  background: var(--bg-glass);
}
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2.5rem 1rem !important;
}

/* -- User Profile Sidebar ---------------------------------------------- */
.user-profile-sidebar {
  display: flex;
  align-items: center;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 1rem;
}
.user-avatar {
  font-size: 1.5rem;
  background: var(--bg-glass);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
}
.user-info {
  margin-left: 0.75rem;
  display: flex;
  flex-direction: column;
}
.user-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}
.logout-link {
  font-size: 0.75rem;
  color: var(--red);
  text-decoration: none;
  font-weight: 500;
  margin-top: 0.15rem;
  transition: opacity var(--transition);
}
.logout-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* -- Badges ------------------------------------------------------------ */
.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-buy   { background: var(--green-bg); color: var(--green); }
.badge-hold  { background: var(--yellow-bg); color: var(--yellow); }
.badge-sell  { background: var(--red-bg); color: var(--red); }
.badge-none  { background: var(--bg-glass); color: var(--text-muted); }

/* -- Alerts ------------------------------------------------------------ */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.5;
}
.alert-info {
  background: var(--blue-bg);
  border-left: 3px solid var(--blue);
  color: var(--text-primary);
}
.alert-warning {
  background: var(--yellow-bg);
  border-left: 3px solid var(--yellow);
  color: var(--text-primary);
}

/* -- Barsi summary ----------------------------------------------------- */
.barsi-summary {
  display: flex;
  gap: 2rem;
  padding: 1rem 1.5rem;
  margin-top: 1rem;
}
.summary-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-green  { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red    { background: var(--red); }

/* -- Forms / Inputs ---------------------------------------------------- */
input[type="number"], select {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input[type="number"]:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-sm { width: 80px; }
.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.form-group input, .form-group select {
  width: 100%;
}
.form-group input[type="text"] {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* -- Modal ------------------------------------------------------------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 500;
  justify-content: center;
  align-items: center;
}
.modal-overlay.show { display: flex; }
.modal {
  width: 90%;
  max-width: 440px;
  padding: 1.75rem;
  animation: fadeUp 0.3s ease;
}
.modal-lg {
  max-width: 800px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--red); }

/* -- Loading overlay --------------------------------------------------- */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.85);
  z-index: 600;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 1rem;
}
.loading-overlay.show { display: flex; }
.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-glass);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
#loadingText {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* -- Toast ------------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 700;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.8rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
  min-width: 260px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: slideIn 0.35s ease, fadeOut 0.35s ease 3.5s;
  transition: opacity 0.35s;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.info    { background: var(--accent); }

/* -- Membership Modal -------------------------------------------------- */
.membership-content {
  text-align: center;
}
.membership-content p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.membership-plans h3 {
  font-size: 1rem;
  font-weight: 700;
}
.membership-plans ul li {
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
#leadForm {
  text-align: left;
  margin-top: 1.5rem;
}
#leadForm .form-group label {
  text-transform: none;
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
#leadEmail {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* -- About ------------------------------------------------------------- */
.about-content h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 1.75rem;
  margin-bottom: 0.6rem;
  color: var(--accent-light);
}
.about-content h2:first-child { margin-top: 0; }
.about-content p {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.about-content ul {
  list-style: none;
  padding: 0;
}
.about-content li {
  padding: 0.35rem 0;
  color: var(--text-secondary);
  position: relative;
  padding-left: 1.25rem;
}
.about-content li::before {
  content: '▸';
  color: var(--accent);
  position: absolute;
  left: 0;
}
.tech-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.tech-badge {
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent-glow);
  color: var(--accent-light);
  border: 1px solid rgba(99, 102, 241, 0.2);
}
.license-text {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* -- Market Summary Section -------------------------------------------- */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}
.summary-table th, .summary-table td {
  padding: 0.75rem 0.5rem;
  font-size: 0.75rem;
  white-space: nowrap; /*----- nowrap é para não quebrar a linha, normal deixa quebrar a linha-----*/
}
.summary-table td:last-child {
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
}
.var-up { color: var(--green); }
.var-down { color: var(--red); }

/* -- Responsive -------------------------------------------------------- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-header {
    display: flex;
  }
  .main-content {
    margin-left: 0;
    padding: 72px 1rem 2rem;
  }
  .charts-row {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .barsi-summary {
    flex-direction: column;
    gap: 0.75rem;
  }
}
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.hidden {
  display: none !important;
}
