/* ============================================================================
   STYLEFIT AI - LUXURY DESIGN SYSTEM
   Based on S-Tier SaaS principles (Stripe, Linear, Airbnb)
   Mobile-First, Accessibility-focused, Premium feel
   ============================================================================ */

/* ============================================================================
   DESIGN TOKENS (CSS Variables)
   ============================================================================ */
:root {
  /* Color Palette - Warm, Sophisticated, Feminine */
  --color-bg-primary: #faf8f5;
  --color-bg-secondary: #ffffff;
  --color-bg-card: rgba(255, 255, 255, 0.85);
  --color-bg-glass: rgba(255, 253, 250, 0.4);

  /* Text Colors */
  --color-text-primary: #2c2c2c;
  --color-text-secondary: #7a7a7a;
  --color-text-tertiary: #a8a8a8;
  --color-text-inverse: #ffffff;

  /* Brand Colors */
  --color-accent-rose: #d4a5a5;
  --color-accent-champagne: #e8d5b7;
  --color-accent-sage: #b5c4a7;
  --color-accent-deep: #a68a64;

  /* Semantic Colors */
  --color-success: #4ade80;
  --color-error: #ef4444;
  --color-warning: #fbbf24;
  --color-info: #60a5fa;

  /* Gradients */
  --gradient-hero: linear-gradient(135deg, #ffffff 0%, #F5F5F7 100%);
  --gradient-card: linear-gradient(145deg, #ffffff 0%, #F5F5F7 100%);
  --gradient-cta: linear-gradient(135deg, #FF6B35 0%, #FF8E53 100%);
  --gradient-shine: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);

  /* Shadows (luxury-focused) */
  --shadow-sm: 0 2px 8px rgba(166, 138, 100, 0.06);
  --shadow-md: 0 8px 32px rgba(166, 138, 100, 0.08);
  --shadow-lg: 0 20px 60px rgba(166, 138, 100, 0.15);
  --shadow-xl: 0 30px 80px rgba(166, 138, 100, 0.2);

  /* Typography */
  --font-display: 'Playfair Display', 'Didot', 'Bodoni', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Type Scale (modular scale 1.25) */
  --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 */

  /* Spacing (8px base unit) */
  --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 */

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-luxury: 500ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --container-max-width: 1200px;
  --content-max-width: 768px;
}

/* Dark Mode Support - Disabled for now until full implementation */
/* TODO: Implement comprehensive dark mode with all page-specific overrides */
/*
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg-primary: #1a1a1a;
    --color-bg-secondary: #2c2c2c;
    --color-bg-card: rgba(44, 44, 44, 0.95);
    --color-text-primary: #f5f5f5;
    --color-text-secondary: #a8a8a8;
    --color-text-tertiary: #7a7a7a;
  }
}
*/

/* ============================================================================
   BASE STYLES & RESET
   ============================================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  overflow-x: hidden;
  min-height: 100vh;
}

/* Typography Styles */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl)); }
h2 { font-size: clamp(var(--text-2xl), 4vw, var(--text-4xl)); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  margin-bottom: var(--space-4);
  line-height: 1.7;
}

a {
  color: var(--color-accent-deep);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-rose);
}

/* Focus Styles (Accessibility) */
:focus-visible {
  outline: 2px solid var(--color-accent-rose);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  min-height: 44px; /* Mobile touch target minimum */
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  text-align: center;
  user-select: none;
}

.btn-primary {
  background: var(--gradient-cta);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient-shine);
  transition: left 0.6s;
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

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

.btn-secondary {
  background: transparent;
  color: #FF6B35;
  border: 1px solid #FF6B35;
}

.btn-secondary:hover {
  background: #FF6B35;
  color: white;
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-primary);
  padding: var(--space-2) var(--space-4);
}

.btn-ghost:hover {
  background: rgba(255, 107, 53, 0.1);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

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

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

/* ============================================================================
   CARDS
   ============================================================================ */
.card {
  background: var(--color-bg-card);
  backdrop-filter: blur(15px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(166, 138, 100, 0.1);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  border-color: var(--color-accent-rose);
}

/* ============================================================================
   INPUTS & FORMS
   ============================================================================ */
.input,
.textarea,
.select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background: var(--color-bg-secondary);
  border: 1px solid rgba(166, 138, 100, 0.2);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--color-accent-rose);
  box-shadow: 0 0 0 3px rgba(212, 165, 165, 0.15);
}

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

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

.form-helper {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-sm);
  color: var(--color-error);
  margin-top: var(--space-1);
}

/* ============================================================================
   LAYOUT
   ============================================================================ */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--space-6);
  }
}

.section {
  padding: var(--space-12) 0;
}

@media (min-width: 768px) {
  .section {
    padding: var(--space-20) 0;
  }
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

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

/* Flexbox Utilities */
.flex {
  display: flex;
  gap: var(--space-4);
}

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

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

/* ============================================================================
   LOADING STATES
   ============================================================================ */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(212, 165, 165, 0.2);
  border-top-color: var(--color-accent-rose);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(166, 138, 100, 0.06) 25%,
    rgba(166, 138, 100, 0.12) 50%,
    rgba(166, 138, 100, 0.06) 75%
  );
  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; }
}

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */
.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  min-width: 280px;
  max-width: 400px;
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border-left: 4px solid var(--color-accent-rose);
  z-index: 9999;
  animation: toast-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* ============================================================================
   MOBILE RESPONSIVENESS
   ============================================================================ */
@media (max-width: 767px) {
  html {
    font-size: 16px; /* Keep at 16px for accessibility (WCAG 2.1) */
  }

  .section {
    padding: var(--space-8) 0;
  }

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

  .btn {
    width: 100%;
  }

  .toast {
    left: var(--space-4);
    right: var(--space-4);
    bottom: var(--space-4);
    min-width: auto;
  }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --color-text-primary: #000000;
    --color-bg-primary: #ffffff;
  }

  .btn-primary {
    border: 2px solid var(--color-text-primary);
  }
}
