/* Ryvlo PWA — mismo lenguaje visual que la app Android:
   fondo con gradiente morado-vino oscuro + acentos rosa/dorado/turquesa. */

:root {
  --bg-1: #2D1B4E;
  --bg-2: #4A1942;
  --bg-3: #1A1033;
  --pink: #EC4899;
  --pink-bright: #FF3D9E;
  --gold: #F59E0B;
  --gold-bright: #FFC107;
  --turquoise: #06B6D4;
  --text: #F5F3FA;
  --text-muted: rgba(245, 243, 250, 0.72);
  --card-bg: rgba(255, 255, 255, 0.08);
  --card-bg-soft: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.14);
  --error: #FCA5A5;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 45%, var(--bg-3) 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior-y: none;
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(14px + var(--safe-top)) 16px 14px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(26, 16, 51, 0.55);
  backdrop-filter: blur(10px);
}

.topbar h1 {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text);
  padding: 8px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-btn:active { background: rgba(255,255,255,0.1); }
.icon-btn svg { width: 22px; height: 22px; }

.topbar-actions {
  display: flex;
  gap: 4px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 10px;
  cursor: pointer;
}

main.view {
  flex: 1;
  padding: 16px 16px calc(32px + var(--safe-bottom));
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  display: none;
}
main.view.active { display: block; }

.subtitle { color: var(--text-muted); margin: 0 0 18px; font-size: 15px; }

.field {
  width: 100%;
  margin-bottom: 16px;
}

label.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.field[data-accent="pink"] label.field-label { color: var(--pink); }
.field[data-accent="gold"] label.field-label { color: var(--gold); }
.field[data-accent="turquoise"] label.field-label { color: var(--turquoise); }

.text-input, textarea.text-input, select.text-input {
  width: 100%;
  background: var(--card-bg-soft);
  border: 1.5px solid var(--card-border);
  border-radius: 14px;
  padding: 14px 14px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}

textarea.text-input { min-height: 84px; resize: vertical; }

.text-input::placeholder { color: rgba(245,243,250,0.4); }

.field[data-accent="pink"] .text-input:focus { border-color: var(--pink); }
.field[data-accent="gold"] .text-input:focus { border-color: var(--gold); }
.field[data-accent="turquoise"] .text-input:focus { border-color: var(--turquoise); }

.field-icon-wrap { position: relative; }
.field-icon-wrap svg {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

.btn-outline {
  width: 100%;
  padding: 14px;
  border-radius: 999px;
  border: 1.5px solid var(--pink);
  background: transparent;
  color: var(--pink);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 14px;
}
.btn-outline:disabled { color: rgba(236,72,153,0.6); border-color: rgba(236,72,153,0.6); cursor: default; }
.btn-outline svg { width: 18px; height: 18px; }

.btn-gradient {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: none;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  background: linear-gradient(90deg, var(--pink-bright), var(--gold-bright));
  box-shadow: 0 8px 26px rgba(255,61,158,0.35), 0 8px 26px rgba(255,193,7,0.2);
}
.btn-gradient:disabled {
  opacity: 0.5;
  box-shadow: none;
  cursor: default;
}
.btn-gradient svg { width: 18px; height: 18px; }

.error-text { color: var(--error); font-size: 14px; margin: -6px 0 14px; }

.spinner {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Preview screen --- */
.preview-image-wrap {
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--card-border);
}
.preview-image-wrap img, .preview-image-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}
.preview-placeholder, .loading-box {
  padding: 80px 20px;
  text-align: center;
  color: var(--text-muted);
}
.loading-box .spinner { width: 34px; height: 34px; border-width: 3px; margin: 0 auto 14px; }

.btn-secondary {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 1.5px solid var(--card-border);
  background: var(--card-bg-soft);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  margin-bottom: 12px;
}

.saved-banner {
  text-align: center;
  color: var(--gold);
  font-weight: 700;
  margin: 4px 0 12px;
}

/* --- Cards used in FAQ / Settings / Gallery --- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  margin-bottom: 12px;
  overflow: hidden;
}

.faq-item {
  display: flex;
}
.faq-accent { width: 5px; flex-shrink: 0; }
.faq-body { flex: 1; padding: 16px; cursor: pointer; }
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}
.faq-question svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.faq-item.open .faq-question svg { transform: rotate(180deg); }
.faq-answer {
  display: none;
  color: var(--text-muted);
  margin-top: 10px;
  font-size: 14.5px;
  line-height: 1.5;
}
.faq-item.open .faq-answer { display: block; }

.settings-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  cursor: pointer;
}
.settings-badge {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.settings-badge svg { width: 22px; height: 22px; }
.settings-row .label { flex: 1; font-weight: 700; }
.settings-row .chev { color: rgba(245,243,250,0.5); width: 20px; height: 20px; }

.lang-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
}
.lang-row .flag { font-size: 22px; }
.lang-row .label { flex: 1; font-weight: 600; }
.lang-row .check { width: 20px; height: 20px; color: var(--pink-bright); visibility: hidden; }
.lang-row.selected .check { visibility: visible; }
.lang-row.selected { background: rgba(255,255,255,0.05); }

/* --- About --- */
.about-wrap { display: flex; flex-direction: column; align-items: center; }
.about-logo-halo {
  width: 140px; height: 140px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle, rgba(245,158,11,0.35), transparent 70%);
  margin: 8px 0 18px;
}
.about-logo-halo img { width: 96px; height: 96px; object-fit: contain; border-radius: 20px; }
.about-card {
  width: 100%;
  text-align: center;
  padding: 22px;
}
.about-version { color: var(--pink); font-weight: 700; margin: 0 0 12px; }
.about-divider { border: none; border-top: 1px solid rgba(255,255,255,0.15); margin: 12px 0; }
.about-desc { color: rgba(245,243,250,0.9); margin: 0 0 12px; }
.about-dev { color: var(--gold); font-weight: 700; margin: 0; }

/* --- Gallery --- */
.gallery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.gallery-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; overflow: hidden; }
.gallery-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
.gallery-card .title { padding: 8px 10px 2px; font-size: 13px; font-weight: 700; }
.gallery-card .actions { display: flex; justify-content: flex-end; gap: 4px; padding: 4px 8px 8px; }
.gallery-empty { text-align: center; color: var(--text-muted); padding: 80px 20px; }

/* --- Install banner --- */
.install-banner {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 50;
  background: linear-gradient(135deg, rgba(236,72,153,0.16), rgba(245,158,11,0.16));
  border: 1px solid rgba(245,158,11,0.35);
  border-radius: 16px;
  padding: 14px 16px;
  display: none;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(10px);
}
.install-banner.visible { display: flex; }
.install-banner .txt { flex: 1; font-size: 13.5px; line-height: 1.4; }
.install-banner .close-btn { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; padding: 0 4px; }

.hidden { display: none !important; }
