/* ==========================================================================
   SocialSpark Studio - All-in-One Social & Creator Tools Design System
   Modern, responsive, glassmorphic UI with Dark & Light theme support.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* --------------------------------------------------------------------------
   1. CSS Custom Properties / Design Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Color Palette - Vibrant Creator Brand */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.12);
  --primary-glow: rgba(99, 102, 241, 0.25);

  --accent-pink: #ec4899;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  /* Light Theme Defaults */
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f1f5f9;
  --bg-surface-glass: rgba(255, 255, 255, 0.85);

  --border-light: #e2e8f0;
  --border-focus: #818cf8;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --card-shadow-hover: 0 12px 24px -4px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --modal-backdrop: rgba(15, 23, 42, 0.55);

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

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg-main: #090d16;
  --bg-surface: #111827;
  --bg-surface-alt: #1a2234;
  --bg-surface-glass: rgba(17, 24, 39, 0.85);

  --border-light: #242f45;
  --border-focus: #6366f1;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;

  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --card-shadow-hover: 0 16px 32px -4px rgba(0, 0, 0, 0.6), 0 4px 8px -2px rgba(0, 0, 0, 0.4);
  --modal-backdrop: rgba(3, 7, 18, 0.8);
}

/* --------------------------------------------------------------------------
   2. Base & Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   3. Header & Navigation
   -------------------------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}

.header-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-main);
  text-decoration: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.brand-text {
  background: linear-gradient(135deg, #6366f1 20%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.brand-tagline {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface-alt);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

/* Nav Pills */
.main-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface-alt);
  padding: 0.3rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  overflow-x: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text-main);
  background-color: rgba(99, 102, 241, 0.08);
}

.nav-link.active {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 4px 10px var(--primary-glow);
}

/* Header Utilities */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-btn {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.icon-btn:hover {
  background: var(--primary-light);
  border-color: var(--border-focus);
}

.saved-count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent-pink);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-full);
  display: none;
}

.saved-count-badge.visible {
  display: inline-block;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  border-color: var(--border-focus);
  background: var(--primary-light);
}

/* --------------------------------------------------------------------------
   4. Hero Banner Section
   -------------------------------------------------------------------------- */
.hero-banner {
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.15) 0%, rgba(236, 72, 153, 0.05) 50%, transparent 100%);
  padding: 2.5rem 1.5rem 1.75rem;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
}

.hero-container {
  max-width: 900px;
  margin: 0 auto;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.95rem;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  border: 1px solid var(--primary-glow);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero-title {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.text-gradient {
  background: linear-gradient(135deg, #6366f1 20%, #ec4899 70%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 720px;
  margin: 0 auto 1.5rem;
}

.hero-quick-jumps {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.quick-jump-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: var(--transition);
}

.quick-jump-pill:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--card-shadow-hover);
}

/* --------------------------------------------------------------------------
   5. Main App Layout & Tabs
   -------------------------------------------------------------------------- */
.app-main {
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
  width: 100%;
}

.tool-tab-content {
  display: none;
  animation: fadeIn 0.3s ease forwards;
}

.tool-tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-header-box {
  margin-bottom: 1.75rem;
}

.tab-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.tab-subtitle {
  color: var(--text-muted);
  font-size: 0.98rem;
}

/* Two-Column Studio Layout */
.tool-grid-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 1.75rem;
  align-items: start;
}

@media (max-width: 992px) {
  .tool-grid-layout {
    grid-template-columns: 1fr;
  }
}

/* Cards & Containers */
.card-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  transition: var(--transition);
}

.card-panel:hover {
  box-shadow: var(--card-shadow-hover);
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Form Controls */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
  color: var(--text-main);
}

.form-label-hint {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background-color: var(--bg-surface-alt);
  color: var(--text-main);
  transition: var(--transition);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  background-color: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-textarea {
  resize: vertical;
  min-height: 90px;
}

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

/* Slider */
.slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.slider-input {
  flex: 1;
  accent-color: var(--primary);
}

.slider-value-pill {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  min-width: 36px;
  text-align: center;
}

/* Toggles / Checkboxes */
.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg-surface-alt);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.toggle-label {
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-light);
  transition: .3s;
  border-radius: 34px;
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider-round {
  background-color: var(--primary);
}

input:checked + .slider-round:before {
  transform: translateX(20px);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--primary-glow);
}

.btn-secondary {
  background: var(--bg-surface-alt);
  color: var(--text-main);
  border-color: var(--border-light);
}

.btn-secondary:hover {
  background: var(--border-light);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: #ef4444;
  color: #fff;
}

.btn-sm {
  padding: 0.38rem 0.75rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* Samples / Quick Pills */
.sample-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.sample-pill {
  font-size: 0.75rem;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.sample-pill:hover, .sample-pill.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   6. Hashtag Generator Styles
   -------------------------------------------------------------------------- */
.hashtag-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.25rem;
  max-height: 480px;
  overflow-y: auto;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
}

.hashtag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  font-size: 0.86rem;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.hashtag-chip:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

.hashtag-chip.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.hashtag-chip .chip-reach {
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface-alt);
  color: var(--text-muted);
}

.hashtag-chip.viral .chip-reach {
  background: rgba(236, 72, 153, 0.15);
  color: #ec4899;
}

.hashtag-chip.high .chip-reach {
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
}

.hashtag-chip.niche .chip-reach {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.hashtag-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.hashtag-stats {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   7. Photo Caption Generator Styles
   -------------------------------------------------------------------------- */
.caption-results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.caption-result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--card-shadow);
  transition: var(--transition);
}

.caption-result-card:hover {
  border-color: var(--border-focus);
}

.caption-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.caption-style-badge {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
}

.caption-metrics {
  display: flex;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.caption-editable-text {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
  color: var(--text-main);
  padding: 0.75rem;
  font-size: 0.92rem;
  line-height: 1.55;
  resize: vertical;
  margin-bottom: 0.75rem;
  outline: none;
}

.caption-editable-text:focus {
  border-color: var(--primary);
  background: var(--bg-surface);
}

.caption-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-hint {
  font-size: 0.75rem;
  color: var(--text-light);
}

.caption-actions {
  display: flex;
  gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   8. Bio Generator Styles
   -------------------------------------------------------------------------- */
.bio-results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .bio-results-grid {
    grid-template-columns: 1fr;
  }
}

.bio-result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
}

.bio-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.bio-style-badge {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.12);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
}

.bio-char-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.bio-text {
  font-family: inherit;
  font-size: 0.92rem;
  white-space: pre-wrap;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-bottom: 1rem;
  flex: 1;
}

.bio-card-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   9. Influencer Engagement Rate Calculator Styles
   -------------------------------------------------------------------------- */
.formula-callout-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(236, 72, 153, 0.05) 100%);
  border: 1px solid var(--primary-glow);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.formula-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.formula-math {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  font-family: monospace;
}

.formula-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 480px;
}

/* Live Score & Gauge Dashboard */
.er-dashboard-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}

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

.er-gauge-card {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-svg-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 0.75rem;
}

.gauge-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.gauge-bg {
  fill: none;
  stroke: var(--border-light);
  stroke-width: 10;
}

.gauge-fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 0.8s ease, stroke 0.3s ease;
}

.gauge-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.gauge-rate-val {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.gauge-rate-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.badge {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 0.5rem;
}

.badge-low { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.badge-avg { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-good { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-high { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.badge-viral { background: rgba(236, 72, 153, 0.15); color: #ec4899; }

/* Analysis Cards */
.er-analysis-card {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.er-math-breakdown {
  font-family: monospace;
  font-size: 0.95rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  color: var(--primary);
  font-weight: 600;
}

.er-tier-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.er-tier-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.benchmark-pill {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.benchmark-pill.favorable {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.benchmark-pill.unfavorable {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Brand Judgment & Valuation */
.brand-valuation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

@media (max-width: 768px) {
  .brand-valuation-grid {
    grid-template-columns: 1fr;
  }
}

.brand-insight-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.insight-header {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.insight-big-text {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-emerald);
  margin-bottom: 0.35rem;
}

.insight-body-text {
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.5;
}

/* Pitch Box */
.brand-pitch-box {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.pitch-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.88rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  color: var(--text-main);
  margin-bottom: 0.85rem;
  resize: vertical;
}

/* --------------------------------------------------------------------------
   10. AI Assistant Chatbot Styles
   -------------------------------------------------------------------------- */
/* Floating Widget Trigger */
.floating-chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 8px 24px var(--primary-glow);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-chat-trigger:hover {
  transform: scale(1.08);
}

.floating-ping-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: var(--accent-emerald);
  border: 2px solid var(--bg-surface);
  border-radius: 50%;
}

/* Floating Chat Panel */
.floating-chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 1000;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition);
}

.floating-chat-panel.active {
  display: flex;
}

.chat-panel-header {
  padding: 1rem 1.25rem;
  background: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-panel-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 0.98rem;
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
}

/* Chat Messages */
.chat-messages-container {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-message {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

.chat-message.user {
  align-self: flex-end;
}

.chat-message.assistant {
  align-self: flex-start;
  max-width: 95%;
}

.message-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.chat-message.user .message-meta {
  text-align: right;
}

.message-bubble {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.5;
}

.chat-message.user .message-bubble {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-bubble {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
}

/* Chat Code Blocks */
.chat-code-block {
  background: #0f172a;
  color: #f8fafc;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  margin: 0.5rem 0;
  overflow-x: auto;
}

.inline-code {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
  font-size: 0.85em;
}

.chat-suggestions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.chat-suggestion-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-focus);
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.chat-suggestion-chip:hover {
  background: var(--primary);
  color: #fff;
}

.message-actions {
  display: flex;
  margin-top: 0.25rem;
}

.btn-copy-msg {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 0.75rem;
  cursor: pointer;
}

.btn-copy-msg:hover {
  color: var(--text-main);
}

/* Chat Form & Input */
.chat-input-wrapper {
  padding: 0.85rem 1.25rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-input {
  flex: 1;
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--bg-surface-alt);
  color: var(--text-main);
  outline: none;
}

.chat-input:focus {
  border-color: var(--border-focus);
}

/* Typing Indicator Animation */
.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.6rem 0.85rem !important;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* --------------------------------------------------------------------------
   11. Extra Tools: Viral Hooks & Limit Cards
   -------------------------------------------------------------------------- */
.hooks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.hook-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hook-category-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.hook-text {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 1rem;
  line-height: 1.45;
}

.platform-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.platform-limit-card {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.1rem;
}

.platform-limit-card.limit-exceeded {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.plat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.plat-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.plat-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
}

.badge-ok { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.plat-progress-bar {
  height: 6px;
  background: var(--border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.plat-progress-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.plat-details {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.plat-note {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.35rem;
}

/* --------------------------------------------------------------------------
   12. Modal & Drawer Styles
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  width: 680px;
  max-width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  background: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: var(--bg-surface-alt);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.saved-item-row {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}

.saved-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.saved-type-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
}

.saved-type-badge.hashtag { background: rgba(99, 102, 241, 0.15); color: #6366f1; }
.saved-type-badge.caption { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.saved-type-badge.bio { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.saved-type-badge.engagement { background: rgba(16, 185, 129, 0.15); color: #10b981; }

.saved-item-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.saved-item-preview pre {
  font-family: inherit;
  font-size: 0.85rem;
  white-space: pre-wrap;
  color: var(--text-muted);
  max-height: 120px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
}

.saved-item-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: block;
}

/* --------------------------------------------------------------------------
   13. Toast Notification Pill
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-pill {
  pointer-events: auto;
  background: #0f172a;
  color: #fff;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  animation: toastSlideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  transition: opacity 0.3s ease;
}

.toast-pill.fading {
  opacity: 0;
}

.toast-pill.warning {
  background: #b45309;
}

.toast-pill.error {
  background: #b91c1c;
}

@keyframes toastSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   14. Footer
   -------------------------------------------------------------------------- */
.app-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  padding: 2rem 1.5rem;
  margin-top: 3rem;
  text-align: center;
}

.footer-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.footer-links {
  display: flex;
  gap: 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.footer-copy {
  font-size: 0.82rem;
  color: var(--text-light);
}

/* --------------------------------------------------------------------------
   15. Utilities & Responsive Tweaks
   -------------------------------------------------------------------------- */
.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .hero-title {
    font-size: 1.75rem;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .formula-callout-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-container {
    padding: 0.75rem 1rem;
  }
  .brand-tagline {
    display: none;
  }
}
