/* ============================================================
   BORAVERSE — Our Purple Universe
   Diseño: lavanda, violeta, negro y blanco; estrellas y
   corazones morados; modo nocturno de cielo estrellado.
   ============================================================ */

:root {
  --lavender: #ede9fe;
  --lavender-soft: #f5f3ff;
  --violet: #7c3aed;
  --violet-dark: #5b21b6;
  --purple: #a855f7;
  --night: #17102b;
  --night-2: #241545;
  --ink: #1f1b2e;
  --white: #ffffff;
  --gray: #6b7280;
  --danger: #dc2626;
  --radius: 18px;
  --shadow: 0 8px 24px rgba(91, 33, 182, 0.14);
}

* { box-sizing: border-box; }

/* Las secciones ocultas (hidden) deben ocultarse de verdad,
   aunque su clase use display:flex (p. ej. .auth-view). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--lavender-soft);
  color: var(--ink);
}

button, input, textarea, select { font: inherit; }
img { max-width: 100%; }
a { color: var(--violet); }

/* ---------- Aviso de configuración ---------- */
.setup-warning {
  background: #fef3c7;
  color: #92400e;
  padding: 12px 16px;
  font-size: 0.92rem;
  text-align: center;
  border-bottom: 2px solid #f59e0b;
}
.setup-warning code { background: rgba(0,0,0,0.08); padding: 1px 5px; border-radius: 6px; }

/* ---------- Acceso ---------- */
.auth-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(2px 2px at 20% 30%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 70% 20%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 85% 60%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 40% 75%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 10% 85%, #fff 50%, transparent 51%),
    linear-gradient(160deg, var(--night) 0%, var(--night-2) 55%, var(--violet-dark) 100%);
}
.auth-card {
  background: var(--white);
  border-radius: 24px;
  padding: 28px 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
  text-align: center;
}
.logo {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--violet-dark);
}
.logo-sub { margin: 0; color: var(--purple); font-style: italic; }
.stars { color: var(--purple); letter-spacing: 6px; margin: 10px 0 2px; }
.tagline { color: var(--violet); font-weight: 600; }

/* ---------- Formularios ---------- */
.form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.form h2, .form h3 { text-align: center; color: var(--violet-dark); margin: 6px 0; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; font-weight: 600; }
.form input, .form textarea, .form select,
.search-input {
  border: 2px solid var(--lavender);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--white);
  outline: none;
  width: 100%;
}
.form input:focus, .form textarea:focus, .form select:focus,
.search-input:focus { border-color: var(--purple); }
.form-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.form-switch { text-align: center; font-size: 0.92rem; }
.form-status { color: var(--violet); font-weight: 600; margin: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--violet), var(--purple));
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-primary:active { transform: scale(0.98); }
.btn-secondary {
  background: var(--white);
  color: var(--violet-dark);
  border: 2px solid var(--violet);
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  margin-top: 16px;
}
.link-btn {
  background: none; border: none; color: var(--violet);
  font-weight: 700; cursor: pointer; padding: 0;
}
.file-btn {
  background: var(--lavender);
  color: var(--violet-dark);
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.mini-btn {
  background: var(--lavender-soft);
  border: 1px solid var(--lavender);
  color: var(--violet-dark);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}
.mini-btn:disabled { opacity: 0.6; cursor: default; }

.error-box {
  background: #fee2e2; color: var(--danger);
  border-radius: 12px; padding: 10px 12px; font-size: 0.9rem;
}

/* ---------- Cabecera y navegación ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: linear-gradient(120deg, var(--night), var(--violet-dark));
  color: var(--white);
}
.header-left { display: flex; flex-direction: column; }
.header-logo { font-weight: 800; letter-spacing: 2px; font-size: 1.15rem; }
.header-sub { font-size: 0.75rem; opacity: 0.85; font-style: italic; }
.lang-select {
  border-radius: 999px; border: none; padding: 7px 10px;
  background: rgba(255,255,255,0.16); color: var(--white);
}
.lang-select option { color: var(--ink); }

.app-main {
  max-width: 640px; margin: 0 auto;
  padding: 16px 16px 96px;
}
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-around;
  background: var(--white);
  border-top: 2px solid var(--lavender);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav button {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  font-size: 1.15rem; color: var(--gray); gap: 2px;
}
.bottom-nav button span { font-size: 0.68rem; font-weight: 600; }
.bottom-nav button.active { color: var(--violet); }

/* ---------- Vistas y tarjetas ---------- */
.view-title { color: var(--violet-dark); margin: 6px 0 4px; font-size: 1.45rem; }
.view-title.light { color: var(--white); }
.view-sub { color: var(--gray); margin-top: 0; }
.section-title { color: var(--violet-dark); margin: 22px 0 10px; font-size: 1.15rem; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.hero {
  text-align: center;
  padding: 26px 18px;
  border-radius: var(--radius);
  color: var(--white);
  background:
    radial-gradient(2px 2px at 15% 25%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 80% 20%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 60% 70%, #fff 50%, transparent 51%),
    linear-gradient(150deg, var(--night) 0%, var(--night-2) 60%, var(--violet-dark) 100%);
  box-shadow: var(--shadow);
}
.hero h1 { margin: 6px 0; font-size: 1.6rem; }
.hero .tagline { color: #d8b4fe; font-size: 1.05rem; }
.hero-sub { opacity: 0.85; font-style: italic; margin-bottom: 0; }

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; color: var(--violet-dark); }
.card-img { border-radius: 12px; margin: 8px 0; width: 100%; }
.card-date { color: var(--gray); font-size: 0.8rem; display: block; }
.badge {
  display: inline-block; background: var(--lavender); color: var(--violet-dark);
  border-radius: 999px; padding: 2px 10px; font-size: 0.78rem; font-weight: 700;
}
.disclaimer { color: var(--gray); font-size: 0.78rem; font-style: italic; text-align: center; }

.empty-state {
  text-align: center; padding: 26px 16px;
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); color: var(--gray);
}
.empty-icon { font-size: 2rem; margin-bottom: 6px; }
.empty-state p { margin: 4px 0; }
.empty-sub { font-size: 0.88rem; }

/* ---------- Feed ---------- */
.post-head, .message-head {
  display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
}
.post-name, .message-name { font-weight: 700; color: var(--violet-dark); }
.post-actions, .message-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* ---------- Salas y chat ---------- */
.room-card {
  width: 100%; display: flex; gap: 14px; align-items: center;
  background: var(--white); border: none; border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; cursor: pointer;
  box-shadow: var(--shadow); text-align: left;
}
.room-card strong { display: block; color: var(--violet-dark); font-size: 1.05rem; }
.room-card small { color: var(--gray); }
.room-icon { font-size: 1.7rem; }
.norms-note { color: var(--gray); font-size: 0.88rem; }

.chat-header { display: flex; align-items: center; gap: 10px; }
.back-btn {
  background: var(--lavender); border: none; border-radius: 999px;
  padding: 7px 13px; cursor: pointer; color: var(--violet-dark); font-weight: 700;
}
.messages-list {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 2px 8px;
  min-height: 40vh;
}
.message {
  background: var(--white); border-radius: 16px; padding: 10px 14px;
  box-shadow: 0 3px 10px rgba(91,33,182,0.08);
  max-width: 92%;
}
.message.mine { align-self: flex-end; background: var(--lavender); }
.message-country { font-size: 0.78rem; color: var(--purple); font-weight: 700; }
.message-time { margin-left: auto; color: var(--gray); font-size: 0.75rem; }
.message-text { margin: 4px 0; white-space: pre-wrap; word-break: break-word; }
.chat-media { border-radius: 12px; margin-top: 6px; }
.chat-audio { width: 100%; margin-top: 6px; }
.message-translation {
  margin-top: 8px; padding: 8px 10px;
  background: var(--lavender-soft); border-left: 3px solid var(--purple);
  border-radius: 8px; font-size: 0.92rem; color: var(--violet-dark);
}
.chat-form {
  position: sticky; bottom: 76px;
  display: flex; gap: 8px; align-items: center;
  background: var(--white); padding: 10px; border-radius: 999px;
  box-shadow: var(--shadow);
}
.chat-form input[type="text"] {
  flex: 1; border: none; outline: none; padding: 8px 6px; min-width: 0;
}
.btn-send { padding: 10px 16px; }
.record-status { text-align: center; color: var(--violet); font-size: 0.88rem; min-height: 1em; }

/* ---------- ARMY Connect ---------- */
.search-input { margin-bottom: 14px; }
.user-card { display: flex; gap: 12px; align-items: center; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--violet), var(--purple));
  color: var(--white); display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.15rem;
}
.avatar.big { width: 74px; height: 74px; font-size: 1.8rem; margin: 0 auto; }
.user-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.user-info span { color: var(--gray); font-size: 0.88rem; }
.user-info .badge { align-self: flex-start; }

/* ---------- Stories / Cartas / Diario ---------- */
.story-body { white-space: pre-wrap; }
.letter-card { border-left: 4px solid var(--purple); }
.diary-card { background: #faf5ff; }

/* ---------- Proyectos ---------- */
.project-count { color: var(--violet-dark); }

/* ---------- Calendario ---------- */
.calendar-card { display: flex; gap: 14px; align-items: center; }
.calendar-star { color: var(--purple); font-size: 1.5rem; }
.calendar-card div { display: flex; flex-direction: column; gap: 2px; }
.calendar-card span { color: var(--gray); font-size: 0.9rem; }
.calendar-card .badge { align-self: flex-start; }

/* ---------- Galería ---------- */
.gallery-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px;
}
.gallery-item { margin: 0; border-radius: 14px; overflow: hidden; background: var(--white); box-shadow: var(--shadow); }
.gallery-item img { width: 100%; height: 170px; object-fit: cover; display: block; }
.gallery-item figcaption { padding: 8px 10px; font-size: 0.85rem; color: var(--gray); }

/* ---------- Juegos y Mood ---------- */
.quiz-options { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.quiz-option {
  background: var(--lavender-soft); border: 2px solid var(--lavender);
  border-radius: 12px; padding: 10px; cursor: pointer; text-align: left; font-weight: 600;
}
.quiz-option:hover { border-color: var(--purple); }
.quiz-feedback { font-weight: 700; color: var(--violet-dark); }
.quiz-progress { color: var(--gray); font-size: 0.88rem; }
.mood-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.mood-btn {
  background: var(--white); border: 2px solid var(--lavender);
  border-radius: 999px; padding: 10px 16px; cursor: pointer; font-weight: 700;
}
.mood-btn:hover { border-color: var(--purple); }
.song-list { list-style: none; padding: 0; margin: 8px 0 0; }
.song-list li { padding: 6px 0; border-bottom: 1px dashed var(--lavender); }

/* ---------- Purple Map ---------- */
.map-hero {
  text-align: center; color: var(--white);
  border-radius: var(--radius); padding: 26px 16px; margin-bottom: 14px;
  background:
    radial-gradient(2.5px 2.5px at 12% 30%, #e9d5ff 50%, transparent 51%),
    radial-gradient(2px 2px at 30% 65%, #e9d5ff 50%, transparent 51%),
    radial-gradient(2.5px 2.5px at 52% 25%, #e9d5ff 50%, transparent 51%),
    radial-gradient(2px 2px at 68% 55%, #e9d5ff 50%, transparent 51%),
    radial-gradient(2.5px 2.5px at 84% 35%, #e9d5ff 50%, transparent 51%),
    radial-gradient(2px 2px at 92% 70%, #e9d5ff 50%, transparent 51%),
    linear-gradient(160deg, var(--night) 0%, var(--night-2) 60%, var(--violet-dark) 100%);
  box-shadow: var(--shadow);
}
.map-sub { opacity: 0.9; font-style: italic; }
.map-stats { display: flex; justify-content: center; gap: 34px; margin: 16px 0; }
.map-stats div { display: flex; flex-direction: column; }
.map-stats strong { font-size: 1.6rem; }
.map-stats span { font-size: 0.8rem; opacity: 0.85; }
.btn-checkin { font-size: 1.02rem; }
.checkin-msg { color: #d8b4fe; font-weight: 700; }
.country-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--white); border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 3px 10px rgba(91,33,182,0.08);
}
.country-dot { color: var(--purple); }
.country-name { font-weight: 700; flex: 1; }
.country-count { color: var(--violet); font-weight: 700; font-size: 0.9rem; }

/* ---------- Normas / Menú / Perfil ---------- */
.rules-list { line-height: 1.65; padding-left: 18px; }
.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.menu-item {
  background: var(--white); border: none; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 1.5rem; color: var(--ink); text-decoration: none;
}
.menu-item span { font-size: 0.95rem; font-weight: 700; color: var(--violet-dark); }
.about-card { text-align: center; }
.about-card p { text-align: left; line-height: 1.6; }
.about-card .tagline { text-align: center; }

/* ---------- Panel de administración ---------- */
.admin-main { padding-bottom: 40px; }
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-tab {
  background: var(--white); border: 2px solid var(--lavender);
  border-radius: 999px; padding: 9px 15px; cursor: pointer; font-weight: 700;
}
.admin-tab.active { background: var(--violet); color: var(--white); border-color: var(--violet); }
.admin-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Escritorio ---------- */
@media (min-width: 768px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
  .menu-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Selector de idioma en la pantalla de acceso ---------- */
.auth-lang-row { text-align: center; margin: 10px 0 2px; }
.auth-lang-select {
  background: rgba(109, 63, 191, 0.12); color: var(--ink);
  font-size: 15px; padding: 8px 12px;
}
