/* ========================================
   C3 Orange County Content Creator
   Design System
   ======================================== */

/* === 1. Design Tokens === */
:root {
  --color-primary:       #1e293b;
  --color-primary-light: #334155;
  --color-accent:        #4f6df5;
  --color-accent-hover:  #3b5ae0;
  --color-accent-light:  #eff2fe;
  --color-accent-50:     #f5f7ff;

  --color-bg:            #f9fafb;
  --color-surface:       #ffffff;
  --color-surface-alt:   #f3f4f6;
  --color-border:        #e5e7eb;
  --color-border-light:  #f0f1f3;
  --color-border-focus:  #4f6df5;

  --color-text:          #1e293b;
  --color-text-secondary:#64748b;
  --color-text-tertiary: #94a3b8;
  --color-text-inverse:  #ffffff;

  --color-success:       #16a34a;
  --color-success-light: #dcfce7;
  --color-warning:       #d97706;
  --color-warning-light: #fef3c7;
  --color-error:         #dc2626;
  --color-error-light:   #fee2e2;
  --color-info:          #2563eb;
  --color-info-light:    #dbeafe;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  --shadow-sm:   0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:   0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg:   0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-xl:   0 8px 32px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.05);
  --shadow-focus: 0 0 0 3px rgba(79,109,245,0.25);

  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow:   400ms ease;
  --transition-screen: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  --z-dropdown: 10;
  --z-sticky:   20;
  --z-modal:    50;
  --z-toast:    100;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === 3. Layout === */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-6);
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  margin-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-border-light);
}

.header-brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}

.header-brand p {
  color: var(--color-text-tertiary);
  font-size: 0.8125rem;
}

header nav {
  display: flex;
  gap: var(--space-2);
}

/* === 4. Screen System & Transitions === */
.screen {
  display: none;
  opacity: 0;
  transform: translateY(8px);
}

.screen.active {
  display: block;
  animation: screenFadeIn var(--transition-screen) forwards;
}

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

/* === 5. Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  letter-spacing: 0.01em;
  line-height: 1.4;
  font-family: inherit;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-text-inverse);
  width: 100%;
  margin-top: var(--space-6);
  padding: 0.75rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

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

.btn-secondary:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-border);
}

.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

/* Loading spinner state */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* === 6. Form Elements === */
.field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: var(--space-1);
  color: var(--color-text-secondary);
  letter-spacing: 0.01em;
}

.field input {
  width: 100%;
  height: 42px;
  padding: 0 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.field input:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: var(--shadow-focus);
}

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

.editor-input {
  width: 100%;
  height: 42px;
  padding: 0 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.editor-input:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: var(--shadow-focus);
}

/* === 7. Login Screen === */
.login-card {
  max-width: 400px;
  margin: var(--space-16) auto 0;
  padding: var(--space-10);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  text-align: center;
  border-top: 4px solid var(--color-accent);
}

.login-card h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: var(--space-6);
  color: var(--color-text);
}

.login-card .field {
  text-align: left;
}

#loginError {
  color: var(--color-error);
  font-size: 0.8125rem;
  margin-top: var(--space-2);
  display: none;
}

/* === 8. Upload Screen === */
.drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-12) var(--space-8);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.drop-zone::before {
  content: '';
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='17 8 12 3 7 8'/%3E%3Cline x1='12' y1='3' x2='12' y2='15'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.5;
  transition: opacity var(--transition-normal);
}

.drop-zone:hover::before,
.drop-zone.dragover::before { opacity: 0.8; }

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
  box-shadow: var(--shadow-md);
}

.drop-zone h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.drop-zone p {
  color: var(--color-text-tertiary);
  font-size: 0.8125rem;
}

.drop-zone .drop-zone-hint {
  margin-top: var(--space-2);
  color: var(--color-text-tertiary);
}

.drop-zone input[type="file"] { display: none; }

.file-info {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--color-accent-50);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  display: none;
}

.optional-fields {
  margin-top: var(--space-6);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.optional-fields.full-width {
  grid-template-columns: 1fr;
}

/* === 9. Progress Screen === */
#screen-progress h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.progress-list {
  list-style: none;
  display: flex;
  justify-content: space-between;
  position: relative;
  margin: var(--space-8) 0 var(--space-6);
  padding: 0;
}

/* Connecting line behind step circles */
.progress-list::before {
  content: '';
  position: absolute;
  top: 15px;
  left: 32px;
  right: 32px;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.progress-list li {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 0;
  border: none;
  gap: var(--space-2);
  font-size: 0.6875rem;
  color: var(--color-text-tertiary);
  text-align: center;
  font-weight: 500;
}

.progress-list .icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all var(--transition-normal);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  color: var(--color-text-tertiary);
}

.icon.pending {
  background: var(--color-surface);
  color: var(--color-text-tertiary);
  border: 2px solid var(--color-border);
}

.icon.in_progress {
  background: var(--color-accent);
  color: white;
  border: 2px solid var(--color-accent);
  animation: stepPulse 2s ease infinite;
}

.icon.completed {
  background: var(--color-success);
  color: white;
  border: 2px solid var(--color-success);
}

.icon.failed {
  background: var(--color-error);
  color: white;
  border: 2px solid var(--color-error);
}

@keyframes stepPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(79,109,245,0.15); }
  50%      { box-shadow: 0 0 0 8px rgba(79,109,245,0.08); }
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-full);
  margin-top: var(--space-4);
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), #818cf8);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.metadata-preview {
  margin-top: var(--space-6);
  padding: var(--space-4) var(--space-5);
  background: var(--color-accent-50);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-md);
  display: none;
  box-shadow: var(--shadow-sm);
}

.metadata-preview h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: var(--space-1);
  color: var(--color-text);
}

.metadata-preview p {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

/* === 10. Review Screen === */
#screen-review > h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

#reviewMeta {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  margin-bottom: var(--space-6);
}

/* Tabs: pill segmented control */
.tabs {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--color-surface-alt);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  overflow-x: auto;
  border: none;
  -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar { display: none; }
.tabs { -ms-overflow-style: none; scrollbar-width: none; }

.tab {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  white-space: nowrap;
  transition: all var(--transition-fast);
  margin-bottom: 0;
  font-family: inherit;
}

.tab:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.tab.active {
  background: var(--color-surface);
  color: var(--color-accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.tab-content { display: none; }
.tab-content.active {
  display: block;
  animation: tabFadeIn 200ms ease forwards;
}

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

.content-editor {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.content-editor label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
  letter-spacing: 0.01em;
}

.content-editor textarea {
  width: 100%;
  min-height: 280px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 0.875rem;
  line-height: 1.7;
  resize: vertical;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.content-editor textarea:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: var(--shadow-focus);
}

#edit-podcast-description { min-height: 120px; }
#edit-devotionals { min-height: 400px; }

.content-editor .actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
  justify-content: flex-end;
}

/* Regenerate loading overlay */
.regen-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  z-index: 5;
  animation: modalFadeIn 200ms ease;
}

.regen-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.regen-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

/* Clips */
.clips-list {
  list-style: none;
}

.clips-list li {
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast);
}

.clips-list li:hover {
  box-shadow: var(--shadow-md);
}

.clips-list audio {
  height: 36px;
  border-radius: var(--radius-sm);
}

.clips-list .clip-info {
  flex: 1;
  min-width: 0;
}

.clips-list .clip-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
}

.clips-list .clip-quote {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

/* Distribute options */
.distribute-options {
  margin-top: var(--space-6);
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.distribute-options label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  color: var(--color-text);
  cursor: pointer;
  margin: 0;
}

.distribute-options input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

/* === 11. Complete Screen === */
.complete-card {
  text-align: center;
  padding: var(--space-12) var(--space-8);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  margin: var(--space-8) auto 0;
}

.complete-card::before {
  content: '';
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-6);
  border-radius: var(--radius-full);
  background-color: var(--color-success-light);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 24 24' fill='none' stroke='%2316a34a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 28px;
  background-repeat: no-repeat;
  background-position: center;
}

.complete-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-success);
  margin-bottom: var(--space-3);
}

.complete-card p {
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
}

.complete-card .links {
  margin-top: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: center;
}

.complete-card .links a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.complete-card .links a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

.btn-complete {
  max-width: 300px;
  margin: var(--space-6) auto 0;
}

/* === 12. History Screen === */
#screen-history h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-4);
}

.history-item {
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.history-item:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.history-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
}

.history-meta {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

.history-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.history-stage {
  font-size: 0.75rem;
  padding: 0.2rem 0.625rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  white-space: nowrap;
}

.stage-complete { background: var(--color-success-light); color: var(--color-success); }
.stage-review   { background: var(--color-warning-light); color: var(--color-warning); }
.stage-failed   { background: var(--color-error-light); color: var(--color-error); }
.stage-active   { background: var(--color-info-light); color: var(--color-info); }

.history-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.625rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-fast);
}

.badge-published { background: var(--color-success-light); color: var(--color-success); }
.badge-published:hover { background: #bbf7d0; }
.badge-draft { background: var(--color-warning-light); color: var(--color-warning); }
.badge-draft:hover { background: #fde68a; }

.btn-delete {
  width: 30px;
  height: 30px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-tertiary);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-delete:hover {
  background: var(--color-error-light);
  border-color: #fca5a5;
  color: var(--color-error);
}

/* === 13. Toast Notifications === */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
  max-width: 380px;
  width: 100%;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastSlideIn 300ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
  border-left: 4px solid var(--color-text-secondary);
}

.toast.toast-success { border-left-color: var(--color-success); }
.toast.toast-error   { border-left-color: var(--color-error); }
.toast.toast-warning { border-left-color: var(--color-warning); }
.toast.toast-info    { border-left-color: var(--color-accent); }

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}

.toast-message {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
  word-break: break-word;
}

.toast-close {
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

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

.toast.toast-exit {
  animation: toastSlideOut 200ms ease forwards;
}

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

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

/* === 14. Modal Dialog === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: modalFadeIn 200ms ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-8);
  max-width: 440px;
  width: 100%;
  animation: modalScaleIn 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.modal-message {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-5);
  line-height: 1.5;
}

.modal-input {
  width: 100%;
  height: 42px;
  padding: 0 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: inherit;
  margin-bottom: var(--space-5);
  color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.modal-input:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: var(--shadow-focus);
}

.modal-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

.modal-actions .btn {
  width: auto;
  margin-top: 0;
  min-width: 90px;
}

/* === 15. Responsive: Tablet (640px) === */
@media (max-width: 640px) {
  .container {
    padding: var(--space-4);
  }

  header {
    flex-direction: column;
    text-align: center;
    gap: var(--space-3);
  }

  header nav {
    width: 100%;
    justify-content: center;
  }

  .optional-fields {
    grid-template-columns: 1fr;
  }

  /* Vertical stepper on mobile */
  .progress-list {
    flex-direction: column;
    gap: var(--space-1);
    margin: var(--space-6) 0;
  }

  .progress-list::before {
    top: 0;
    bottom: 0;
    left: 15px;
    right: auto;
    width: 2px;
    height: auto;
  }

  .progress-list li {
    flex-direction: row;
    gap: var(--space-3);
    text-align: left;
    font-size: 0.8125rem;
    padding: var(--space-2) 0;
  }

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

  .tab {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
  }

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

  .content-editor textarea {
    min-height: 200px;
    padding: var(--space-3);
  }

  .distribute-options {
    flex-direction: column;
  }

  .history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .history-actions {
    width: 100%;
    justify-content: flex-start;
  }

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

  .modal-card {
    padding: var(--space-6);
    margin: var(--space-4);
  }

  .login-card {
    margin-top: var(--space-8);
    padding: var(--space-6);
  }

  .complete-card {
    padding: var(--space-8) var(--space-6);
  }

  .clips-list li {
    flex-direction: column;
    align-items: flex-start;
  }

  .clips-list audio {
    width: 100%;
  }
}

/* === 16. Responsive: Mobile (480px) === */
@media (max-width: 480px) {
  .container {
    padding: var(--space-3);
  }

  .header-brand h1 {
    font-size: 1.125rem;
  }

  .drop-zone {
    padding: var(--space-8) var(--space-4);
  }

  .btn-small {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
  }
}
