/* ============================================
   Dopafix — Core Styles
   ============================================ */

:root {
  /* Brand Colors */
  --color-primary: #6C63FF;
  --color-secondary: #8B7CF6;
  --color-accent: #63D2C7;
  --color-bg: #F7F8FC;
  --color-dark: #171827;
  --color-text: #303144;
  --color-muted: #73758A;
  --color-success: #45B97C;
  --color-warning: #F2B84B;
  --color-danger: #E86A92;
  --color-white: #FFFFFF;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  --gradient-hero: linear-gradient(135deg, #f0f1ff 0%, #e8f9f7 50%, #f7f8fc 100%);
  --gradient-card: linear-gradient(180deg, var(--color-white) 0%, #fafbff 100%);

  /* Typography */
  --font-heading: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

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

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(23, 24, 39, 0.05);
  --shadow-md: 0 4px 12px rgba(23, 24, 39, 0.08);
  --shadow-lg: 0 8px 30px rgba(23, 24, 39, 0.12);
  --shadow-xl: 0 20px 60px rgba(23, 24, 39, 0.15);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --container-max: 1200px;
  --container-narrow: 720px;
  --header-height: 72px;
}

/* Dark Mode */
[data-theme="dark"] {
  --color-bg: #0f0f1a;
  --color-dark: #e8e8f0;
  --color-text: #d0d0e0;
  --color-muted: #8a8aa0;
  --gradient-hero: linear-gradient(135deg, #1a1a2e 0%, #162028 50%, #0f0f1a 100%);
  --gradient-card: linear-gradient(180deg, #1a1a2e 0%, #141425 100%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
}

/* ============================================
   Base Reset
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
}

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

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

a:hover {
  color: var(--color-secondary);
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-dark);
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h4 { font-size: clamp(1.1rem, 2vw, 1.35rem); }

p {
  margin-bottom: var(--space-md);
  color: var(--color-text);
}

.text-muted { color: var(--color-muted); }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }

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

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

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

.container-narrow {
  max-width: var(--container-narrow);
}

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

.section-sm {
  padding: var(--space-2xl) 0;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.875rem 1.75rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--gradient-primary);
  color: var(--color-white);
  box-shadow: 0 4px 14px rgba(108, 99, 255, 0.35);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 99, 255, 0.45);
  color: var(--color-white);
}

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

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

.btn-secondary:hover:not(:disabled) {
  background: var(--color-primary);
  color: var(--color-white);
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(108, 99, 255, 0.08);
}

.btn-danger {
  background: var(--color-danger);
  color: var(--color-white);
}

.btn-success {
  background: var(--color-success);
  color: var(--color-white);
}

.btn-sm {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 1rem 2.25rem;
  font-size: 1.125rem;
}

.btn-full {
  width: 100%;
}

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--gradient-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(108, 99, 255, 0.06);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

.card-flat {
  box-shadow: none;
  border: 1px solid rgba(108, 99, 255, 0.1);
}

.card-flat:hover {
  transform: none;
  box-shadow: var(--shadow-md);
}

/* ============================================
   Forms
   ============================================ */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-dark);
}

.form-label .required {
  color: var(--color-danger);
  margin-left: 2px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.875rem 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-white);
  border: 2px solid rgba(108, 99, 255, 0.12);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

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

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

.form-error {
  display: none;
  margin-top: var(--space-xs);
  font-size: 0.85rem;
  color: var(--color-danger);
}

.form-group.has-error .form-input,
.form-group.has-error .form-textarea,
.form-group.has-error .form-select {
  border-color: var(--color-danger);
}

.form-group.has-error .form-error {
  display: block;
}

/* Checkbox / Radio */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  cursor: pointer;
  padding: var(--space-sm) 0;
}

.form-check-input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.form-check-label {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--color-text);
}

/* ============================================
   Alerts & Badges
   ============================================ */
.alert {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  margin-bottom: var(--space-lg);
}

.alert-info {
  background: rgba(108, 99, 255, 0.08);
  border-left: 4px solid var(--color-primary);
  color: var(--color-primary);
}

.alert-success {
  background: rgba(69, 185, 124, 0.08);
  border-left: 4px solid var(--color-success);
  color: var(--color-success);
}

.alert-warning {
  background: rgba(242, 184, 75, 0.08);
  border-left: 4px solid var(--color-warning);
  color: #8a6d1f;
}

.alert-danger {
  background: rgba(232, 106, 146, 0.08);
  border-left: 4px solid var(--color-danger);
  color: var(--color-danger);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
}

.badge-primary {
  background: var(--color-primary);
  color: var(--color-white);
}

.badge-success {
  background: var(--color-success);
  color: var(--color-white);
}

.badge-warning {
  background: var(--color-warning);
  color: var(--color-dark);
}

/* ============================================
   Loading & Empty States
   ============================================ */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(108, 99, 255, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.skeleton {
  background: linear-gradient(90deg, rgba(108,99,255,0.06) 25%, rgba(108,99,255,0.12) 50%, rgba(108,99,255,0.06) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

.empty-state {
  text-align: center;
  padding: var(--space-4xl) var(--space-lg);
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-lg);
  background: rgba(108, 99, 255, 0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

/* ============================================
   Utilities
   ============================================ */
.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.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); }

.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); }

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

.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: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section { padding: var(--space-3xl) 0; }
}

/* ============================================
   Print
   ============================================ */
@media print {
  .no-print { display: none !important; }
  body { background: white; color: black; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

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