:root {
  --bg: #080810;
  --card: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.2);
  --text: #f0f0f0;
  --muted: #777;
  --accent: #a78bfa;
  --spring: #34d399;
  --gold: #fbbf24;
  --pink: #f472b6;
  --input-bg: rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Poppins', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 60px;
}

/* ── Navbar ── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(8, 8, 16, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  padding: 0;
}
.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  font-family: 'Inter', sans-serif;
}
.nav-home {
  color: var(--text);
  text-decoration: none;
  font-size: 25px;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 25px;
  cursor: pointer;
  background: var(--card);
  border: 1px solid var(--border);
  transition: border-color 0.2s;
  display: inline-block;
}
.nav-home:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}
.nav-icons {
  display: flex;
  gap: 15px;
}
.nav-icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 1.1rem;
  text-decoration: none;
  transition: all 0.3s;
  font-size: 30px;
}
.nav-icon:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px) scale(1.1);
}
.nav-icon.active {
  background: rgba(167, 139, 250, 0.2);
  border-color: rgba(167, 139, 250, 0.5);
}

/* ── Editor Wrapper ── */
.editor-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Header ── */
.editor-header {
  text-align: center;
  padding: 12px 0 4px;
}
.editor-header .emoji {
  font-size: 3.5rem;
  display: block;
  margin-top: 25px;
}
.editor-header h1 {
  font-size: 1.7rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--pink), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.editor-header p {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 8px;
}

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  transition: border-color 0.2s;
}
.card:focus-within {
  border-color: rgba(167, 139, 250, 0.4);
}

.card-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.card-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.card-label h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.optional {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
}

/* ── Inputs ── */
.input-wrap {
  position: relative;
}
input[type='text'],
textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  padding: 12px 16px;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  resize: none;
}
input[type='text']:focus,
textarea:focus {
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.1);
}
input[type='text']::placeholder,
textarea::placeholder {
  color: #998d8d;
}

.char-count {
  display: block;
  text-align: right;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
  transition: color 0.2s;
}
.char-count.warn {
  color: #fbbf24;
}
.char-count.danger {
  color: #f87171;
}

/* ── Eggs Grid ── */
.eggs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.egg-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.egg-box-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.egg-box textarea {
  height: 80px;
  font-size: 0.9rem;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.5);
}
.egg-box .char-count {
  font-size: 0.65rem;
}

/* ── Photo Upload ── */
.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}
.photo-upload-area:hover,
.photo-upload-area.drag-over {
  border-color: rgba(167, 139, 250, 0.5);
  background: rgba(167, 139, 250, 0.04);
}
.photo-upload-area input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 8px;
}
.upload-text {
  font-size: 0.9rem;
  color: var(--muted);
}
.upload-sub {
  font-size: 0.75rem;
  color: #555;
  margin-top: 4px;
}

.photo-preview {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.photo-preview.visible {
  display: flex;
}
.photo-preview img {
  max-width: 100%;
  max-height: 200px;
  width: auto;
  height: auto;
  border-radius: 10px;
  object-fit: contain;
  border: 2px solid rgba(167, 139, 250, 0.5);
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.2);
}
.photo-preview-name {
  font-size: 0.8rem;
  color: var(--muted);
}
.photo-change {
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
}

/* ── CTA Button ── */
#btnCreate {
  width: 100%;
  padding: 18px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  color: white;
  font-family: 'Poppins', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
  margin-top: 8px;
  box-shadow: 0 8px 24px rgba(167, 139, 250, 0.3);
  position: relative;
  overflow: hidden;
}
#btnCreate:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(167, 139, 250, 0.45);
}
#btnCreate:active {
  transform: translateY(0);
}
#btnCreate.loading {
  opacity: 0.7;
  pointer-events: none;
  cursor: default;
}

.btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.loading .spinner {
  display: block;
}
.loading .btn-text {
  opacity: 0.7;
}

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

/* ── Result Popup ── */
#result {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}
#result.active {
  display: flex;
}

.result-content {
  background: rgba(20, 20, 36, 0.95);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 20px;
  padding: 32px 24px;
  width: 100%;
  max-width: 480px;
  text-align: center;
  box-shadow: 0 0 60px rgba(167, 139, 250, 0.15);
}
.result-emoji {
  font-size: 3rem;
  margin-bottom: 12px;
}
.result-content h3 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.result-content .result-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.link-box {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  align-items: center;
}
#linkOutput {
  flex: 1;
  word-break: break-all;
  font-size: 0.72rem;
  color: var(--accent);
  text-align: left;
}
#btnCopy {
  flex-shrink: 0;
  padding: 8px 14px;
  background: rgba(167, 139, 250, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 8px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}
#btnCopy:hover {
  background: rgba(167, 139, 250, 0.3);
}

.share-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.share-btn {
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    transform 0.2s,
    opacity 0.2s;
  color: white;
}
.share-btn:hover {
  transform: scale(1.03);
}
#btnWhatsapp {
  background: #25d366;
}
#btnShare {
  background: rgba(255, 255, 255, 0.12);
}

#closeResult {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 10px 24px;
  border-radius: 50px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition:
    border-color 0.2s,
    color 0.2s;
}
#closeResult:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

/* ── SEO hidden ── */
#seo-info-editor {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 768px) {
  .navbar-container {
    padding: 13px 10px;
  }

  .nav-home {
    padding: 8px 18px;
    font-size: 16px;
  }

  .nav-icon {
    width: 30px;
    height: 30px;
    font-size: 20px;
  }

  .nav-icons {
    gap: 4px;
  }

  .eggs-grid {
    grid-template-columns: 1fr;
  }
  .share-row {
    grid-template-columns: 1fr;
  }
  .editor-header h1 {
    font-size: 1.4rem;
  }
}
