/**
 * production.css - Professional Design System for Production Pages
 * Used by: app/deck-editor.html, app/deck-viewer.html
 *
 * Features:
 * - CSS Custom Properties (Design Tokens)
 * - Component Patterns (buttons, inputs, cards)
 * - Loading States (spinners, skeletons)
 * - Toast Notifications
 * - Error Boundaries
 * - Mobile Responsive Breakpoints
 */

/* ==============================================
   Google Fonts (Matching Landing Page)
   ============================================== */

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&family=Inter:wght@400;500;600&family=Poppins:wght@500;600;700&display=swap');

/* ==============================================
   CSS Custom Properties (Design Tokens)
   ============================================== */

:root {
  /* === Color System === */

  /* Primary Colors (Blue) */
  --color-primary-50: #e3f2fd;
  --color-primary-100: #bbdefb;
  --color-primary-200: #90caf9;
  --color-primary-300: #64b5f6;
  --color-primary-400: #42a5f5;
  --color-primary-500: #2196F3;  /* Main primary */
  --color-primary-600: #1e88e5;
  --color-primary-700: #1976d2;
  --color-primary-800: #1565c0;
  --color-primary-900: #0d47a1;

  /* Secondary Colors (Purple) */
  --color-secondary-50: #f3e5f5;
  --color-secondary-100: #e1bee7;
  --color-secondary-200: #ce93d8;
  --color-secondary-300: #ba68c8;
  --color-secondary-400: #ab47bc;
  --color-secondary-500: #9C27B0;  /* Main secondary */
  --color-secondary-600: #8e24aa;
  --color-secondary-700: #7B1FA2;
  --color-secondary-800: #6a1b9a;
  --color-secondary-900: #4a148c;

  /* Accent Colors (Green) */
  --color-accent-50: #e8f5e9;
  --color-accent-100: #c8e6c9;
  --color-accent-200: #a5d6a7;
  --color-accent-300: #81c784;
  --color-accent-400: #66bb6a;
  --color-accent-500: #4CAF50;  /* Main accent */
  --color-accent-600: #43a047;
  --color-accent-700: #388E3C;
  --color-accent-800: #2e7d32;
  --color-accent-900: #1b5e20;

  /* Neutral Colors (Gray scale) */
  --color-neutral-50: #fafafa;
  --color-neutral-100: #f5f5f5;
  --color-neutral-200: #eeeeee;
  --color-neutral-300: #e0e0e0;
  --color-neutral-400: #bdbdbd;
  --color-neutral-500: #9e9e9e;
  --color-neutral-600: #757575;
  --color-neutral-700: #616161;
  --color-neutral-800: #424242;
  --color-neutral-900: #212121;

  /* Semantic Colors */
  --color-success: #4caf50;
  --color-success-light: #81c784;
  --color-success-dark: #388e3c;

  --color-error: #f44336;
  --color-error-light: #e57373;
  --color-error-dark: #d32f2f;

  --color-warning: #ff9800;
  --color-warning-light: #ffb74d;
  --color-warning-dark: #f57c00;

  --color-info: #2196f3;
  --color-info-light: #64b5f6;
  --color-info-dark: #1976d2;

  /* === Typography === */
  --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-heading: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-mono: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

  /* Font Sizes (Type Scale) */
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 1.875rem;  /* 30px */
  --font-size-4xl: 2.25rem;   /* 36px */
  --font-size-5xl: 3rem;      /* 48px */

  /* Font Weights */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Line Heights */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* === Spacing System (4px grid) === */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  --space-24: 6rem;     /* 96px */

  /* === Borders === */
  --border-radius-sm: 4px;
  --border-radius-md: 6px;
  --border-radius-lg: 8px;
  --border-radius-xl: 12px;
  --border-radius-2xl: 16px;
  --border-radius-full: 9999px;

  --border-width-thin: 1px;
  --border-width-medium: 2px;
  --border-width-thick: 4px;

  /* === Gradients (Matching Landing) === */
  --gradient-brand: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-primary: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));

  /* === Shadows === */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
  --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.25);

  /* === Z-Index Layers === */
  --z-base: 1;
  --z-dropdown: 1000;
  --z-sticky: 1100;
  --z-fixed: 1200;
  --z-modal-backdrop: 1300;
  --z-modal: 1400;
  --z-toast: 1500;
  --z-tooltip: 1600;

  /* === Transitions === */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slower: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==============================================
   Base Resets & Defaults
   ============================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-neutral-900);
  background: var(--color-neutral-100);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==============================================
   Component Patterns - Buttons
   ============================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-family-base);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-tight);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  border: var(--border-width-thin) solid transparent;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}

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

/* Primary Button */
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
  color: white;
  border-color: var(--color-primary-700);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--color-primary-600), var(--color-primary-700));
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

/* Secondary Button */
.btn-secondary {
  background: white;
  color: var(--color-neutral-700);
  border-color: var(--color-neutral-300);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-neutral-50);
  border-color: var(--color-neutral-400);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

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

/* Success Button */
.btn-success {
  background: linear-gradient(135deg, var(--color-success), var(--color-success-dark));
  color: white;
  border-color: var(--color-success-dark);
}

.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--color-success-dark), var(--color-accent-700));
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Danger Button */
.btn-danger {
  background: linear-gradient(135deg, var(--color-error), var(--color-error-dark));
  color: white;
  border-color: var(--color-error-dark);
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--color-error-dark), #b71c1c);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-size-base);
}

/* ==============================================
   Component Patterns - Inputs & Forms
   ============================================== */

.input,
.select,
.textarea {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-family-base);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  color: var(--color-neutral-900);
  background: white;
  border: var(--border-width-thin) solid var(--color-neutral-300);
  border-radius: var(--border-radius-md);
  transition: all var(--transition-fast);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 3px var(--color-primary-50);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--color-neutral-100);
  cursor: not-allowed;
  opacity: 0.6;
}

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

/* Form Labels */
.label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-neutral-700);
}

/* ==============================================
   Component Patterns - Cards
   ============================================== */

.card {
  background: white;
  border: var(--border-width-thin) solid var(--color-neutral-200);
  border-radius: var(--border-radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

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

.card-header {
  padding: var(--space-4);
  border-bottom: var(--border-width-thin) solid var(--color-neutral-200);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-lg);
}

.card-body {
  padding: var(--space-4);
}

.card-footer {
  padding: var(--space-4);
  border-top: var(--border-width-thin) solid var(--color-neutral-200);
  background: var(--color-neutral-50);
}

/* ==============================================
   Loading States
   ============================================== */

/* Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--color-neutral-200);
  border-top-color: var(--color-primary-500);
  border-radius: var(--border-radius-full);
  animation: spin 0.8s linear infinite;
}

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

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

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-neutral-200) 25%,
    var(--color-neutral-100) 50%,
    var(--color-neutral-200) 75%
  );
  background-size: 200% 100%;
  animation: pulse 1.5s ease-in-out infinite;
  border-radius: var(--border-radius-md);
}

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

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

.skeleton-title {
  height: 1.5em;
  width: 60%;
  margin-bottom: var(--space-4);
}

.skeleton-button {
  height: 36px;
  width: 100px;
}

/* Loading Container */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  gap: var(--space-4);
  color: var(--color-neutral-600);
}

/* ==============================================
   Toast Notifications
   ============================================== */

.toast {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  min-width: 300px;
  max-width: 500px;
  padding: var(--space-4);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  pointer-events: auto;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

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

.toast-error {
  background: var(--color-error);
  color: white;
}

.toast-info {
  background: var(--color-info);
  color: white;
}

.toast-warning {
  background: var(--color-warning);
  color: white;
}

.toast-icon {
  flex-shrink: 0;
  font-size: var(--font-size-lg);
}

.toast-message {
  flex: 1;
}

/* ==============================================
   Error Boundaries
   ============================================== */

.error-boundary {
  padding: var(--space-8) var(--space-4);
  text-align: center;
  background: var(--color-error-light);
  color: white;
  border-radius: var(--border-radius-lg);
}

.error-boundary-icon {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space-4);
}

.error-boundary-title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-2);
}

.error-boundary-message {
  font-size: var(--font-size-base);
  margin-bottom: var(--space-6);
  opacity: 0.9;
  line-height: var(--line-height-relaxed);
}

.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: var(--space-8);
  text-align: center;
}

.error-icon {
  font-size: var(--font-size-5xl);
  margin-bottom: var(--space-4);
}

.error-title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-error);
  margin-bottom: var(--space-2);
}

.error-message {
  font-size: var(--font-size-base);
  color: var(--color-neutral-600);
  margin-bottom: var(--space-6);
  max-width: 600px;
  line-height: var(--line-height-relaxed);
}

/* ==============================================
   Utility Classes
   ============================================== */

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

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-start {
  align-items: flex-start;
}

.items-center {
  align-items: center;
}

.items-end {
  align-items: flex-end;
}

.justify-start {
  justify-content: flex-start;
}

.justify-center {
  justify-content: center;
}

.justify-end {
  justify-content: flex-end;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 {
  gap: var(--space-1);
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

/* Grid */
.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, 1fr);
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Spacing */
.m-0 {
  margin: 0;
}

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

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

.p-0 {
  padding: 0;
}

.p-4 {
  padding: var(--space-4);
}

/* Text */
.text-xs {
  font-size: var(--font-size-xs);
}

.text-sm {
  font-size: var(--font-size-sm);
}

.text-base {
  font-size: var(--font-size-base);
}

.text-lg {
  font-size: var(--font-size-lg);
}

.text-xl {
  font-size: var(--font-size-xl);
}

.text-2xl {
  font-size: var(--font-size-2xl);
}

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

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

.font-normal {
  font-weight: var(--font-weight-normal);
}

.font-medium {
  font-weight: var(--font-weight-medium);
}

.font-semibold {
  font-weight: var(--font-weight-semibold);
}

.font-bold {
  font-weight: var(--font-weight-bold);
}

/* Colors */
.text-primary {
  color: var(--color-primary-500);
}

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

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

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

.text-muted {
  color: var(--color-neutral-600);
}

/* Display */
.hidden {
  display: none !important;
}

.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

/* ==============================================
   Mobile Breakpoints
   ============================================== */

/* Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
  :root {
    --font-size-base: 0.9375rem; /* 15px */
    --space-4: 0.875rem; /* 14px */
  }

  .container {
    padding: 0 var(--space-3);
  }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
  :root {
    --font-size-base: 0.875rem; /* 14px */
    --space-4: 0.875rem; /* 14px */
    --space-6: 1.25rem; /* 20px */
  }

  .container {
    padding: 0 var(--space-3);
  }

  .toast {
    min-width: auto;
    left: var(--space-4);
    right: var(--space-4);
    max-width: none;
  }

  .btn {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-xs);
  }

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
  :root {
    --font-size-2xl: 1.25rem; /* 20px */
    --font-size-3xl: 1.5rem; /* 24px */
  }

  .error-icon {
    font-size: var(--font-size-3xl);
  }

  .error-title {
    font-size: var(--font-size-xl);
  }
}

/* ==============================================
   Utility Classes (Matching Landing)
   ============================================== */

.bg-brand-gradient {
  background: var(--gradient-brand);
}

.text-gradient {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.font-mono {
  font-family: var(--font-family-mono);
}

/* Smooth scrolling for anchor links */
html {
  scroll-behavior: smooth;
}

/* ==============================================
   Print Styles
   ============================================== */

@media print {
  .toast,
  .btn,
  .no-print {
    display: none !important;
  }
}
