/* ============================================
   Incompatible Email Generator - Styles
   Dark professional theme
   ============================================ */

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

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(22, 28, 48, 0.85);
  --bg-input: #0d1220;
  --border: #1e2a42;
  --border-focus: #4f8ff7;
  --text-primary: #e8ecf4;
  --text-secondary: #8892a8;
  --text-muted: #505a70;
  --accent: #4f8ff7;
  --accent-hover: #6ba1ff;
  --accent-glow: rgba(79, 143, 247, 0.12);
  --accent-gradient: linear-gradient(135deg, #4f8ff7 0%, #7c6cf7 100%);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.12);
  --error: #ef4444;
  --yellow: #fbbf24;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-card: 0 4px 32px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.03);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 15% 0%, rgba(79, 143, 247, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 100%, rgba(124, 108, 247, 0.05) 0%, transparent 55%);
  background-attachment: fixed;
}

.app {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

/* ============ Scrollbar ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============ Header ============ */

.header {
  text-align: center;
  margin-bottom: 28px;
  padding: 36px 24px 28px;
  position: relative;
}

.header-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 250px;
  background: radial-gradient(ellipse, rgba(79, 143, 247, 0.1), transparent 70%);
  pointer-events: none;
}

.header-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.logo {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(79, 143, 247, 0.08);
  border-radius: 14px;
  border: 1px solid rgba(79, 143, 247, 0.15);
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: rotate(15deg) scale(1.05);
}

h1 {
  font-size: 1.75rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 400;
  margin-top: 2px;
  letter-spacing: 0.02em;
}

/* ============ Cards ============ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.card.fade-in {
  animation: fadeSlideIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* ============ Step Headers ============ */

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.step-badge {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 0.8125rem;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(79, 143, 247, 0.2);
}

.step-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.step-desc {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ============ Paste Area ============ */

.paste-area {
  width: 100%;
  min-height: 150px;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  line-height: 1.65;
  resize: vertical;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.paste-area:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.paste-area.parsed {
  border-color: var(--success);
  box-shadow: 0 0 0 3px var(--success-glow);
}

.paste-area::placeholder {
  color: var(--text-muted);
}

/* ============ Buttons ============ */

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn-row-center {
  justify-content: center;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 2px 12px rgba(79, 143, 247, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 4px 24px rgba(79, 143, 247, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0) scale(0.98); }

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

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.1);
}

.btn-large {
  padding: 13px 30px;
  font-size: 0.9375rem;
  border-radius: 10px;
}

.btn-icon { font-size: 1.05em; }

/* Copy buttons */
.btn-copy {
  background: rgba(79, 143, 247, 0.08);
  color: var(--accent);
  border: 1px solid rgba(79, 143, 247, 0.15);
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
}

.btn-copy:hover {
  background: rgba(79, 143, 247, 0.16);
  border-color: rgba(79, 143, 247, 0.3);
}

.btn-copy .copy-done { display: none; }
.btn-copy.copied .copy-text { display: none; }
.btn-copy.copied .copy-done { display: inline; }

.btn-copy.copied {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.25);
}

.btn-copy-main {
  padding: 7px 16px;
  font-size: 0.8125rem;
}

/* ============ Form Fields ============ */

.section-label {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.6875rem;
}

.section-hint {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: -8px;
  margin-bottom: 10px;
}

.section-sub-label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-top: 14px;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.label-hint {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.6875rem;
  font-style: italic;
}

.field input[type="text"],
.field-textarea {
  padding: 8px 11px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field-textarea {
  resize: vertical;
  line-height: 1.5;
  min-height: 44px;
}

.field input[type="text"]:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field input[type="text"]::placeholder,
.field-textarea::placeholder {
  color: var(--text-muted);
}

/* ============ Divider ============ */

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 22px 0;
}

/* ============ Radio Groups ============ */

.sub-section {
  margin-bottom: 14px;
}

.sub-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.radio-group {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.radio-group-vertical {
  flex-direction: column;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  flex: 1;
}

.radio-group-vertical .radio-card { flex: none; }

.radio-card:hover {
  border-color: rgba(79, 143, 247, 0.25);
  background: rgba(79, 143, 247, 0.03);
}

.radio-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 12px rgba(79, 143, 247, 0.06);
}

.radio-card input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--accent);
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.radio-label {
  font-size: 0.8125rem;
  color: var(--text-primary);
  line-height: 1.5;
}

/* ============ Conditional Fields ============ */

.conditional-fields {
  margin-bottom: 14px;
  padding: 12px 16px;
  background: rgba(79, 143, 247, 0.02);
  border-left: 3px solid rgba(79, 143, 247, 0.15);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  animation: fadeSlideIn 0.3s ease;
}

/* ============ Notes Area ============ */

.notes-area {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  line-height: 1.6;
  resize: vertical;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.notes-area:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.notes-area::placeholder { color: var(--text-muted); }

/* ============ Output ============ */

.output-block {
  margin-bottom: 14px;
}

.output-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.output-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.output-content {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8125rem;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.5;
}

.output-small {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.email-preview {
  padding: 24px 28px;
  background: #ffffff;
  color: #000000;
  border-radius: var(--radius-sm);
  border: 1px solid #ddd;
  font-family: Calibri, Arial, sans-serif;
  font-size: 11pt;
  line-height: 1.5;
  word-break: normal;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
}

.email-preview p {
  margin: 0 0 10px 0;
}

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

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  padding: 10px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  backdrop-filter: blur(12px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--error);
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--success);
}

/* ============ Footer ============ */

.footer {
  text-align: center;
  padding: 28px;
  color: var(--text-muted);
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
}

/* ============ Responsive ============ */

@media (max-width: 640px) {
  .app { padding: 12px 10px 60px; }
  .card { padding: 20px 16px; }
  .header-content {
    flex-direction: column;
    gap: 12px;
  }
  h1 { font-size: 1.375rem; }
  .fields-grid { grid-template-columns: 1fr; }
  .radio-group:not(.radio-group-vertical) { flex-direction: column; }
  .output-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .email-preview { padding: 16px 18px; }
}
