/* ============================================
   KAMELION DARK THEME - Premium Design System
   ============================================ */

/* Root Variables */
:root {
  /* Base Colors - Deep Purple Dark Mode */
  --black: #0a0a0b;
  --gray-950: #0f0f10;
  --gray-900: #18181b;
  --gray-800: #27272a;
  --gray-700: #3f3f46;
  --gray-600: #52525b;
  --gray-500: #71717a;
  --gray-400: #a1a1aa;
  --gray-300: #d4d4d8;
  --gray-200: #e4e4e7;
  --gray-100: #f4f4f5;
  --white: #ffffff;
  
  /* Primary - Purple Gradient */
  --purple-900: #4c1d95;
  --purple-800: #5b21b6;
  --purple-700: #6d28d9;
  --purple-600: #7c3aed;
  --purple-500: #8b5cf6;
  --purple-400: #a78bfa;
  --purple-300: #c4b5fd;
  --purple-200: #ddd6fe;
  --purple-100: #ede9fe;
  
  /* Accent Colors */
  --emerald-500: #10b981;
  --emerald-400: #34d399;
  --blue-500: #3b82f6;
  --blue-400: #60a5fa;
  --amber-500: #f59e0b;
  --amber-400: #fbbf24;
  --red-500: #ef4444;
  --red-400: #f87171;
  
  /* Semantic */
  --success: var(--emerald-500);
  --warning: var(--amber-500);
  --error: var(--red-500);
  --info: var(--blue-500);
  
  /* Surfaces */
  --surface-base: var(--black);
  --surface-card: rgba(24, 24, 27, 0.8);
  --surface-elevated: rgba(39, 39, 42, 0.9);
  --surface-overlay: rgba(10, 10, 11, 0.95);
  
  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  
  /* Text */
  --text-primary: var(--gray-100);
  --text-secondary: var(--gray-400);
  --text-muted: var(--gray-500);
  --text-inverse: var(--gray-900);
  
  /* Gradients */
  --gradient-purple: linear-gradient(135deg, var(--purple-600), var(--purple-500));
  --gradient-glow: linear-gradient(135deg, var(--purple-500), var(--blue-500));
  --gradient-dark: linear-gradient(180deg, var(--gray-900), var(--black));
  
  /* Shadows */
  --shadow-sm: 0 0 0 1px var(--border-subtle), 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 0 0 1px var(--border-subtle), 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 0 0 1px var(--border-subtle), 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 0 0 1px var(--border-subtle), 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.3);
  
  /* Animations */
  --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);
  
  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
}

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

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

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

body {
  background: var(--surface-base);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Background gradient effect */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 20% 50%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

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

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: var(--gradient-purple);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

a {
  color: var(--purple-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--purple-300);
}

/* ============================================
   CONTAINERS & LAYOUTS
   ============================================ */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: var(--surface-card);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  padding: 2rem;
}

.app-sidebar {
  grid-column: span 1;
}

/* ============================================
   CARDS & SURFACES
   ============================================ */

.card {
  background: var(--surface-card);
  backdrop-filter: blur(40px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent,
    rgba(139, 92, 246, 0.5),
    transparent
  );
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
  border-color: rgba(139, 92, 246, 0.2);
}

.card:hover::before {
  opacity: 1;
}

.card-elevated {
  background: var(--surface-elevated);
  box-shadow: var(--shadow-xl), var(--shadow-glow);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.input-group {
  margin-bottom: 1.5rem;
}

.input-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-field,
.textarea-field,
.select-field {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all var(--transition-fast);
  outline: none;
}

.input-field:focus,
.textarea-field:focus,
.select-field:focus {
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
  background: var(--surface-card);
}

.textarea-field {
  min-height: 120px;
  resize: vertical;
  font-family: inherit;
}

.select-field {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none' stroke='%23a1a1aa'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  outline: none;
}

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

.btn-primary {
  background: var(--gradient-purple);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(139, 92, 246, 0.4);
}

.btn-primary:active:not(:disabled)::before {
  width: 300px;
  height: 300px;
}

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-card);
  border-color: var(--purple-500);
  color: var(--purple-400);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

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

.btn-icon {
  padding: 0.75rem;
  width: 2.5rem;
  height: 2.5rem;
}

/* ============================================
   MODALS
   ============================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 11, 0.9);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: fadeIn var(--transition-slow) forwards;
}

.modal-content {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: var(--shadow-xl);
  transform: scale(0.9);
  animation: scaleIn var(--transition-slow) forwards;
}

.modal-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

/* ============================================
   LOADING STATES
   ============================================ */

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-default);
  border-top-color: var(--purple-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.skeleton {
  background: linear-gradient(90deg, 
    var(--surface-elevated) 25%, 
    var(--surface-card) 50%, 
    var(--surface-elevated) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ============================================
   ICONS (Lucide Integration)
   ============================================ */

.icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

/* ============================================
   RECIPIENT INDICATOR
   ============================================ */

.recipient-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.recipient-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple-500);
  animation: pulse 2s infinite;
}

/* ============================================
   GOAL BADGE
   ============================================ */

.goal-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--purple-400);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

@keyframes scaleIn {
  to { transform: scale(1); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.5); }
  50% { box-shadow: 0 0 40px rgba(139, 92, 246, 0.8); }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .app-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }
  
  .modal-content {
    width: 95%;
    padding: 1.5rem;
  }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
}

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

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

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden { display: none; }
.block { display: block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }

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

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

/* 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: 0;
}

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