/* ============================================
   VIBE — Global Design System
   ============================================
   Colors inspired by the Vibe app icon:
   Navy + Blue gradient + Golden yellow
============================================ */

/* ============================================
   1. CSS VARIABLES (Design Tokens)
============================================ */
:root {
  /* Primary — Blue (from icon) */
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #3B82F6;
  --primary-lighter: #DBEAFE;

  /* Secondary — Purple (gradient partner) */
  --secondary: #6C5CE7;
  --secondary-light: #A29BFE;

  /* Accent — Golden (from icon's dot) */
  --accent: #FBBF24;
  --accent-dark: #F59E0B;

  /* Backgrounds */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F8F9FC;
  --bg-tertiary: #F1F3F9;
  --bg-navy: #0F1A3D;

  /* Text */
  --text-primary: #0F1A3D;
  --text-secondary: #6B7280;
  --text-tertiary: #9CA3AF;
  --text-inverse: #FFFFFF;

  /* Status colors */
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;

  /* Borders */
  --border: #E5E7EB;
  --border-light: #F3F4F6;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15,26,61,0.04);
  --shadow-sm: 0 2px 4px rgba(15,26,61,0.06);
  --shadow-md: 0 4px 12px rgba(15,26,61,0.08);
  --shadow-lg: 0 12px 32px rgba(15,26,61,0.12);
  --shadow-primary: 0 8px 24px rgba(37,99,235,0.28);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #2563EB 0%, #6C5CE7 100%);
  --gradient-blue: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  --gradient-accent: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%);
  --gradient-hero: linear-gradient(180deg, #FFFFFF 0%, #F8F9FC 100%);

  /* Radii */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs: 6px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s var(--ease);
  --transition: 0.25s var(--ease);
  --transition-slow: 0.4s var(--ease);
}

/* ============================================
   2. RESET & BASE
============================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p { color: var(--text-secondary); }

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

img, svg { display: block; max-width: 100%; }

ul, ol { list-style: none; }

/* ============================================
   3. LAYOUT HELPERS
============================================ */
.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-wide {
  max-width: 640px;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

.hidden { display: none !important; }

/* ============================================
   4. BUTTONS
============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
  min-height: 52px;
}

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

.btn-block { width: 100%; }

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-primary);
}
.btn-primary:active:not(:disabled) {
  transform: scale(0.97);
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}
.btn-secondary:active:not(:disabled) {
  background: var(--bg-tertiary);
  transform: scale(0.97);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 10px 16px;
  min-height: 44px;
}
.btn-ghost:active { color: var(--primary); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:active {
  background: var(--primary-lighter);
  transform: scale(0.97);
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:active { background: #DC2626; transform: scale(0.97); }

/* Button loading state */
.btn.loading {
  color: transparent !important;
  pointer-events: none;
}
.btn.loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   5. CARDS
============================================ */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: all var(--transition);
}

.card-interactive:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-md);
}

.card-elevated {
  box-shadow: var(--shadow-md);
}

/* ============================================
   6. FORM ELEMENTS
============================================ */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  background: var(--bg-secondary);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: all var(--transition-fast);
  outline: none;
  min-height: 52px;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  background: var(--bg-primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.1);
}

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

.form-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

.form-error {
  font-size: 13px;
  color: var(--danger);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

/* ============================================
   7. STATUS DOT (Active Status Indicator)
============================================ */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.green {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.2);
  animation: pulse-green 2s ease-in-out infinite;
}
.status-dot.yellow {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.2);
}
.status-dot.gray {
  background: var(--text-tertiary);
  box-shadow: 0 0 0 3px rgba(156,163,175,0.15);
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16,185,129,0.2); }
  50% { box-shadow: 0 0 0 6px rgba(16,185,129,0.05); }
}

/* ============================================
   8. AVATAR (Text-based, no images)
============================================ */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  display: grid;
  place-items: center;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
  text-transform: uppercase;
  position: relative;
}

.avatar-sm { width: 36px; height: 36px; font-size: 14px; }
.avatar-lg { width: 64px; height: 64px; font-size: 24px; }
.avatar-xl { width: 96px; height: 96px; font-size: 36px; }

.avatar-wrapper {
  position: relative;
  display: inline-block;
}

.avatar-wrapper .status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  border: 2.5px solid var(--bg-primary);
  width: 14px;
  height: 14px;
}

/* ============================================
   9. BADGES & CHIPS
============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--primary-lighter);
  color: var(--primary);
}

.badge-success {
  background: var(--success-light);
  color: #047857;
}

.badge-warning {
  background: var(--warning-light);
  color: #B45309;
}

.badge-danger {
  background: var(--danger-light);
  color: #B91C1C;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1.5px solid var(--border-light);
  transition: all var(--transition-fast);
  cursor: pointer;
  user-select: none;
}

.chip.active,
.chip.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.chip:active {
  transform: scale(0.95);
}

/* ============================================
   10. ANIMATIONS
============================================ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

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

.animate-fadeUp { animation: fadeUp 0.5s var(--ease) both; }
.animate-fadeIn { animation: fadeIn 0.4s var(--ease) both; }
.animate-scaleIn { animation: scaleIn 0.4s var(--ease) both; }

/* Stagger animation helper */
.stagger > * {
  animation: fadeUp 0.5s var(--ease) both;
}
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.10s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.20s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.30s; }

/* ============================================
   11. DIVIDER
============================================ */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-lg) 0;
  border: none;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-tertiary);
  font-size: 13px;
  margin: var(--space-lg) 0;
}
.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============================================
   12. UTILITY
============================================ */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

/* Safe area for iPhone notch */
.safe-top { padding-top: env(safe-area-inset-top); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }

/* Scrollbar hide */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Prevent text selection */
.no-select { user-select: none; -webkit-user-select: none; }

/* ============================================
   13. LOADING SPINNER
============================================ */
.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) 0;
}

/* ============================================
   14. EMPTY STATE
============================================ */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
}

.empty-state-icon {
  font-size: 56px;
  margin-bottom: var(--space-md);
  opacity: 0.6;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.empty-state-text {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 280px;
  margin: 0 auto;
}

/* ============================================
   15. TOAST
============================================ */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-navy);
  color: white;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s var(--ease);
  max-width: 90vw;
  text-align: center;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}
.toast.toast-error { background: var(--danger); }
.toast.toast-success { background: var(--success); }