/* Dashboard Specific Styles */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

@media (max-width: 600px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.dashboard-card {
  border-radius: var(--radius-lg, 1rem);
  background: var(--glass-bg, rgba(255, 255, 255, 0.85));
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.8));
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="dark"] .dashboard-card {
  background: var(--glass-bg, rgba(15, 23, 42, 0.85));
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.dashboard-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.chart-header {
  margin-bottom: 20px;
}

.chart-header h3 {
  font-family: var(--font-header);
  font-size: 1.25rem;
  margin-bottom: 5px;
  color: var(--color-primary, #2563eb);
}

[data-theme="dark"] .chart-header h3 {
  color: #60a5fa;
}

.chart-desc {
  font-size: 0.9rem;
  opacity: 0.7;
}

.chart-container {
  flex-grow: 1;
  position: relative;
  min-height: 300px; /* Crucial to avoid CLS */
}

.chart-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0,0,0,0.1);
  border-radius: 50%;
  border-top-color: var(--color-primary, #2563eb);
  animation: spin 1s ease-in-out infinite;
}

[data-theme="dark"] .chart-loader {
  border-color: rgba(255,255,255,0.1);
  border-top-color: #60a5fa;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.chart-footer {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

[data-theme="dark"] .chart-footer {
  border-top-color: rgba(255,255,255,0.05);
}

.last-updated {
  font-size: 0.8rem;
  opacity: 0.6;
  text-align: right;
  font-style: italic;
  display: block;
}

.cta-container {
  text-align: center;
}

/* ApexCharts global tweaks */
.apexcharts-tooltip {
  background: var(--color-surface, #ffffff) !important;
  color: var(--color-text-primary, #0f172a) !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
  border: 1px solid rgba(0,0,0,0.1) !important;
}

[data-theme="dark"] .apexcharts-tooltip {
  background: var(--color-surface, #0f172a) !important;
  color: var(--color-text-primary, #f8fafc) !important;
  border-color: rgba(255,255,255,0.1) !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5) !important;
}

.apexcharts-tooltip-title {
  background: rgba(0,0,0,0.05) !important;
  border-bottom: 1px solid rgba(0,0,0,0.1) !important;
  font-family: var(--font-primary) !important;
  font-weight: 600 !important;
}

[data-theme="dark"] .apexcharts-tooltip-title {
  background: rgba(255,255,255,0.05) !important;
  border-bottom-color: rgba(255,255,255,0.1) !important;
}

.apexcharts-text {
  fill: var(--color-text-primary) !important;
  font-family: var(--font-primary) !important;
}

[data-theme="dark"] .apexcharts-text {
  fill: rgba(255,255,255,0.7) !important;
}

.apexcharts-gridline {
  stroke: rgba(0,0,0,0.05) !important;
}

[data-theme="dark"] .apexcharts-gridline {
  stroke: rgba(255,255,255,0.05) !important;
}

/* =========================================================================
   PREMIUM THEMES & GLASSMORPHISM GLOWS
   ========================================================================= */

/* Theme variables */
.dashboard-card[data-theme="cyber"] {
  --theme-color: #f59e0b;
  --theme-color-rgb: 245, 158, 11;
}
.dashboard-card[data-theme="greenit"] {
  --theme-color: #10b981;
  --theme-color-rgb: 16, 185, 129;
}
.dashboard-card[data-theme="web3"] {
  --theme-color: #8b5cf6;
  --theme-color-rgb: 139, 92, 246;
}
.dashboard-card[data-theme="ia"] {
  --theme-color: var(--color-primary, #2563eb);
  --theme-color-rgb: 37, 99, 235;
}
[data-theme="dark"] .dashboard-card[data-theme="ia"] {
  --theme-color: var(--color-tag-text, #60a5fa);
  --theme-color-rgb: 96, 165, 250;
}

/* Dynamic color overrides */
.dashboard-card .chart-header h3 {
  color: var(--theme-color) !important;
  transition: text-shadow 0.3s ease;
}

[data-theme="dark"] .dashboard-card .chart-header h3 {
  color: var(--theme-color) !important;
}

.dashboard-card .chart-loader {
  border-top-color: var(--theme-color) !important;
}

/* Premium Card Ambient Glow */
.dashboard-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(var(--theme-color-rgb), 0.03) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  transition: background 0.3s ease;
}

.dashboard-card:hover::before {
  background: radial-gradient(circle, rgba(var(--theme-color-rgb), 0.06) 0%, transparent 65%);
}

.dashboard-card:hover {
  border-color: rgba(var(--theme-color-rgb), 0.4) !important;
  box-shadow: 0 10px 25px -5px rgba(var(--theme-color-rgb), 0.15),
              0 8px 10px -6px rgba(var(--theme-color-rgb), 0.1) !important;
}

[data-theme="dark"] .dashboard-card:hover {
  border-color: rgba(var(--theme-color-rgb), 0.5) !important;
  box-shadow: 0 0 35px rgba(var(--theme-color-rgb), 0.2) !important;
}

/* Premium Themed CTA buttons */
.dashboard-card .cta-button-small {
  border: 1.5px solid var(--theme-color) !important;
  color: var(--theme-color) !important;
  background: transparent !important;
  padding: 8px 20px !important;
  border-radius: 30px !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: none !important;
}

.dashboard-card .cta-button-small::before {
  display: none !important; /* Remove any old overlays */
}

.dashboard-card .cta-button-small:hover {
  background: var(--theme-color) !important;
  color: #ffffff !important;
  box-shadow: 0 0 15px rgba(var(--theme-color-rgb), 0.6) !important;
  transform: translateY(-2px) scale(1.02) !important;
}

/* Premium Source Indicator */
.chart-source-premium {
  font-size: 0.75rem;
  font-family: var(--font-primary);
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  margin-bottom: 2px;
}

.chart-source-premium span {
  font-weight: 400;
  color: var(--color-text-primary);
}

.chart-source-premium a {
  color: var(--theme-color);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-bottom: 1px dashed rgba(var(--theme-color-rgb), 0.4);
  transition: all 0.3s ease;
}

.chart-source-premium a:hover {
  border-bottom: 1px solid var(--theme-color);
  text-shadow: 0 0 8px rgba(var(--theme-color-rgb), 0.4);
}

/* Hero Title optimization to fit on a single line on desktop */
.page-dashboard .hero-title {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
}
@media (min-width: 768px) {
  .page-dashboard .hero-title {
    white-space: nowrap;
  }
}

/* Utilities */
.is-hidden {
  display: none !important;
}
