/**
 * REPUTIFY DESIGN SYSTEM
 * ======================
 * Core design tokens and CSS variables
 * 
 * Features:
 * - Light & Dark mode support
 * - User-customizable branding variables
 * - Typography: Manrope (headings) + Inter (body)
 * - Modern, trustworthy color palette
 */

/* ============================================
   TYPOGRAPHY IMPORTS
   ============================================ */

/* Google Fonts - Manrope & Inter */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

/* Font Awesome Icons */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');


/* ============================================
   ROOT VARIABLES - LIGHT MODE (DEFAULT)
   ============================================ */

:root {
  
  /* === BRAND COLORS === */
  
  /* Primary - Deep Ocean Blue (trust, intelligence) */
  --primary-900: #08304F;
  --primary-800: #0A3D63;
  --primary-700: #0D4973;
  --primary-600: #0F4C81;    /* Main brand color */
  --primary-500: #1565C0;    /* Interactive elements */
  --primary-400: #1976D2;    /* Hover states */
  --primary-300: #42A5F5;
  --primary-200: #90CAF9;
  --primary-100: #BBDEFB;
  --primary-50: #E3F2FD;
  
  /* Secondary - Vibrant Teal (joy, growth, insights) */
  --secondary-900: #164E63;
  --secondary-800: #155E75;
  --secondary-700: #0E7490;
  --secondary-600: #0891B2;
  --secondary-500: #06B6D4;
  --secondary-400: #22D3EE;
  --secondary-300: #67E8F9;
  --secondary-200: #A5F3FC;
  --secondary-100: #CFFAFE;
  --secondary-50: #ECFEFF;
  
  /* Accent - Coral (actions, alerts, energy) */
  --accent-900: #C62828;
  --accent-800: #D32F2F;
  --accent-700: #E53935;
  --accent-600: #EF5350;
  --accent-500: #FF6B6B;
  --accent-400: #FF8A80;
  --accent-300: #FF9E9E;
  --accent-200: #FFB3B3;
  --accent-100: #FFC9C9;
  --accent-50: #FFE0E0;
  
  /* === SEMANTIC COLORS === */
  
  /* Success (Positive reviews, completed actions) */
  --success-700: #0D9488;
  --success-600: #0F9D8E;
  --success-500: #10B981;
  --success-400: #34D399;
  --success-300: #6EE7B7;
  --success-100: #D1FAE5;
  --success-50: #ECFDF5;
  
  /* Warning (Neutral reviews, pending items) */
  --warning-700: #D97706;
  --warning-600: #EA580C;
  --warning-500: #F59E0B;
  --warning-400: #FBBF24;
  --warning-300: #FCD34D;
  --warning-100: #FEF3C7;
  --warning-50: #FFFBEB;
  
  /* Danger (Negative reviews, errors) */
  --danger-700: #DC2626;
  --danger-600: #E11D48;
  --danger-500: #EF4444;
  --danger-400: #F87171;
  --danger-300: #FCA5A5;
  --danger-100: #FEE2E2;
  --danger-50: #FEF2F2;
  
  /* Info (Information, tips) */
  --info-700: #1D4ED8;
  --info-600: #2563EB;
  --info-500: #3B82F6;
  --info-400: #60A5FA;
  --info-300: #93C5FD;
  --info-100: #DBEAFE;
  --info-50: #EFF6FF;
  
  /* === NEUTRAL COLORS - LIGHT MODE === */
  
  --bg-primary: #F8FAFC;        /* Main background (soft white) */
  --bg-secondary: #FFFFFF;      /* Cards, panels */
  --bg-tertiary: #E2E8F0;       /* Subtle dividers, hover states */
  --bg-elevated: #FFFFFF;       /* Elevated cards with shadow */
  --bg-input: #FFFFFF;          /* Form inputs */
  --bg-hover: #F1F5F9;          /* Hover background */
  
  --text-primary: #1E293B;      /* Headings, primary text (dark) */
  --text-secondary: #475569;    /* Body text (medium) */
  --text-tertiary: #94A3B8;     /* Captions, labels (light) */
  --text-disabled: #CBD5E1;     /* Disabled text */
  --text-inverse: #FFFFFF;      /* Text on dark backgrounds */
  
  --border-primary: #E2E8F0;    /* Default borders */
  --border-secondary: #CBD5E1;  /* Subtle borders */
  --border-focus: #1565C0;      /* Focus states */
  
  /* === SHADOWS === */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  
  /* === TYPOGRAPHY === */
  
  --font-heading: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', Courier, monospace;
  
  /* Font sizes */
  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg: 1.125rem;     /* 18px */
  --text-xl: 1.25rem;      /* 20px */
  --text-2xl: 1.5rem;      /* 24px */
  --text-3xl: 1.875rem;    /* 30px */
  --text-4xl: 2.25rem;     /* 36px */
  --text-5xl: 3rem;        /* 48px */
  
  /* Font weights */
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;
  
  /* Line heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;
  
  /* === SPACING SCALE === */
  
  --spacing-0: 0;
  --spacing-1: 0.25rem;    /* 4px */
  --spacing-2: 0.5rem;     /* 8px */
  --spacing-3: 0.75rem;    /* 12px */
  --spacing-4: 1rem;       /* 16px */
  --spacing-5: 1.25rem;    /* 20px */
  --spacing-6: 1.5rem;     /* 24px */
  --spacing-8: 2rem;       /* 32px */
  --spacing-10: 2.5rem;    /* 40px */
  --spacing-12: 3rem;      /* 48px */
  --spacing-16: 4rem;      /* 64px */
  --spacing-20: 5rem;      /* 80px */
  --spacing-24: 6rem;      /* 96px */
  
  /* === BORDER RADIUS === */
  
  --radius-none: 0;
  --radius-sm: 0.25rem;    /* 4px */
  --radius-base: 0.5rem;   /* 8px */
  --radius-md: 0.75rem;    /* 12px */
  --radius-lg: 1rem;       /* 16px */
  --radius-xl: 1.5rem;     /* 24px */
  --radius-2xl: 2rem;      /* 32px */
  --radius-full: 9999px;   /* Fully rounded */
  
  /* === TRANSITIONS === */
  
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slower: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* === LAYOUT === */
  
  --navbar-height: 64px;
  --footer-height: 70px; /* Height of unified footer (sidebar + main) */
  --sidebar-width: 280px; /* Increased from 260px for better readability (matches Linear, Notion, Stripe standards) */
  --sidebar-collapsed-width: 80px;
  --content-max-width: 1400px;
  
  /* === Z-INDEX SCALE === */
  
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  
  /* === RESPONSIVE BREAKPOINTS === */
  
  --screen-sm: 576px;
  --screen-md: 768px;
  --screen-lg: 992px;
  --screen-xl: 1200px;
  --screen-xxl: 1400px;
  
  /* === USER CUSTOMIZABLE VARIABLES (for Branding & Customization feature) === */
  
  --user-primary-color: var(--primary-500);
  --user-secondary-color: var(--secondary-500);
  --user-accent-color: var(--accent-500);
  --user-logo-url: url('/static/images/logos/logo-light.svg');
  --user-logo-icon-url: url('/static/images/logos/logo-icon.svg');
}


/* ============================================
   DARK MODE VARIABLES
   ============================================ */

[data-theme="dark"] {
  
  /* === NEUTRAL COLORS - DARK MODE === */
  
  --bg-primary: #0F172A;        /* Main background (deep navy) */
  --bg-secondary: #1E293B;      /* Cards, panels */
  --bg-tertiary: #334155;       /* Subtle dividers, hover states */
  --bg-elevated: #1E293B;       /* Elevated cards */
  --bg-input: #1E293B;          /* Form inputs */
  --bg-hover: #334155;          /* Hover background */
  
  --text-primary: #F1F5F9;      /* Headings, primary text (light) */
  --text-secondary: #CBD5E1;    /* Body text (medium) */
  --text-tertiary: #64748B;     /* Captions, labels (darker) */
  --text-disabled: #475569;     /* Disabled text */
  --text-inverse: #0F172A;      /* Text on light backgrounds */
  
  --border-primary: #334155;    /* Default borders */
  --border-secondary: #475569;  /* Subtle borders */
  --border-focus: #42A5F5;      /* Focus states (lighter blue) */
  
  /* Adjust shadows for dark mode */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  
  /* Dark mode logo */
  --user-logo-url: url('/static/images/logos/logo-dark.svg');
}


/* ============================================
   BASE STYLES
   ============================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* === HEADINGS === */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin-bottom: var(--spacing-4);
}

h1 {
  font-size: var(--text-4xl);
  font-weight: var(--font-extrabold);
}

h2 {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
}

h3 {
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
}

h4 {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
}

h5 {
  font-size: var(--text-lg);
  font-weight: var(--font-medium);
}

h6 {
  font-size: var(--text-base);
  font-weight: var(--font-medium);
}

/* === PARAGRAPHS === */

p {
  margin-bottom: var(--spacing-4);
  color: var(--text-secondary);
}

/* === LINKS === */

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

a:hover {
  color: var(--primary-400);
  text-decoration: underline;
}

/* Override underline for navigation links */
.navbar-nav .nav-link:hover,
.sidebar-nav-link:hover,
.sidebar-nav-link:active,
.sidebar-nav-link:focus,
.sidebar-submenu-link:hover,
.sidebar-submenu-link:active,
.sidebar-submenu-link:focus {
  text-decoration: none !important;
}

a:focus {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* === CODE === */

code, kbd, pre, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  padding: 0.125rem 0.25rem;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--accent-600);
}

pre {
  padding: var(--spacing-4);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-base);
  overflow-x: auto;
  margin-bottom: var(--spacing-4);
}

/* === LISTS === */

ul, ol {
  margin-bottom: var(--spacing-4);
  padding-left: var(--spacing-6);
}

li {
  margin-bottom: var(--spacing-2);
  color: var(--text-secondary);
}

/* === HORIZONTAL RULE === */

hr {
  border: 0;
  border-top: 1px solid var(--border-primary);
  margin: var(--spacing-6) 0;
}

/* === SELECTION === */

::selection {
  background-color: var(--primary-200);
  color: var(--text-primary);
}

[data-theme="dark"] ::selection {
  background-color: var(--primary-700);
  color: var(--text-inverse);
}

/* === SCROLLBAR (Webkit) === */

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-secondary);
  border-radius: var(--radius-full);
  border: 3px solid var(--bg-primary);
}

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

/* === FOCUS VISIBLE === */

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* === UTILITY CLASSES === */

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }

.bg-primary { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-tertiary { background-color: var(--bg-tertiary); }

.font-heading { font-family: var(--font-heading); }
.font-body { font-family: var(--font-body); }
.font-mono { font-family: var(--font-mono); }

.transition-base { transition: all var(--transition-base); }
.transition-fast { transition: all var(--transition-fast); }
.transition-slow { transition: all var(--transition-slow); }

/* ============================================
   PAGE HEADER COMPONENT
   ============================================ */

/* Settings Header - Standard page header pattern */
.settings-header {
  margin-bottom: var(--spacing-6);
}

.settings-header .d-flex {
  align-items: flex-start;
}

/* Page Title - Used within settings-header */
.page-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

@media (max-width: 767px) {
  .page-title {
    font-size: 28px;
  }
}

/* Page Description - Used within settings-header */
.page-description {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: 0;
}

@media (max-width: 767px) {
  .page-description {
    font-size: var(--text-sm);
  }
}

/* ============================================
   SECTION HEADER (Sub-section titles)
   ============================================ */

/**
 * .section-header: Container for sub-section headings
 * .section-header-title: H2/H3 heading inside sections like "Analytics & Insights",
 *                        "Sentiment Distribution", etc.
 */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-3);
  margin-top: 0;
  margin-bottom: var(--spacing-4);
}

.section-header-title {
  font-size: 1.25rem; /* 20px, matches inline style used on dashboard */
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

@media (max-width: 767px) {
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-2);
  }

  .section-header-title {
    font-size: var(--text-xl);
  }
}

/* ============================================
   FILTER CHIPS / BADGES COMPONENT
   ============================================ */

/**
 * Filter Chips - Standardized filter/tag/badge components
 * Used for: Category filters, tag selections, status badges, etc.
 * 
 * Usage:
 * - .filter-chip: Base chip style (display only)
 * - .filter-chip-clickable: Clickable/toggleable chip
 * - .filter-chip-selected: Selected/active state
 * - .filter-chip-sm: Small variant (default)
 */

/* Base Filter Chip */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--spacing-1);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: var(--font-medium);
  line-height: 1.2;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

/* Clickable Filter Chip */
.filter-chip-clickable {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px var(--spacing-2);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: var(--font-medium);
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.filter-chip-clickable:hover {
  background: var(--bg-hover);
  border-color: var(--primary-300);
}

.filter-chip-clickable.selected {
  background: var(--primary-500);
  color: var(--text-inverse);
  border-color: var(--primary-500);
}

/* Filter Chip with Remove Button */
.filter-chip-removable {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--spacing-1);
  background: var(--primary-100);
  border: 1px solid var(--primary-300);
  border-radius: var(--radius-sm);
  color: var(--primary-700);
  font-size: 10px;
  font-weight: var(--font-medium);
  line-height: 1.2;
  white-space: nowrap;
}

.filter-chip-removable .remove-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
  font-size: 12px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-chip-removable .remove-btn:hover {
  opacity: 1;
}

/* Size Variants */
.filter-chip-sm,
.filter-chip-clickable-sm {
  padding: 2px var(--spacing-1);
  font-size: 10px;
}

.filter-chip-md,
.filter-chip-clickable-md {
  padding: 4px var(--spacing-2);
  font-size: 11px;
}

.filter-chip-lg,
.filter-chip-clickable-lg {
  padding: 6px var(--spacing-3);
  font-size: var(--text-sm);
}

/* Color Variants */
.filter-chip-primary {
  background: var(--primary-100);
  color: var(--primary-700);
  border-color: var(--primary-300);
}

.filter-chip-success {
  background: var(--success-100);
  color: var(--success-700);
  border-color: var(--success-300);
}

.filter-chip-warning {
  background: var(--warning-100);
  color: var(--warning-700);
  border-color: var(--warning-300);
}

.filter-chip-danger {
  background: var(--danger-100);
  color: var(--danger-700);
  border-color: var(--danger-300);
}

.filter-chip-info {
  background: var(--info-100);
  color: var(--info-700);
  border-color: var(--info-300);
}

.filter-chip-neutral {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-color: var(--border-primary);
}

/* Dark Mode Adjustments */
[data-theme="dark"] .filter-chip-clickable {
  background: var(--bg-secondary);
  border-color: var(--border-primary);
}

[data-theme="dark"] .filter-chip-clickable:hover {
  background: var(--bg-hover);
  border-color: var(--primary-300);
}

[data-theme="dark"] .filter-chip-removable {
  background: var(--primary-900);
  border-color: var(--primary-700);
  color: var(--primary-200);
}

[data-theme="dark"] .filter-chip-primary {
  background: var(--primary-900);
  color: var(--primary-200);
  border-color: var(--primary-700);
}

