/* ─── Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg:           #0a0a0a;
  --bg-card:      #111111;
  --bg-input:     #191919;
  --border:       #242424;
  --border-focus: #8b5cf6;
  --purple:       #8b5cf6;
  --purple-dark:  #7c3aed;
  --purple-light: #a78bfa;
  --purple-glow:  rgba(139, 92, 246, 0.15);
  --purple-glow2: rgba(139, 92, 246, 0.08);
  --text-1:       #f1f1f1;
  --text-2:       #9ca3af;
  --text-3:       #6b7280;
  --green:        #25d366;
  --wa-header:    #1f2c34;
  --wa-chat-bg:   #0b141a;
  --wa-bubble:    #005c4b;
  --wa-bar:       #1f2c34;
  --r-sm:         8px;
  --r:            12px;
  --r-lg:         20px;
  --r-xl:         28px;
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 40% at 50% 0%, rgba(90, 40, 200, 0.12) 0%, transparent 60%);
  color: var(--text-1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Header ────────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.02em;
}
.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--purple);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}
.logo-icon svg { width: 100%; height: 100%; fill: white; }

.header-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--purple-light);
  background: var(--purple-glow2);
  border: 1px solid rgba(139, 92, 246, 0.25);
  padding: 3px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── Main layout ───────────────────────────────────────────────────────── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}
.container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

/* ─── Card ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 40px;
  position: relative;
  overflow: visible;
}
.card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, rgba(139,92,246,0.15) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}
.card > * { position: relative; z-index: 1; }

.card-header { margin-bottom: 36px; }
.card-header h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #ffffff 0%, #c4b5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.card-header p {
  color: var(--text-2);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ─── Form groups ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: 24px; }
.form-group > label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.required { color: var(--purple-light); }
.optional { color: var(--text-3); font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 0.8em; }

/* ─── Phone input ───────────────────────────────────────────────────────── */
.phone-row {
  display: flex;
  align-items: stretch;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.phone-row:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--purple-glow);
}
.phone-row.shake { animation: shake 0.5s ease; }

.country-code {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 14px;
  border-right: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}
.flag { font-size: 1.2rem; line-height: 1; }

.phone-input-field {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-1);
  font-size: 1rem;
  padding: 12px 16px;
  min-width: 0;
  font-family: inherit;
}
.phone-input-field::placeholder { color: var(--text-3); }

.field-error {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #f87171;
  font-size: 0.8rem;
  margin-top: 7px;
}

/* ─── Editor ────────────────────────────────────────────────────────────── */
.editor-wrap {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r);
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: visible;
}
.editor-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--purple-glow);
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.tb-btn {
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 0.88rem;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tb-btn:hover {
  background: var(--purple-glow);
  color: var(--purple-light);
}
.tb-btn b  { font-weight: 900; font-size: 0.95rem; }
.tb-btn i  { font-style: italic; font-size: 0.95rem; }
.tb-btn s  { text-decoration: line-through; font-size: 0.88rem; }
.mono-icon { font-family: monospace; font-size: 0.78rem; letter-spacing: -0.02em; }
.emoji-btn { font-size: 0.95rem; }
.tb-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* Textarea */
.msg-textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-1);
  font-size: 0.95rem;
  padding: 14px 16px;
  resize: vertical;
  min-height: 110px;
  font-family: inherit;
  line-height: 1.65;
  display: block;
}
.msg-textarea::placeholder { color: var(--text-3); }

.format-hint {
  font-size: 0.72rem;
  color: var(--text-3);
  margin-top: 7px;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.01em;
}

/* ─── Emoji Picker ──────────────────────────────────────────────────────── */
.emoji-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #161616;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
  z-index: 60;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
}
.emoji-cats {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.ecat {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.05rem;
  padding: 5px 9px;
  border-radius: 6px;
  opacity: 0.45;
  transition: opacity 0.15s, background 0.15s;
}
.ecat:hover  { opacity: 0.8; background: rgba(255,255,255,0.05); }
.ecat.active { opacity: 1; background: var(--purple-glow); }

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 1px;
  max-height: 160px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.emoji-grid::-webkit-scrollbar       { width: 4px; }
.emoji-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.eg-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  padding: 5px 3px;
  border-radius: 5px;
  line-height: 1;
  transition: background 0.1s, transform 0.1s;
}
.eg-btn:hover {
  background: var(--purple-glow);
  transform: scale(1.2);
}

/* ─── Generate Button ───────────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 15px 20px;
  background: var(--purple);
  color: white;
  border: none;
  border-radius: var(--r);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  letter-spacing: -0.01em;
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.12) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}
.btn-primary:hover {
  background: var(--purple-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(139, 92, 246, 0.4);
}
.btn-primary:hover::after { transform: translateX(100%); }
.btn-primary:active { transform: translateY(0); }
.btn-ico { width: 18px; height: 18px; flex-shrink: 0; }

/* ─── Result Card ───────────────────────────────────────────────────────── */
.result-card {
  background: linear-gradient(135deg, rgba(139,92,246,0.07) 0%, rgba(139,92,246,0.03) 100%);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--r);
  padding: 20px;
  animation: slideUp 0.3s ease;
}
.result-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--purple-light);
  margin-bottom: 12px;
}
.result-label svg { fill: #4ade80; flex-shrink: 0; }

.link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.link-display {
  flex: 1;
  font-size: 0.82rem;
  color: var(--purple-light);
  font-family: 'Courier New', monospace;
  word-break: break-all;
  line-height: 1.4;
}
.copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--purple);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
  font-family: inherit;
}
.copy-btn:hover   { background: var(--purple-dark); }
.copy-btn:active  { transform: scale(0.97); }
.copy-btn.copied  { background: #16a34a; }

.copy-ok {
  color: #4ade80;
  font-size: 0.82rem;
  margin-bottom: 12px;
  animation: fadeIn 0.2s ease;
}
.btn-outline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  margin-top: 2px;
  font-family: inherit;
}
.btn-outline:hover {
  border-color: var(--purple);
  color: var(--purple-light);
  background: var(--purple-glow2);
}

/* ─── Right Panel / Mockup ──────────────────────────────────────────────── */
.right-panel {
  position: sticky;
  top: 84px;
}
.mockup-wrap { text-align: center; }
.mockup-lbl {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
}
.live-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
  flex-shrink: 0;
}

/* ─── Phone Frame ───────────────────────────────────────────────────────── */
.phone-frame {
  width: 268px;
  height: 536px;
  background: #1a1a1a;
  border-radius: 46px;
  border: 2.5px solid #2e2e2e;
  box-shadow:
    0 0 0 1px #0a0a0a,
    0 40px 80px rgba(0,0,0,0.9),
    0 8px 24px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
  margin: 0 auto;
}
.dynamic-island {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 26px;
  background: #0a0a0a;
  border-radius: 13px;
  z-index: 10;
  box-shadow: 0 0 0 1px #222;
}
.phone-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--wa-chat-bg);
  border-radius: 44px;
  overflow: hidden;
}
.home-bar {
  position: absolute;
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 104px;
  height: 4px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  z-index: 20;
}

/* ─── WhatsApp UI ───────────────────────────────────────────────────────── */
.wa-header {
  background: var(--wa-header);
  padding: 42px 12px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.wa-back-btn {
  color: #aebac1;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}
.wa-avi {
  width: 34px;
  height: 34px;
  background: #2a3942;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.wa-contact-info {
  flex: 1;
  min-width: 0;
}
.wa-num {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #e9edef;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-online {
  font-size: 0.6rem;
  color: #8696a0;
}
.wa-icons {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.wa-chat {
  flex: 1;
  background: var(--wa-chat-bg);
  background-image:
    radial-gradient(circle at 30% 60%, rgba(20,15,40,0.3) 0%, transparent 50%);
  padding: 10px 8px 8px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  overflow: hidden;
}
.wa-date-pill {
  text-align: center;
  font-size: 0.6rem;
  color: #8696a0;
  background: rgba(30,45,55,0.7);
  border-radius: 100px;
  padding: 2px 8px;
  align-self: center;
  margin-bottom: 4px;
}
.bubble-wrap {
  display: flex;
  justify-content: flex-end;
}
.wa-bubble {
  background: var(--wa-bubble);
  border-radius: 8px 0px 8px 8px;
  padding: 6px 8px 4px;
  max-width: 92%;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.wa-bubble::after {
  content: '';
  position: absolute;
  top: 0;
  right: -7px;
  border-left: 7px solid var(--wa-bubble);
  border-top: 7px solid transparent;
}
.bubble-txt {
  font-size: 0.72rem;
  color: #e9edef;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
  min-height: 14px;
}
.bubble-txt.placeholder {
  color: #8696a0;
  font-style: italic;
}
.bubble-txt strong { font-weight: 700; }
.bubble-txt em     { font-style: italic; }
.bubble-txt del    { text-decoration: line-through; opacity: 0.8; }
.bubble-txt .wa-code {
  font-family: 'Courier New', monospace;
  background: rgba(0,0,0,0.25);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.68rem;
}
.bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 2px;
}
.bubble-time {
  font-size: 0.57rem;
  color: rgba(233,237,239,0.55);
  white-space: nowrap;
}
.bubble-check { width: 16px; height: 10px; flex-shrink: 0; }

.wa-bar {
  background: var(--wa-bar);
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.wa-bar-icon { font-size: 0.95rem; cursor: pointer; }
.wa-bar-field {
  flex: 1;
  background: #2a3942;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.67rem;
  color: #8696a0;
}
.wa-bar-mic {
  width: 28px;
  height: 28px;
  background: var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wa-bar-mic svg { fill: white; }

/* ─── Footer ────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 22px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.8rem;
}
.footer-credit {
  margin-top: 10px;
  color: var(--text-3);
}
.footer-credit a {
  color: var(--text-2);
  transition: color .2s;
}
.footer-credit a:hover {
  color: var(--green);
}

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

/* ─── Animations ────────────────────────────────────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);    }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes shake {
  0%,100% { transform: translateX(0);  }
  15%      { transform: translateX(-8px); }
  30%      { transform: translateX(7px);  }
  45%      { transform: translateX(-5px); }
  60%      { transform: translateX(4px);  }
  75%      { transform: translateX(-2px); }
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1);    }
  50%      { opacity: 0.5; transform: scale(0.8); }
}

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .container {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .right-panel {
    position: static;
    order: -1;
  }
  .main { padding: 32px 20px 48px; }
}

@media (max-width: 600px) {
  .card { padding: 24px 20px; }
  .card-header h1 { font-size: 1.6rem; }

  .phone-frame {
    width: 240px;
    height: 480px;
    border-radius: 40px;
  }
  .dynamic-island { width: 80px; height: 22px; top: 9px; }
  .phone-screen { border-radius: 38px; }
  .wa-header { padding: 36px 10px 8px; }

  .header-inner { padding: 12px 16px; }
  .header-badge { display: none; }
  .main { padding: 24px 14px 40px; }
}

@media (max-width: 380px) {
  .phone-frame { width: 220px; height: 440px; }
  .emoji-grid  { grid-template-columns: repeat(7, 1fr); }
}
