/* ============================================================
   FormalMail — Aurora Luxe theme
   Dark, dense, functional, with aurora-inspired accents
   ============================================================ */

:root {
  /* Palette */
  --bg-deep:      #0a0e1a;
  --bg-panel:     #111827;
  --bg-elevated:  #1a2234;
  --bg-input:     #0d1420;
  --border:       #1f2937;
  --border-hi:    #334155;

  --text-primary:   #e7ecf5;
  --text-secondary: #9aa5b8;
  --text-muted:     #6b7280;

  /* Aurora accents */
  --aurora-green:  #2dd4bf;
  --aurora-blue:   #60a5fa;
  --aurora-purple: #a78bfa;
  --aurora-pink:   #f472b6;

  --primary:      var(--aurora-green);
  --primary-hi:   #5eead4;
  --success:      #22c55e;
  --warning:      #fbbf24;
  --danger:       #ef4444;

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* Layout */
  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow:    0 2px 10px rgba(0,0,0,.4);
  --shadow-hi: 0 8px 30px rgba(0,0,0,.5);

  --container-max: 1200px;
}

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-deep);
  background-image:
    radial-gradient(ellipse at top left, rgba(45,212,191,.08), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(167,139,250,.08), transparent 50%);
  background-attachment: fixed;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: var(--aurora-blue);
  text-decoration: none;
  transition: color .15s;
}
a:hover { color: var(--primary-hi); }

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- HEADER ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(10,14,26,.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  letter-spacing: -.01em;
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--aurora-green), var(--aurora-blue));
  box-shadow: 0 0 12px var(--aurora-green);
}
.nav { display: flex; align-items: center; gap: 20px; }
.nav a { color: var(--text-secondary); font-size: .92rem; }
.nav a:hover { color: var(--text-primary); }
.lang-switcher select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: .85rem;
  cursor: pointer;
}

/* ---------- MAIN ---------- */
.main { flex: 1; padding: 48px 0 80px; }

/* ---------- HERO ---------- */
.hero { text-align: center; padding: 32px 0 48px; }
.hero-title {
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.15;
  margin-bottom: 12px;
  background: linear-gradient(120deg, #fff 0%, #c7e8ff 50%, #d5b4ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 640px;
  margin: 0 auto 36px;
}

/* ---------- INPUT FORM ---------- */
.input-form { max-width: 760px; margin: 0 auto; }
.input-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-hi);
  transition: border-color .2s;
}
.input-box:focus-within { border-color: var(--primary); }
.input-box textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  min-height: 100px;
  outline: none;
}
.input-box textarea::placeholder { color: var(--text-muted); }
.input-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.country-pill {
  font-size: .85rem;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.country-pill strong { color: var(--text-primary); }
.link-btn {
  background: none; border: none;
  color: var(--aurora-blue);
  cursor: pointer;
  font-size: .85rem;
  text-decoration: underline;
  padding: 0;
}
.btn-primary {
  background: linear-gradient(135deg, var(--aurora-green), var(--aurora-blue));
  color: #0a0e1a;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 2px 12px rgba(45,212,191,.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(45,212,191,.4); }
.btn-primary:disabled { opacity: .6; cursor: wait; transform: none; }

/* ---------- HINT PILLS ---------- */
.hint-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}
.hint-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: .85rem;
  cursor: pointer;
  transition: all .15s;
}
.hint-pill:hover {
  border-color: var(--primary);
  color: var(--text-primary);
  background: rgba(45,212,191,.08);
}

/* ---------- HOW ---------- */
.how { margin-top: 72px; padding: 48px 0; }
.how h2 { text-align: center; margin-bottom: 36px; font-size: 1.6rem; letter-spacing: -.01em; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.step {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.step-num {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--aurora-green), var(--aurora-blue));
  border-radius: 50%;
  color: #0a0e1a;
  font-weight: 700;
  margin-bottom: 14px;
}
.step h3 { font-size: 1.05rem; margin-bottom: 8px; }
.step p { color: var(--text-secondary); font-size: .92rem; }

/* ---------- RESULT PAGE ---------- */
.result h1 {
  font-size: 1.8rem;
  margin-bottom: 24px;
  letter-spacing: -.01em;
}
.recipient-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
}
.recipient-card.warning { border-color: var(--warning); background: rgba(251,191,36,.05); }
.recipient-label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.recipient-name { font-size: 1.2rem; font-weight: 600; margin: 4px 0; }
.recipient-level { color: var(--primary); font-size: .9rem; margin-bottom: 12px; }
.recipient-details { display: grid; gap: 6px; font-size: .9rem; color: var(--text-secondary); }
.recipient-details code {
  font-family: var(--font-mono);
  color: var(--aurora-green);
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.letter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.letter-col {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.col-header h3 { font-size: 1rem; }
.subject-line {
  padding: 12px 20px;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  color: var(--text-secondary);
}
.letter-output {
  padding: 20px;
  font-family: var(--font-mono);
  font-size: .85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-primary);
  max-height: 540px;
  overflow-y: auto;
}
.btn-copy {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-hi);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  cursor: pointer;
  transition: all .15s;
}
.btn-copy:hover { border-color: var(--primary); color: var(--primary); }
.btn-copy.copied { background: var(--primary); color: #0a0e1a; }

.tip-box {
  background: rgba(96,165,250,.08);
  border: 1px solid rgba(96,165,250,.3);
  border-radius: var(--radius);
  padding: 14px 20px;
  color: var(--text-secondary);
  font-size: .9rem;
  margin-bottom: 24px;
}
.result-actions { display: flex; justify-content: center; }

/* ---------- MODAL ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-inner {
  background: var(--bg-panel);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  padding: 28px;
  min-width: 320px;
  position: relative;
}
.modal-inner h3 { margin-bottom: 16px; }
.modal-inner select {
  width: 100%;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: .95rem;
}
.modal-inner .link-btn { position: absolute; top: 12px; right: 16px; font-size: 1.2rem; }

/* ---------- FOOTER ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-deep);
  margin-top: auto;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 32px;
  padding: 36px 24px;
  align-items: center;
}
.footer-brand strong { font-size: 1.05rem; }
.footer-brand .tagline { color: var(--text-muted); font-size: .85rem; margin-top: 4px; }
.footer-disclaimer { color: var(--text-muted); font-size: .82rem; }
.footer-links { display: flex; gap: 16px; justify-content: flex-end; }
.footer-links a { color: var(--text-secondary); font-size: .85rem; }
.footer-copy { grid-column: 1 / -1; text-align: center; padding-top: 16px; border-top: 1px solid var(--border); color: var(--text-muted); }

/* ---------- RTL ---------- */
[dir="rtl"] .footer-links { justify-content: flex-start; }
[dir="rtl"] .hint-pill { text-align: right; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 720px) {
  .main { padding: 24px 0 48px; }
  .hero { padding: 20px 0 32px; }
  .footer-inner { grid-template-columns: 1fr; text-align: center; }
  .footer-links { justify-content: center; }
  .letter-grid { grid-template-columns: 1fr; }
  .nav a:not(.lang-switcher) { display: none; }
}
