/* ==========================================================================
   Growitate Design System - Color Palette from Official Brand Identity
   ========================================================================== */

:root {
  --font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Growitate Official Brand Palette */
  --grow-purple: #591ae8;
  --grow-purple-light: #7c3aed;
  --grow-purple-soft: #f5f3ff;
  --grow-purple-hover: #4b12cb;
  --grow-purple-glow: rgba(89, 26, 232, 0.28);
  --grow-gradient: linear-gradient(135deg, #591ae8 0%, #8b5cf6 100%);
  
  --grow-sky: #0284c7;
  --grow-sky-soft: #e0f2fe;
  
  --grow-emerald: #00b67a;
  --grow-emerald-soft: #ecfdf5;
  
  --grow-amber: #f59e0b;
  --grow-amber-soft: #fffbeb;
  
  --grow-whatsapp: #25d366;
  
  /* Theme: Light (Default, matching screenshot) */
  --bg-app: #fafaff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #ffffff;
  --bg-subtle: #f1f3fa;
  --border-color: rgba(99, 32, 238, 0.08);
  --border-color-focus: rgba(89, 26, 232, 0.5);
  
  --text-main: #0f172a;
  --text-muted: #525f7f;
  --text-dim: #94a3b8;
  
  --shadow-sm: 0 4px 12px rgba(89, 26, 232, 0.04);
  --shadow-md: 0 10px 30px -4px rgba(89, 26, 232, 0.08);
  --shadow-lg: 0 20px 40px -8px rgba(89, 26, 232, 0.12);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-app: #090714;
  --bg-card: rgba(18, 14, 38, 0.78);
  --bg-card-hover: rgba(24, 19, 50, 0.88);
  --bg-subtle: #191436;
  --border-color: rgba(139, 92, 246, 0.16);
  --border-color-focus: rgba(139, 92, 246, 0.6);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --grow-purple-soft: rgba(89, 26, 232, 0.18);
  --grow-emerald-soft: rgba(0, 182, 122, 0.18);
  --grow-sky-soft: rgba(2, 132, 199, 0.18);
  --grow-amber-soft: rgba(245, 158, 11, 0.18);
  
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 30px -4px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 40px -8px rgba(0, 0, 0, 0.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Ambient glow blobs matching screenshot */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.18) 0%, transparent 70%);
  top: -100px;
  right: -50px;
}

.glow-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.16) 0%, transparent 70%);
  top: 15%;
  left: -80px;
}

.glow-3 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, transparent 70%);
  bottom: 0;
  right: 10%;
}

.app-container {
  position: relative;
  z-index: 1;
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* ==========================================================================
   Topbar & Brand
   ========================================================================== */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.brand-tag {
  font-size: 0.72rem;
  color: var(--grow-purple);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Badges matching screenshot */
.topbar-pills {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.grow-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.pill-ai {
  background: var(--grow-purple-soft);
  color: var(--grow-purple);
  border: 1px solid rgba(89, 26, 232, 0.15);
}

.pill-msme {
  background: var(--grow-emerald-soft);
  color: var(--grow-emerald);
  border: 1px solid rgba(0, 182, 122, 0.15);
}

.pill-trustpilot {
  background: var(--grow-emerald);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
}

.tp-star {
  font-size: 0.85rem;
}

.tp-brand {
  font-weight: 700;
}

.tp-rating {
  font-size: 0.7rem;
  opacity: 0.95;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--grow-emerald);
  box-shadow: 0 0 8px var(--grow-emerald);
  display: inline-block;
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* Primary Growitate Button (matching "Get website and fill the form →") */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  font-family: inherit;
}

.btn-primary {
  background: var(--grow-purple);
  color: #ffffff;
  box-shadow: 0 8px 20px -4px var(--grow-purple-glow);
}

.btn-primary:hover {
  background: var(--grow-purple-hover);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -4px rgba(89, 26, 232, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-arrow {
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.btn-primary:hover .btn-arrow {
  transform: translateX(3px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--grow-purple-light);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--grow-purple);
  border-color: var(--border-color-focus);
}

.sync-icon.spinning {
  animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   Dashboard Header & Typography
   ========================================================================== */

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.header-titles h1 {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--text-main);
  line-height: 1.2;
}

.gradient-text {
  background: var(--grow-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  max-width: 680px;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.select-input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  max-width: 240px;
  box-shadow: var(--shadow-sm);
}

.select-input:focus {
  border-color: var(--grow-purple);
  box-shadow: 0 0 0 3px var(--grow-purple-glow);
}

.pill-group {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}

.pill-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.pill-btn:hover {
  color: var(--grow-purple);
}

.pill-btn.active {
  background: var(--grow-purple);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--grow-purple-glow);
}

/* ==========================================================================
   Growitate KPI Cards Grid (Matching bottom stat pills from screenshot)
   ========================================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

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

/* Circular soft badge icon like 24h / 500+ / 99% in screenshot */
.kpi-badge-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.icon-purple-soft {
  background: var(--grow-purple-soft);
  color: var(--grow-purple);
}

.icon-indigo-soft {
  background: rgba(99, 102, 241, 0.12);
  color: #6366f1;
}

.icon-cyan-soft {
  background: var(--grow-sky-soft);
  color: var(--grow-sky);
}

.icon-emerald-soft {
  background: var(--grow-emerald-soft);
  color: var(--grow-emerald);
}

.icon-amber-soft {
  background: var(--grow-amber-soft);
  color: var(--grow-amber);
}

.kpi-content {
  display: flex;
  flex-direction: column;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1.2;
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 0.15rem;
}

.kpi-sub-pill {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--grow-purple);
  background: var(--grow-purple-soft);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   Chart & Card Components
   ========================================================================== */

.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.card-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.chart-metric-selector {
  display: inline-flex;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}

.chart-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.chart-tab.active {
  background: var(--grow-purple);
  color: #ffffff;
  box-shadow: 0 2px 6px var(--grow-purple-glow);
}

.chart-container {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: var(--radius-md);
  background: rgba(99, 32, 238, 0.02);
  border: 1px dashed rgba(99, 32, 238, 0.12);
  padding: 0.75rem 0.5rem 0.25rem;
}

[data-theme="dark"] .chart-container {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(139, 92, 246, 0.15);
}

.responsive-chart {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-bar {
  transition: opacity 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.chart-bar:hover {
  opacity: 0.82;
}

.chart-tooltip {
  position: absolute;
  padding: 0.55rem 0.85rem;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 0.75rem;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  z-index: 10;
  transform: translate(-50%, -120%);
  white-space: nowrap;
  transition: opacity 0.15s ease;
}

/* ==========================================================================
   Responsive Data Table
   ========================================================================== */

.db-code {
  font-family: monospace;
  background: var(--grow-purple-soft);
  color: var(--grow-purple);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.record-counter {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-dim);
}

.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: 550px;
  container-type: inline-size;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.875rem;
}

thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: var(--bg-subtle);
}

th {
  padding: 0.85rem 1rem;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

td {
  padding: 0.85rem 1rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover {
  background-color: var(--grow-purple-soft);
}

.num-col {
  text-align: right;
}

.spend-highlight {
  font-weight: 800;
  color: var(--grow-purple);
}

.badge-source {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: var(--grow-purple-soft);
  color: var(--grow-purple);
  font-weight: 700;
}

.badge-manual {
  background: var(--grow-amber-soft);
  color: var(--grow-amber);
}

/* Container Queries for Responsive Stacked Table */
@container (width < 760px) {
  table, thead, tbody, tr, th, td {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    margin-block-end: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    padding: 0.5rem;
  }

  td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
  }

  td:last-child {
    border-bottom: none;
  }

  td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
}

/* ==========================================================================
   Modal Dialog
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 7, 24, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: modal-enter 0.25s ease-out;
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.btn-close:hover {
  color: var(--grow-purple);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-muted);
}

.form-input {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--grow-purple);
  box-shadow: 0 0 0 3px var(--grow-purple-glow);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* ==========================================================================
   Floating Brand Bubbles (Matching WhatsApp & Chatbot from screenshot)
   ========================================================================== */

.floating-brand-bubble {
  position: fixed;
  bottom: 1.5rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  z-index: 90;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.floating-brand-bubble:hover {
  transform: scale(1.08);
}

.whatsapp-bubble {
  right: 1.5rem;
  background-color: var(--grow-whatsapp);
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.35);
}

.bot-bubble {
  right: 5.5rem;
  background-color: var(--grow-purple);
  box-shadow: 0 8px 24px var(--grow-purple-glow);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 200;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: auto;
  animation: toast-in 0.25s ease-out;
}

.toast-success {
  border-left: 4px solid var(--grow-emerald);
}

.toast-error {
  border-left: 4px solid #ef4444;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden {
  display: none !important;
}

@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .filter-controls {
    width: 100%;
    justify-content: space-between;
  }

  .topbar-pills {
    display: none;
  }

  .floating-brand-bubble {
    width: 44px;
    height: 44px;
    bottom: 1rem;
  }
  .whatsapp-bubble { right: 1rem; }
  .bot-bubble { right: 4.2rem; }
}
