/* ================================
   CSS Variables & Reset
   ================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161f;
  --bg-card-hover: #1e1e2a;
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.15);

  --text-primary: #f0f0f8;
  --text-secondary: #8b8ba8;
  --text-muted: #5a5a75;

  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.15);
  --accent-2: #8b5cf6;
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.2);

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ================================
   Header
   ================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  display: flex;
  align-items: center;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.logo-accent {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--accent-soft);
}

/* ================================
   Hero Section
   ================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 32px 80px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99, 102, 241, 0.18) 0%, transparent 65%),
    radial-gradient(ellipse 50% 40% at 80% 60%, rgba(139, 92, 246, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 20% 70%, rgba(16, 185, 129, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  text-align: center;
  max-width: 820px;
  width: 100%;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 16px 6px 12px;
  border-radius: 100px;
  margin-bottom: 28px;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6366f1;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

.hero-title {
  font-size: clamp(40px, 6vw, 72px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -2px;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.gradient-text {
  background: linear-gradient(135deg, #6366f1, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 48px;
  max-width: 580px;
  margin-left: auto;
  margin-right: auto;
}

/* ================================
   Search Area
   ================================ */
.search-area {
  background: rgba(22, 22, 31, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-align: left;
}

.search-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

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

.search-input-wrap {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 48px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  padding: 0 16px 0 44px;
  outline: none;
  transition: var(--transition);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-height: 320px;
  overflow-y: auto;
  display: none;
}

.search-results.open {
  display: block;
  animation: slideDown 0.15s ease;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--accent-soft);
}

.result-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
  flex-shrink: 0;
}

.result-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--accent-soft);
  color: #a5b4fc;
}

.result-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.result-status.closed {
  background: var(--text-muted);
}

.btn-compare {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-compare:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.btn-compare:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Selected Funds Tags */
.selected-funds {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.fund-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 14px;
  border-radius: 100px;
  border: 1px solid;
  font-size: 13px;
  font-weight: 500;
  animation: fadeIn 0.2s ease;
}

.fund-tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  color: inherit;
  font-size: 16px;
  line-height: 1;
}

.fund-tag-remove:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Decoration Cards */
.deco-cards {
  position: absolute;
  pointer-events: none;
}

.deco-card {
  position: absolute;
  background: rgba(22, 22, 31, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  backdrop-filter: blur(12px);
  white-space: nowrap;
}

.deco-card-1 {
  top: 30%;
  right: -140px;
  animation: float 6s ease-in-out infinite;
}

.deco-card-2 {
  bottom: 35%;
  right: -100px;
  animation: float 6s ease-in-out infinite 2s;
}

.deco-card-3 {
  top: 55%;
  left: -120px;
  animation: float 6s ease-in-out infinite 4s;
}

.deco-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.deco-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.deco-value.positive {
  color: var(--success);
}

.deco-value.warning {
  color: var(--warning);
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-12px);
  }
}

/* ================================
   Loading Overlay
   ================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(8px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loading-content p {
  color: var(--text-secondary);
  font-size: 15px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ================================
   Dashboard
   ================================ */
.dashboard {
  padding: 48px 32px 80px;
}

.dashboard-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ================================
   Fund Cards Row
   ================================ */
.fund-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.fund-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.fund-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.fund-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.fund-card-header {
  margin-bottom: 20px;
}

.fund-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  margin-bottom: 10px;
}

.fund-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 6px;
}

.fund-cnpj {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
}

.fund-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.fund-stat {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.fund-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.fund-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.fund-stat-value.positive {
  color: var(--success);
}

.fund-stat-value.negative {
  color: var(--danger);
}

/* ================================
   Chart Section
   ================================ */
.chart-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.section-title.center {
  text-align: center;
}

.chart-controls {
  display: flex;
  gap: 6px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.chart-btn {
  padding: 6px 16px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
}

.chart-btn:hover {
  color: var(--text-primary);
}

.chart-btn.active {
  background: var(--accent);
  color: white;
}

.chart-container {
  position: relative;
  height: 360px;
}

/* ================================
   Metrics Grid
   ================================ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.metric-comparison-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.metric-comparison-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 16px;
}

.metric-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric-bar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-bar-name {
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-bar-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.metric-bar-track {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.metric-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================================
   Monthly Returns Table
   ================================ */
.returns-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.returns-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.returns-tab {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
}

.returns-tab:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.returns-tab.active {
  background: var(--accent-soft);
  border-color: rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
}

.returns-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.returns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.returns-table th {
  padding: 10px 12px;
  text-align: center;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.returns-table th:first-child {
  text-align: left;
}

.returns-table td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  transition: var(--transition);
}

.returns-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
}

.returns-table tr:last-child td {
  border-bottom: none;
}

.returns-table tr:hover td {
  background: rgba(99, 102, 241, 0.04);
}

.cell-positive {
  color: var(--success);
  background: rgba(16, 185, 129, 0.08);
  border-radius: 4px;
}

.cell-negative {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  border-radius: 4px;
}

.cell-null {
  color: var(--text-muted);
}

.cell-annual {
  font-weight: 700 !important;
  font-size: 14px !important;
}

/* ================================
   Metrics Info Section
   ================================ */
.metrics-info {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 80px 32px;
}

.metrics-info-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.metrics-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.metric-card-info {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  transition: var(--transition);
}

.metric-card-info:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}

.metric-card-info h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.metric-card-info p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ================================
   Footer
   ================================ */
.footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  padding: 24px 32px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.footer a {
  color: #a5b4fc;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ================================
   Animations
   ================================ */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ================================
   Scrollbar
   ================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ================================
   Modal
   ================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(8px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideDown 0.2s ease;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.modal-section {
  margin-bottom: 24px;
}

.modal-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  letter-spacing: 0.5px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.modal-grid-item {
  background: var(--bg-secondary);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.modal-grid-item strong {
  display: block;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ================================
   Responsive
   ================================ */
@media (max-width: 768px) {
  .header-inner {
    padding: 12px 16px;
  }

  .hero {
    padding: 100px 16px 60px;
  }

  .search-area {
    padding: 20px 16px;
  }

  .search-row {
    flex-direction: column;
  }

  .btn-compare {
    width: 100%;
    justify-content: center;
  }

  .dashboard {
    padding: 24px 16px 60px;
  }

  .chart-section,
  .returns-section {
    padding: 20px 16px;
  }

  .deco-cards {
    display: none;
  }

  .metrics-info {
    padding: 60px 16px;
  }
}