/* ========================================
   ROASTMYIDEA — DESIGN SYSTEM
   Dark theme, fire/ember vibes
   ======================================== */

/* -------------------- ROOT TOKENS -------------------- */
:root {
  /* Colors */
  --color-bg-primary: #0a0a0a;
  --color-bg-secondary: #1a1a1a;
  --color-bg-tertiary: #2a2a2a;
  --color-ember-primary: #ff6b35;
  --color-ember-secondary: #ff8c42;
  --color-ember-tertiary: #ffa557;
  --color-ember-dark: #cc4f26;
  --color-text-primary: #ffffff;
  --color-text-secondary: #a0a0a0;
  --color-text-tertiary: #6a6a6a;
  --color-error: #ff4444;
  --color-error-bg: rgba(255, 68, 68, 0.1);
  --color-success: #4ade80;
  --color-glow-ember: rgba(255, 107, 53, 0.3);
  --color-glow-strong: rgba(255, 107, 53, 0.5);

  /* 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;

  /* Typography */
  --font-family-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-family-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.5rem;
  --line-height-tight: 1.2;
  --line-height-base: 1.5;
  --line-height-relaxed: 1.75;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows & Glows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);
  --glow-sm: 0 0 10px var(--color-glow-ember);
  --glow-md: 0 0 20px var(--color-glow-ember);
  --glow-lg: 0 0 30px var(--color-glow-strong);

  /* Transitions */
  --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);

  /* Layout */
  --layout-max-width: 640px;
  --layout-padding-mobile: var(--space-lg);
  --layout-padding-desktop: var(--space-2xl);
}

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

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

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

/* -------------------- LAYOUT -------------------- */
.container {
  max-width: var(--layout-max-width);
  margin: 0 auto;
  padding: var(--layout-padding-mobile);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--space-2xl);
}

@media (min-width: 768px) {
  .container {
    padding: var(--layout-padding-desktop);
  }
}

/* -------------------- TYPOGRAPHY -------------------- */
h1,
.heading-1 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--color-ember-primary), var(--color-ember-tertiary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@media (min-width: 768px) {
  h1,
  .heading-1 {
    font-size: var(--font-size-4xl);
  }
}

.subtitle {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  line-height: var(--line-height-base);
}

/* -------------------- INPUT / TEXTAREA -------------------- */
.input,
textarea {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text-primary);
  background-color: var(--color-bg-secondary);
  border: 2px solid var(--color-bg-tertiary);
  border-radius: var(--radius-lg);
  outline: none;
  transition: all var(--transition-base);
  resize: vertical;
  min-height: 140px;
}

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

.input:focus,
textarea:focus {
  border-color: var(--color-ember-primary);
  box-shadow: var(--glow-sm);
  background-color: var(--color-bg-tertiary);
}

.input:hover:not(:focus),
textarea:hover:not(:focus) {
  border-color: var(--color-ember-dark);
}

/* -------------------- BUTTONS -------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-family: var(--font-family-base);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  color: var(--color-text-primary);
  background: linear-gradient(135deg, var(--color-ember-primary), var(--color-ember-dark));
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  outline: none;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md), var(--glow-sm);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--glow-md);
}

.btn:active {
  transform: translateY(0) scale(0.98);
  animation: pulse 0.3s ease-out;
}

.btn:disabled,
.btn.loading {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 1.5s infinite;
}

/* Secondary button (share, etc.) */
.btn-secondary {
  background: var(--color-bg-tertiary);
  color: var(--color-ember-primary);
  box-shadow: var(--shadow-sm);
  font-size: var(--font-size-base);
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid var(--color-ember-dark);
}

.btn-secondary:hover {
  background: var(--color-bg-secondary);
  border-color: var(--color-ember-primary);
  box-shadow: var(--shadow-md), var(--glow-sm);
}

/* -------------------- ROAST RESULT CARD -------------------- */
.result-card {
  width: 100%;
  padding: var(--space-xl);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-bg-tertiary);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  animation: fadeInSlideUp 0.4s ease-out;
}

.result-card__section {
  margin-bottom: var(--space-xl);
}

.result-card__section:last-child {
  margin-bottom: 0;
}

.result-card__label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-ember-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.result-card__text {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-primary);
}

.result-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-bg-tertiary);
}

/* -------------------- SCORE DISPLAY -------------------- */
.score {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.score__flames {
  display: flex;
  gap: 2px;
  font-size: var(--font-size-2xl);
  animation: flameFlicker 2s ease-in-out infinite;
}

.score__label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
}

/* -------------------- ERROR STATES -------------------- */
.error {
  padding: var(--space-md) var(--space-lg);
  background-color: var(--color-error-bg);
  border: 1px solid var(--color-error);
  border-radius: var(--radius-lg);
  color: var(--color-error);
  font-size: var(--font-size-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  animation: fadeInSlideUp 0.3s ease-out;
}

.error::before {
  content: "⚠️";
  font-size: var(--font-size-lg);
}

/* Success toast */
.toast {
  position: fixed;
  bottom: var(--space-2xl);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-md) var(--space-xl);
  background-color: var(--color-bg-tertiary);
  border: 1px solid var(--color-ember-primary);
  border-radius: var(--radius-xl);
  color: var(--color-text-primary);
  font-size: var(--font-size-base);
  box-shadow: var(--shadow-lg), var(--glow-md);
  animation: fadeInSlideUp 0.3s ease-out;
  z-index: 1000;
}

/* -------------------- LOADING SKELETON -------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--color-bg-secondary) 25%, var(--color-bg-tertiary) 50%, var(--color-bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
  height: 1rem;
  width: 100%;
}

.skeleton--text {
  height: 1rem;
  margin-bottom: var(--space-sm);
}

.skeleton--button {
  height: 3rem;
  width: 100%;
  border-radius: var(--radius-xl);
}

/* -------------------- ANIMATIONS -------------------- */
@keyframes pulse {
  0% {
    box-shadow: var(--shadow-md), 0 0 0 0 var(--color-glow-strong);
  }
  50% {
    box-shadow: var(--shadow-md), 0 0 0 10px transparent;
  }
  100% {
    box-shadow: var(--shadow-md), 0 0 0 0 transparent;
  }
}

@keyframes fadeInSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes flameFlicker {
  0%, 100% {
    opacity: 1;
    filter: brightness(1);
  }
  50% {
    opacity: 0.85;
    filter: brightness(1.2);
  }
}

/* -------------------- UTILITY CLASSES -------------------- */
.text-center {
  text-align: center;
}

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

.mt-lg {
  margin-top: var(--space-lg);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

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

/* Footer */
.footer {
  margin-top: var(--space-3xl);
  padding-top: var(--space-2xl);
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
}

/* -------------------- RESPONSIVE UTILITIES -------------------- */
@media (min-width: 768px) {
  .md\:text-center {
    text-align: center;
  }
}

@media (min-width: 1024px) {
  .lg\:text-center {
    text-align: center;
  }
}
