/**
 * Onisomi Design System v2.0
 * ChatGPT-like Light Theme First
 *
 * Philosophy:
 * - Light theme is primary (clean, readable, calm)
 * - Dark theme is available as alternative
 * - Maximum readability
 * - Consistent across all pages
 * - No visual clutter
 */

/* ========================================
   1. CSS VARIABLES - LIGHT FIRST
   ======================================== */

:root {
  /* ===== COLORS - LIGHT THEME (Default) ===== */

  /* Background Layers - Pure White for Flat Design */
  --bg-primary: #ffffff;
  --bg-secondary: #ffffff;
  --bg-tertiary: #fafafa;
  --bg-hover: rgba(0, 0, 0, 0.03);
  --bg-active: rgba(0, 0, 0, 0.06);

  /* Text Colors - High Contrast for Readability */
  --text-primary: #0d0d0d;
  --text-secondary: #4a4a4a;
  --text-tertiary: #6e6e80;
  --text-muted: #8e8ea0;
  --text-placeholder: #acacbe;

  /* Border Colors - More Visible for Flat Design */
  --border-light: rgba(0, 0, 0, 0.10);
  --border-medium: rgba(0, 0, 0, 0.15);
  --border-strong: rgba(0, 0, 0, 0.22);

  /* Accent - Soft Purple (Onisomi brand) */
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: rgba(124, 58, 237, 0.1);
  --accent-glow: rgba(124, 58, 237, 0.2);

  /* Secondary Accent - Cyan */
  --accent-secondary: #06b6d4;
  --accent-secondary-soft: rgba(6, 182, 212, 0.1);

  /* Semantic Colors */
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.1);
  --error: #ef4444;
  --error-soft: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.1);
  --info: #3b82f6;
  --info-soft: rgba(59, 130, 246, 0.1);

  /* Surface Colors */
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-overlay: rgba(255, 255, 255, 0.95);

  /* Shadows - Subtle for Light Theme */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);

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

  /* Font Families */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-logo: 'Afacad', var(--font-sans);
  --font-mono: 'SF Mono', 'Fira Code', monospace;

  /* Font Sizes - Clear Hierarchy */
  --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 */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Line Heights - Optimized for Reading */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 1.75;

  /* Letter Spacing */
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;

  /* ===== SPACING - 4px Base ===== */
  --space-0: 0;
  --space-1: 0.25rem;    /* 4px */
  --space-2: 0.5rem;     /* 8px */
  --space-3: 0.75rem;    /* 12px */
  --space-4: 1rem;       /* 16px */
  --space-5: 1.25rem;    /* 20px */
  --space-6: 1.5rem;     /* 24px */
  --space-8: 2rem;       /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */
  --space-20: 5rem;      /* 80px */
  --space-24: 6rem;      /* 96px */

  /* ===== BORDERS ===== */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* ===== TRANSITIONS ===== */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.15, 0.265, 1.15);

  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;

  /* ===== Z-INDEX ===== */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;

  /* ===== LAYOUT ===== */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1200px;
  --container-2xl: 1400px;

  --header-height: 60px;

  /* Gradients */
  --gradient-brand: linear-gradient(135deg, var(--accent), var(--accent-secondary));
}

/* ========================================
   DARK THEME OVERRIDE
   ======================================== */

[data-theme="dark"] {
  /* Background Layers */
  --bg-primary: #0d0d0d;
  --bg-secondary: #171717;
  --bg-tertiary: #212121;
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-active: rgba(255, 255, 255, 0.1);

  /* Text Colors */
  --text-primary: #ececec;
  --text-secondary: #b4b4b4;
  --text-tertiary: #8e8e8e;
  --text-muted: #6b6b6b;
  --text-placeholder: #525252;

  /* Border Colors */
  --border-light: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.18);

  /* Accent - Brighter for dark bg */
  --accent: #a78bfa;
  --accent-hover: #b89dfc;
  --accent-soft: rgba(167, 139, 250, 0.15);
  --accent-glow: rgba(167, 139, 250, 0.25);

  /* Secondary Accent */
  --accent-secondary: #67e8f9;
  --accent-secondary-soft: rgba(103, 232, 249, 0.15);

  /* Surface Colors */
  --surface: #171717;
  --surface-raised: #212121;
  --surface-overlay: rgba(23, 23, 23, 0.95);

  /* Shadows - Stronger for dark theme */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
}

/* ========================================
   2. RESET & BASE
   ======================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: #ffffff !important;
  background-image: none !important;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: #ffffff !important;
  background-image: none !important;
  min-height: 100vh;
}

/* No gradient overlay - keep it clean */
html:not([data-theme="dark"]) body {
  background: #ffffff !important;
  background-image: none !important;
}

/* Links */
a {
  color: inherit;
  text-decoration: none;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Focus */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background: var(--accent-soft);
  color: var(--text-primary);
}

/* ========================================
   3. LAYOUT
   ======================================== */

.container {
  width: 100%;
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-sm { max-width: var(--container-sm); }
.container-md { max-width: var(--container-md); }
.container-lg { max-width: var(--container-lg); }

/* Page Layout */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-main {
  flex: 1;
  padding: var(--space-12) 0;
}

/* ========================================
   4. HEADER
   ======================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--header-height);
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-light);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

/* Logo - standart stiller */
.logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  transition: transform .3s var(--ease-default);
}

.logo:hover {
  transform: scale(1.05);
}

.logo-icon,
.logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  transition: all .3s ease;
}

.logo:hover .logo-icon,
.logo:hover .logo-img {
  transform: scale(1.08);
}

/* Theme-based logo switching - Light varsayılan */
.logo-light {
  display: block;
}
.logo-dark {
  display: none;
}
[data-theme="dark"] .logo-light {
  display: none;
}
[data-theme="dark"] .logo-dark {
  display: block;
}

/* Logo text - Light: siyah, Dark: beyaz */
.logo-text {
  font-family: 'Afacad', sans-serif;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #1a1a1a;
}

[data-theme="dark"] .logo-text {
  color: #ffffff;
}

/* Navigation */
.nav-main {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav-link {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-default);
}

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

.nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Theme Toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-size: var(--text-lg);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}

.theme-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-medium);
}

/* Mobile Nav Toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-tertiary);
  border-radius: 1px;
  transition: all var(--duration-fast);
}

@media (max-width: 768px) {
  .nav-main {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    padding: var(--space-6);
    gap: var(--space-2);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    transform: translateY(-120%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-default);
    z-index: var(--z-dropdown);
  }

  .nav-main.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-link {
    width: 100%;
    text-align: center;
    padding: var(--space-3) var(--space-4);
  }

  .nav-toggle {
    display: flex;
  }
}

/* ========================================
   5. FOOTER
   ======================================== */

.site-footer {
  padding: var(--space-8) 0;
  border-top: 1px solid var(--border-light);
  background: var(--bg-primary);
  margin-top: auto;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-6);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.footer-logo {
  width: 28px;
  height: 28px;
}

.footer-copy {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
}

.footer-link {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  transition: color var(--duration-fast);
}

.footer-link:hover {
  color: var(--text-primary);
}

@media (max-width: 640px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }
}

/* ========================================
   6. BUTTONS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  text-decoration: none;
}

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

/* Primary Button */
.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* Secondary Button */
.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

/* Light theme: more visible secondary button */
[data-theme="light"] .btn-secondary,
html:not([data-theme="dark"]) .btn-secondary {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #374151;
}

[data-theme="light"] .btn-secondary:hover:not(:disabled),
html:not([data-theme="dark"]) .btn-secondary:hover:not(:disabled) {
  background: #e5e7eb;
  border-color: #9ca3af;
  color: #1f2937;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-medium);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

/* Light theme: more visible ghost button */
[data-theme="light"] .btn-ghost,
html:not([data-theme="dark"]) .btn-ghost {
  color: #4b5563;
}

[data-theme="light"] .btn-ghost:hover:not(:disabled),
html:not([data-theme="dark"]) .btn-ghost:hover:not(:disabled) {
  background: #f3f4f6;
  color: #1f2937;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

.btn-full { width: 100%; }

/* ========================================
   7. FORM ELEMENTS
   ======================================== */

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  transition: all var(--duration-fast) var(--ease-default);
}

/* Light theme: more visible input borders */
[data-theme="light"] .form-input,
html:not([data-theme="dark"]) .form-input {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #1f2937;
}

[data-theme="light"] .form-input:hover,
html:not([data-theme="dark"]) .form-input:hover {
  border-color: #9ca3af;
}

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

[data-theme="light"] .form-input::placeholder,
html:not([data-theme="dark"]) .form-input::placeholder {
  color: #9ca3af;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

[data-theme="light"] .form-input:focus,
html:not([data-theme="dark"]) .form-input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.form-input.error {
  border-color: var(--error);
}

/* Textarea */
textarea.form-input {
  min-height: 120px;
  resize: vertical;
  line-height: var(--leading-relaxed);
}

/* Select */
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236e6e80' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
}

/* Form Messages */
.form-error,
.form-success {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

.form-error {
  background: var(--error-soft);
  border: 1px solid var(--error);
  color: var(--error);
}

.form-success {
  background: var(--success-soft);
  border: 1px solid var(--success);
  color: var(--success);
}

/* ========================================
   8. CARDS
   ======================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: all var(--duration-normal) var(--ease-default);
}

.card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

/* Path Card - Homepage */
.path-card {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: var(--space-8) var(--space-6);
}

.path-emoji {
  font-size: 2.5rem;
  display: block;
  margin-bottom: var(--space-4);
  transition: transform var(--duration-slow) var(--ease-bounce);
}

.path-card:hover .path-emoji {
  transform: scale(1.1);
}

.path-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.path-subtitle {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* ========================================
   9. TYPOGRAPHY UTILITIES
   ======================================== */

.text-display { font-family: var(--font-display); }
.text-logo { font-family: var(--font-logo); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

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

/* ========================================
   10. SPACING UTILITIES
   ======================================== */

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.py-12 { padding-top: var(--space-12); padding-bottom: var(--space-12); }

/* ========================================
   11. GRID UTILITIES
   ======================================== */

.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ========================================
   12. FLEX UTILITIES
   ======================================== */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* ========================================
   13. ANIMATIONS
   ======================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

.animate-fade-in {
  animation: fadeIn var(--duration-slow) var(--ease-default) both;
}

.animate-fade-in-up {
  animation: fadeInUp var(--duration-slow) var(--ease-default) both;
}

/* ========================================
   14. LOADING STATES
   ======================================== */

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

/* Skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 0%,
    var(--bg-secondary) 50%,
    var(--bg-tertiary) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ========================================
   15. VISIBILITY
   ======================================== */

.hidden { display: none !important; }

@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

/* ========================================
   16. SCROLLBAR
   ======================================== */

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

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

::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}

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

/* ========================================
   17. TOAST NOTIFICATIONS
   ======================================== */

.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-toast);
  animation: fadeInUp var(--duration-normal) var(--ease-default);
}

.toast-success { border-color: var(--success); }
.toast-error { border-color: var(--error); }
.toast-warning { border-color: var(--warning); }

@media (max-width: 480px) {
  .toast {
    left: var(--space-4);
    right: var(--space-4);
    bottom: var(--space-4);
  }
}

/* ========================================
   18. LEGACY COMPATIBILITY
   ======================================== */

/* Map old variable names to new ones */
:root {
  /* Old names -> New names */
  --moonlight: var(--text-primary);
  --stardust: var(--text-secondary);
  --mist: var(--text-tertiary);
  --fog: var(--text-muted);
  --lavender: var(--accent);
  --lavender-soft: var(--accent-soft);
  --lavender-glow: var(--accent-glow);
  --aurora: var(--accent-secondary);
  --night: var(--bg-secondary);
  --midnight: var(--bg-primary);
  --dusk: var(--bg-tertiary);
  --twilight: var(--border-medium);
  --border-subtle: 1px solid var(--border-light);
  --border-light: 1px solid var(--border-medium);
  --font-body: var(--font-sans);
  --transition-normal: var(--duration-normal);
  --transition-fast: var(--duration-fast);
  --glass-bg: var(--surface);
  --border-color: var(--border-light);
}

/* ========================================
   19. MOBILE ENHANCEMENTS
   ======================================== */

/* Touch Target Minimum - 44x44px */
@media (max-width: 768px) {
  .btn,
  button,
  [role="button"],
  input[type="submit"],
  input[type="button"] {
    min-height: 44px;
    min-width: 44px;
  }

  /* Reduce container padding on small screens */
  .container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

/* Extra small screens (iPhone SE, older devices) */
@media (max-width: 375px) {
  :root {
    --text-base: 15px;
    --text-sm: 13px;
    --text-xs: 11px;
  }

  .container {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  /* Prevent horizontal overflow */
  body {
    overflow-x: hidden;
  }

  /* Smaller gaps on tiny screens */
  .flex { gap: var(--space-2); }
  .grid { gap: var(--space-3); }
}

/* Very small screens */
@media (max-width: 320px) {
  :root {
    --text-base: 14px;
    --text-sm: 12px;
  }

  .container {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }
}

/* Ensure minimum font size for readability */
@media (max-width: 768px) {
  p, span, li, td, th, label, input, textarea, select {
    font-size: max(var(--text-sm), 14px);
  }

  /* Prevent text from being too small */
  small, .text-xs {
    font-size: max(var(--text-xs), 12px);
  }
}

/* Hide scrollbar on mobile for cleaner look */
@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 4px;
    height: 4px;
  }
}

/* ========================================
   20. FLAT DESIGN SYSTEM - Twitter/Threads Style
   ======================================== */

/* Light mode (default) - pure white backgrounds */
:root,
[data-theme="light"] {
  /* Flat design separators - more visible */
  --separator: #e8e8e8;
  --separator-strong: #d4d4d4;
}

[data-theme="dark"] {
  --separator: rgba(255, 255, 255, 0.10);
  --separator-strong: rgba(255, 255, 255, 0.15);
}

/* CRITICAL: Enforce theme backgrounds */
html {
  background-color: #ffffff;
}

[data-theme="dark"] html {
  background-color: #0d0d0d;
}

body {
  background-color: #ffffff;
}

[data-theme="light"] body,
html:not([data-theme="dark"]) body {
  background-color: #ffffff !important;
}

[data-theme="dark"] body {
  background-color: #0d0d0d !important;
}

/* Main content areas */
main,
.page-main,
.main-content,
.dreams-main,
.echo-main,
.profile-main,
.interpret-main {
  background-color: var(--bg-primary);
}

[data-theme="light"] main,
[data-theme="light"] .page-main,
[data-theme="light"] .main-content {
  background-color: #ffffff !important;
}

[data-theme="dark"] main,
[data-theme="dark"] .page-main,
[data-theme="dark"] .main-content {
  background-color: #0d0d0d !important;
}

/* Cards - white background with visible borders */
.card,
.surface,
.box {
  background-color: #ffffff;
  border: 1px solid var(--separator-strong);
}

[data-theme="light"] .card,
[data-theme="light"] .surface,
html:not([data-theme="dark"]) .card,
html:not([data-theme="dark"]) .surface {
  background-color: #ffffff;
  border: 1px solid var(--separator-strong);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .card:hover,
html:not([data-theme="dark"]) .card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Dark theme card styles */
[data-theme="dark"] .card,
[data-theme="dark"] .surface,
[data-theme="dark"] .box {
  background-color: #171717;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

[data-theme="dark"] .card:hover {
  background-color: #1f1f1f;
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ========================================
   20.1 FLAT LIST ITEMS - No cards, just separators
   ======================================== */

/* List item - Twitter/Threads style */
.list-item {
  display: block;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--separator);
  text-decoration: none;
  color: inherit;
  transition: background var(--duration-fast);
}

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

.list-item:hover {
  background: var(--bg-hover);
  margin: 0 calc(-1 * var(--space-4));
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

/* Clickable list item */
.list-item-link {
  cursor: pointer;
}

.list-item-link:active {
  background: var(--bg-active);
}

/* List container */
.flat-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ========================================
   20.2 MINIMAL CARDS - Only when needed
   ======================================== */

/* Subtle card - very minimal */
.card-subtle {
  background: var(--bg-primary);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

/* Featured card - slightly more prominent */
.card-featured {
  background: var(--bg-primary);
  border: 1px solid var(--separator-strong);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.card-featured:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .card-featured:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* No card - pure content */
.card-none {
  background: transparent;
  border: none;
  padding: 0;
}

/* ========================================
   20.3 SECTION DIVIDERS
   ======================================== */

.section-divider {
  height: 8px;
  background: var(--bg-tertiary);
  margin: 0 calc(-1 * var(--space-4));
}

.divider-line {
  height: 1px;
  background: var(--separator);
  margin: var(--space-4) 0;
}

/* ========================================
   20.4 FLAT TYPOGRAPHY
   ======================================== */

.section-header-flat {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-3) 0;
  margin: 0;
}

.content-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
}

.content-meta {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* ========================================
   20.5 POST/FEED ITEM - Social style
   ======================================== */

.feed-item {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--separator);
}

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

.feed-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.feed-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.feed-meta {
  flex: 1;
  min-width: 0;
}

.feed-author {
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.feed-time {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.feed-content {
  font-size: var(--text-base);
  color: var(--text-primary);
  line-height: var(--leading-relaxed);
}

.feed-actions {
  display: flex;
  gap: var(--space-6);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
}

.feed-action {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--duration-fast);
}

.feed-action:hover {
  color: var(--accent);
}

/* ========================================
   21. MOBILE WEB - APP-LIKE EXPERIENCE
   ======================================== */

@media (max-width: 768px) {
  /* Wider content areas - less padding */
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Cards should be full-width on mobile */
  .card,
  .surface,
  .box {
    border-radius: 8px;
    margin-left: 0;
    margin-right: 0;
  }

  /* Input fields - full width, larger touch targets */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  textarea,
  select {
    width: 100%;
    min-height: 48px;
    font-size: 16px; /* Prevents iOS zoom on focus */
    padding: 12px;
    border-radius: 8px;
  }

  /* Buttons - full width on mobile when in button groups */
  .btn-group .btn,
  .button-row .btn {
    flex: 1;
  }

  /* Typography - slightly larger on mobile for readability */
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  /* Lists - more touch-friendly spacing */
  li {
    padding: 8px 0;
  }

  /* Remove hover effects on mobile (touch devices) */
  @media (hover: none) {
    .btn:hover,
    button:hover,
    a:hover {
      transform: none;
    }
  }

  /* Bottom padding for mobile nav */
  main,
  .main-content,
  .page-content {
    padding-bottom: 80px;
  }
}
