/* Email Alchemist - Styles */

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-hover: #252525;
  --border: #333;
  --text: #e5e5e5;
  --text-muted: #888;
  --primary: #f59e0b;
  --primary-hover: #d97706;
  --success: #10b981;
  --error: #ef4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--primary), #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.tagline strong {
  color: var(--text);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s;
}

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

.tab.active {
  color: var(--primary);
  background: var(--surface);
  font-weight: 600;
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Transform Grid */
.transform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 900px) {
  .transform-grid {
    grid-template-columns: 1fr;
  }
}

/* Panels */
.panel {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--border);
}

.panel h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--text);
}

/* Input Groups */
.input-group {
  margin-bottom: 1rem;
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

input[type="text"],
textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  color: var(--text);
  resize: vertical;
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
}

textarea {
  font-family: inherit;
  line-height: 1.6;
}

/* Buttons */
.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.5rem;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

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

.btn-secondary {
  width: 100%;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.5rem;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

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

.hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  text-align: center;
}

/* Output */
.output-group {
  margin-bottom: 1rem;
}

.output-group label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.output-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  min-height: 100px;
  white-space: pre-wrap;
  font-size: 0.95rem;
  line-height: 1.7;
}

.output-box.large {
  min-height: 250px;
  max-height: 400px;
  overflow-y: auto;
}

.output-box .placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.output-box .subject-option {
  padding: 0.5rem;
  margin: 0.25rem 0;
  background: var(--surface);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.output-box .subject-option:hover {
  background: var(--surface-hover);
}

/* Guide Content */
.guide-content {
  background: var(--surface);
  border-radius: 12px;
  padding: 2rem;
  border: 1px solid var(--border);
  max-width: 800px;
  margin: 0 auto;
}

.guide-content h2 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

.guide-content h3 {
  font-size: 1.35rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

.guide-content h4 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.guide-content p {
  margin-bottom: 1rem;
  color: var(--text);
}

.guide-content .intro {
  font-size: 1.15rem;
}

.guide-cta {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 1rem;
  margin: 1.5rem 0;
}

.guide-cta p {
  margin: 0;
}

.pattern {
  background: var(--bg);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.example {
  background: var(--surface-hover);
  padding: 0.75rem;
  border-radius: 4px;
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.before {
  color: var(--error);
  font-weight: 600;
}

.after {
  color: var(--success);
  font-weight: 600;
}

.dont-list li {
  color: var(--error);
  margin-left: 1.5rem;
  margin-bottom: 0.25rem;
}

.do-list li {
  color: var(--success);
  margin-left: 1.5rem;
  margin-bottom: 0.25rem;
}

.signature {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* Subjects Content */
.subjects-content {
  background: var(--surface);
  border-radius: 12px;
  padding: 2rem;
  border: 1px solid var(--border);
  max-width: 700px;
  margin: 0 auto;
}

.subjects-content h2 {
  margin-bottom: 0.5rem;
}

.subjects-content > p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

#subjects-output {
  margin-top: 1rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Loading State */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ─── WIZARD ─────────────────────────────────────────────────────────────── */

.wizard-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 0;
}

.wizard-step h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.wizard-sub {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.spark-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.spark-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.spark-card:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.spark-card.selected {
  border-color: var(--primary);
  background: rgba(245, 158, 11, 0.08);
}

.spark-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.spark-card p {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.5;
}

.spark-answer-box {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 0.5rem;
}

.spark-question-label {
  display: block;
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.spark-answer-box textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.85rem 1rem;
  resize: vertical;
  margin-bottom: 1rem;
  transition: border-color 0.15s;
}

.spark-answer-box textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.wizard-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.optional {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.85rem;
}

.hint-inline {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.wizard-output {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}

.wizard-output-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.hidden {
  display: none !important;
}

/* Quality check prompts */
.quality-check {
  background: rgba(245, 158, 11, 0.07);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.quality-check-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text);
}

.quality-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

/* Editable email textarea */
.output-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.65;
  padding: 1rem;
  resize: vertical;
  transition: border-color 0.15s;
}

.output-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* HTML Preview (when image is embedded) */
.email-html-preview {
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.email-html-preview.hidden {
  display: none;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.preview-header span:first-child {
  color: var(--text);
  font-weight: 500;
}

.preview-content {
  padding: 1.25rem;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--surface);
  max-height: 500px;
  overflow-y: auto;
}

.preview-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 20px 0;
  display: block;
}

/* Selected subject line row */
.selected-subject-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.selected-subject-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.85rem;
}

.selected-subject-input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-icon {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.55rem 0.75rem;
  transition: border-color 0.15s;
  flex-shrink: 0;
}

.btn-icon:hover {
  border-color: var(--primary);
}

/* Selected subject option highlight */
.subject-option.selected {
  border-left: 3px solid var(--primary);
  background: rgba(245, 158, 11, 0.08);
}

/* Screenshot upload */
.screenshot-placeholder {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: border-color 0.15s, color 0.15s;
}

.screenshot-placeholder:hover {
  border-color: var(--primary);
  color: var(--text);
}

.screenshot-preview {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  position: relative;
}

.screenshot-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 6px;
  display: block;
  margin-bottom: 0.75rem;
  object-fit: contain;
}

.screenshot-extracted {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.screenshot-remove {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  transition: all 0.15s;
}

.screenshot-remove:hover {
  border-color: var(--error);
  color: var(--error);
}

/* Loading spinner for buttons */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

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

.btn-loading {
  pointer-events: none;
  opacity: 0.9;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark, #6366f1), var(--primary));
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

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

/* Guide note callout box */
.guide-note {
  background: rgba(255, 180, 50, 0.08);
  border: 1px solid rgba(255, 180, 50, 0.25);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 2rem 0;
}

.guide-note h4 {
  margin: 0 0 0.75rem 0;
  color: var(--primary);
  font-size: 1.1rem;
}

.guide-note p {
  margin: 0.75rem 0;
  line-height: 1.7;
}

.guide-note ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.guide-note ol li {
  margin: 0.5rem 0;
  line-height: 1.6;
}
