/**
 * Error Fortune Cookies - Minimal CSS
 * Only includes styles that are actually used
 */

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

/* CSS Custom Properties */
:root {
  /* Colors */
  --color-primary: #6366f1;
  --color-primary-dark: #4f46e5;
  --color-secondary: #ec4899;
  --color-secondary-dark: #db2777;
  --color-error: #ef4444;
  
  /* Neutrals */
  --color-neutral-50: #f8fafc;
  --color-neutral-200: #e2e8f0;
  --color-neutral-600: #475569;
  --color-neutral-800: #1e293b;
  --color-neutral-900: #0f172a;
  
  /* Typography */
  --font-family-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-mono: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
  
  /* Spacing */
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  
  /* Border radius */
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Theme colors */
  --color-background: var(--color-neutral-50);
  --color-surface: white;
  --color-text-primary: var(--color-neutral-900);
  --color-text-secondary: var(--color-neutral-600);
  --color-border: var(--color-neutral-200);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --color-background: var(--color-neutral-900);
    --color-surface: var(--color-neutral-800);
    --color-text-primary: var(--color-neutral-50);
    --color-text-secondary: #bbbbbb;
    --color-border: #333333;
  }
}

/* Base styles */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-primary);
  line-height: 1.6;
  color: var(--color-text-primary);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2 {
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: var(--space-4);
}

h1 { font-size: 2.25rem; }

/* Layout components */
.container {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: var(--space-6);
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-2xl);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Form components */
.form-group {
  margin-bottom: var(--space-6);
}

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

.form-input {
  width: 100%;
  padding: var(--space-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 1rem;
  transition: border-color 0.15s ease;
}

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

textarea.form-input {
  min-height: 8rem;
  resize: vertical;
  font-family: var(--font-family-mono);
  font-size: 0.875rem;
}

/* Button component */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-6);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: transform 0.15s ease;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: white;
  box-shadow: var(--shadow-md);
}

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

.button-secondary {
  background: linear-gradient(135deg, var(--color-secondary), var(--color-secondary-dark));
}

.button-full-width {
  width: 100%;
}

/* Style selector */
.style-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--space-3);
}

.style-option {
  position: relative;
}

.style-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.style-option-label {
  display: block;
  padding: var(--space-4);
  text-align: center;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--color-surface);
  font-size: 0.875rem;
  font-weight: 500;
}

.style-option-label:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.style-option input:checked + .style-option-label {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: white;
}

.style-icon {
  display: block;
  font-size: 1.25rem;
  margin-bottom: var(--space-2);
}

/* Fortune display */
.fortune-display {
  margin-top: var(--space-8);
  padding: var(--space-8);
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--color-primary);
  display: block;
}

.cookie {
  text-align: center;
  font-size: 4rem;
  margin: var(--space-6) 0;
  transition: transform 0.5s ease;
}

.error-message {
  font-family: var(--font-family-mono);
  font-size: 0.875rem;
  background: color-mix(in srgb, var(--color-error) 10%, transparent);
  color: var(--color-error);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--color-error);
  margin-bottom: var(--space-6);
  word-break: break-all;
}

.fortune-content {
  font-size: 1.125rem;
  line-height: 1.625;
  color: var(--color-text-secondary);
  font-style: italic;
}

/* Utility classes */
.text-center { text-align: center; }
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-text-secondary); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }
.mt-8 { margin-top: var(--space-8); }

/* Screen reader only */
.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;
}

/* Responsive design */
@media (max-width: 640px) {
  .container { padding: var(--space-4); }
  .card { padding: var(--space-6); }
  h1 { font-size: 1.875rem; }
  .style-selector { grid-template-columns: repeat(2, 1fr); }
  .cookie { font-size: 3rem; }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

.button:focus,
.form-input:focus,
.style-option input:focus + .style-option-label {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
