/* ============================================================
   Portal Secreto — Dark & Mysterious Theme
   ============================================================ */

:root {
  --bg:          #141420;
  --bg-card:     #1c1c2e;
  --bg-card-hover: #222238;
  --border:      rgba(155, 89, 182, 0.25);
  --border-hover:rgba(155, 89, 182, 0.55);
  --accent:      #a855f7;
  --accent-bright:#d8a4ff;
  --accent-glow: rgba(155, 89, 182, 0.25);
  --text:        #e8e8f0;
  --text-muted:  #7777aa;
  --text-dim:    #4a4a6a;
  --danger:      #e74c3c;
  --success:     #2ecc71;
  --warning:     #f39c12;
  --radius:      16px;
  --radius-sm:   10px;
  --shadow:      0 8px 32px rgba(0,0,0,0.5);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --transition:  0.28s cubic-bezier(0.4, 0, 0.2, 1);
  --font-body:   'Inter', system-ui, sans-serif;
  --font-display:'Playfair Display', Georgia, serif;
  --nav-h:       64px;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: var(--accent-bright); text-decoration: none; }
a:hover { color: var(--text); }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── Background animated orbs ── */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  animation: drift 20s ease-in-out infinite;
}
.orb-1 { width: 600px; height: 600px; background: #9b59b6; top: -200px; left: -150px; animation-duration: 25s; }
.orb-2 { width: 400px; height: 400px; background: #3498db; bottom: -100px; right: -100px; animation-duration: 18s; animation-delay: -8s; }
.orb-3 { width: 300px; height: 300px; background: #e91e8c; top: 40%; left: 50%; animation-duration: 22s; animation-delay: -12s; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(40px, -60px) scale(1.08); }
  66%       { transform: translate(-30px, 40px) scale(0.95); }
}

/* ── Navbar ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(8, 8, 15, 0.85);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text);
  flex-shrink: 0;
}
.nav-brand i { color: var(--accent); font-size: 1.4rem; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: rgba(155,89,182,0.12);
}
.nav-link.active { color: var(--accent-bright); }
.nav-cta {
  margin-left: 8px;
  background: var(--accent);
  color: #fff !important;
  padding: 8px 18px;
}
.nav-cta:hover { background: var(--accent-bright); color: var(--bg) !important; }

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  margin-left: auto;
  border-radius: 8px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: var(--transition);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Main layout ── */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* ── Page header ── */
.page-header {
  text-align: center;
  margin-bottom: 32px;
}
.page-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  background: linear-gradient(135deg, var(--text) 0%, var(--accent-bright) 60%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.page-title i { -webkit-text-fill-color: var(--accent); }
.page-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  font-style: italic;
}

/* ── Sort tabs ── */
.sort-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.sort-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.sort-tab:hover { border-color: var(--accent); color: var(--accent-bright); }
.sort-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Stories grid ── */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

/* ── Story card ── */
.story-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  animation: cardIn 0.5s ease both;
  animation-delay: var(--delay, 0ms);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.story-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 0 1px var(--border-hover);
  background: var(--bg-card-hover);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 0;
}
.anon-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: hsla(var(--hue, 270), 50%, 18%, 1);
  border: 2px solid hsla(var(--hue, 270), 55%, 42%, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.emoji-avatar { font-size: 1.5rem; line-height: 1; }

.card-meta { flex: 1; min-width: 0; }
.card-meta-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}
.age-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-bright);
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 50px;
  padding: 1px 8px;
  line-height: 1.6;
}
.country-flag-img {
  display: inline-block;
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  vertical-align: middle;
  margin-left: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.country-flag {
  font-size: 1.1rem;
  line-height: 1;
  cursor: default;
}
.card-time  { font-size: 0.75rem; color: var(--text-dim); display: block; }

.card-image {
  margin-top: 14px;
  overflow: hidden;
  max-height: 260px;
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform var(--transition);
}
.card-image img:hover { transform: scale(1.03); }

.card-body {
  padding: 16px;
  flex: 1;
}
.story-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
/* ── Reaction bar ── */
.reaction-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.reaction-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
}
.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 4px 6px;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.82rem;
  user-select: none;
}
.reaction-chip:hover {
  border-color: var(--accent);
  background: rgba(168,85,247,0.1);
  transform: scale(1.06);
}
.reaction-chip.mine {
  border-color: var(--accent);
  background: rgba(168,85,247,0.16);
  box-shadow: 0 0 0 2px rgba(168,85,247,0.15);
}
.reaction-chip .r-count {
  font-weight: 700;
  color: var(--text-muted);
  min-width: 12px;
}
.reaction-chip.mine .r-count { color: var(--accent-bright); }

/* Sticker en chip/picker */
.s-emoji { font-size: 1.3rem; line-height: 1; }
.s-img   { width: 28px; height: 28px; object-fit: contain; border-radius: 4px; }

/* Botón abrir picker */
.react-trigger {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: all var(--transition);
}
.react-trigger:hover {
  border-color: var(--accent);
  color: var(--accent-bright);
  background: rgba(168,85,247,0.1);
  transform: scale(1.1);
}
.react-trigger.active {
  border-color: var(--accent);
  color: var(--accent-bright);
  background: rgba(168,85,247,0.15);
}

/* ── Sticker Picker flotante ── */
.sticker-picker {
  position: fixed;
  z-index: 500;
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  padding: 10px;
  display: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.sticker-picker.open { display: block; animation: pickerIn 0.2s ease; }
@keyframes pickerIn {
  from { opacity: 0; transform: scale(0.88) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
.picker-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.sp-btn {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.sp-btn:hover {
  border-color: var(--accent);
  background: rgba(168,85,247,0.14);
  transform: scale(1.12);
}
.sp-btn.active {
  border-color: var(--accent);
  background: rgba(168,85,247,0.2);
  box-shadow: 0 0 0 3px rgba(168,85,247,0.2);
}
.sp-btn .s-emoji { font-size: 1.8rem; }
.sp-btn .s-img   { width: 36px; height: 36px; object-fit: contain; border-radius: 6px; }

/* pop animation on react */
@keyframes reactPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.45); }
  70%  { transform: scale(0.92); }
  100% { transform: scale(1); }
}
.reaction-chip.popping { animation: reactPop 0.35s ease; }

/* ── Admin sticker styles ── */
.sticker-add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 8px;
}
.sticker-add-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.sticker-hint  { font-size: 0.8rem; color: var(--text-dim); margin: -4px 0 16px; }
.sticker-form  { display: flex; flex-direction: column; gap: 16px; }
.sticker-upload-zone { min-height: 90px; }

.sticker-grid-admin {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.sticker-admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: border-color var(--transition);
}
.sticker-admin-card:hover { border-color: var(--border-hover); }
.sticker-inactive { opacity: 0.4; }
.sticker-preview-box {
  width: 60px; height: 60px;
  display: flex; align-items: center; justify-content: center;
}
.sticker-info { text-align: center; }
.sticker-name { display: block; font-size: 0.88rem; font-weight: 600; color: var(--text); }
.sticker-type-badge {
  font-size: 0.7rem; color: var(--text-dim);
  background: rgba(255,255,255,0.05);
  border-radius: 50px; padding: 2px 8px; margin-top: 3px; display: inline-block;
}
.sticker-admin-actions { display: flex; gap: 6px; }

@media (max-width: 768px) {
  .sticker-add-grid { grid-template-columns: 1fr; }
  .picker-inner { grid-template-columns: repeat(4, 1fr); }
  .sp-btn { width: 48px; height: 48px; }
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge-edited {
  background: rgba(243,156,18,0.15);
  color: var(--warning);
  border: 1px solid rgba(243,156,18,0.3);
  margin-left: auto;
}
.badge-hidden {
  background: rgba(231,76,60,0.15);
  color: var(--danger);
  border: 1px solid rgba(231,76,60,0.3);
}
.badge-img {
  background: rgba(52,152,219,0.15);
  color: #5dade2;
  border: 1px solid rgba(52,152,219,0.3);
  margin-right: 6px;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 40px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition);
  padding: 0 12px;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent-bright); }
.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.page-dots { color: var(--text-dim); padding: 0 4px; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}
.empty-icon {
  font-size: 5rem;
  color: var(--text-dim);
  margin-bottom: 20px;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}
.empty-state h2 { font-size: 1.5rem; color: var(--text-muted); margin-bottom: 8px; }
.empty-state p  { color: var(--text-dim); margin-bottom: 24px; }

/* ── Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition);
  border: none;
}
.btn-primary:hover { background: var(--accent-bright); color: var(--bg); transform: translateY(-2px); }

.btn-submit {
  width: 100%;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--accent), #7d3c98);
  color: #fff;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition);
  border: none;
  box-shadow: 0 4px 20px rgba(155,89,182,0.3);
}
.btn-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(155,89,182,0.5);
}
.btn-submit:disabled { opacity: 0.6; cursor: default; }

/* ── FAB (Floating Action Button) mobile ── */
.fab {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.4rem;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(155,89,182,0.5);
  z-index: 90;
  transition: all var(--transition);
}
.fab:hover { background: var(--accent-bright); color: var(--bg); transform: scale(1.1); }

/* ── Flash messages ── */
.flash-container {
  position: fixed;
  top: calc(var(--nav-h) + 12px);
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  width: calc(100vw - 32px);
}
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideIn 0.3s ease;
  backdrop-filter: blur(12px);
}
@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.flash-success { background: rgba(46,204,113,0.15); border: 1px solid rgba(46,204,113,0.3); color: #2ecc71; }
.flash-error   { background: rgba(231,76,60,0.15);  border: 1px solid rgba(231,76,60,0.3);  color: #e74c3c; }
.flash-close   { margin-left: auto; color: inherit; opacity: 0.6; padding: 2px 4px; }
.flash-close:hover { opacity: 1; }

/* ── Lightbox ── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 300;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

/* ── Footer ── */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px;
  color: var(--text-dim);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}

/* ── Avatar picker ── */
.avatar-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.avatar-option {
  aspect-ratio: 1;
  font-size: 1.7rem;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1;
  padding: 6px;
}
.avatar-option:hover {
  border-color: var(--accent);
  background: rgba(168,85,247,0.1);
  transform: scale(1.1);
}
.avatar-option.selected {
  border-color: var(--accent);
  background: rgba(168,85,247,0.18);
  box-shadow: 0 0 0 3px rgba(168,85,247,0.2);
  transform: scale(1.08);
}

/* ── Age picker ── */
.age-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.age-option {
  padding: 7px 16px;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.age-option:hover {
  border-color: var(--accent);
  color: var(--accent-bright);
}
.age-option.selected {
  background: rgba(168,85,247,0.15);
  border-color: var(--accent);
  color: var(--accent-bright);
}

.optional-tag {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 4px;
}

/* ═══════════════════════════════════════════════
   SUBMIT PAGE
═══════════════════════════════════════════════ */
.submit-page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: calc(100vh - var(--nav-h) - 80px);
}
.submit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 620px;
  box-shadow: var(--shadow);
}
.submit-header {
  text-align: center;
  margin-bottom: 32px;
}
.submit-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(168,85,247,0.12);
  border: 2px solid rgba(168,85,247,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  line-height: 1;
  margin: 0 auto 16px;
  transition: transform var(--transition);
}
.submit-icon:hover { transform: scale(1.05); }
.submit-header h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-bottom: 6px;
}
.submit-header p { color: var(--text-muted); font-size: 0.95rem; }

/* ── Form fields ── */
.submit-form, .edit-form { display: flex; flex-direction: column; gap: 24px; }
.field-group { display: flex; flex-direction: column; gap: 8px; }
.field-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.field-label i { color: var(--accent); }

.textarea-wrap { position: relative; }
.field-textarea {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 14px 16px 36px;
  resize: vertical;
  min-height: 140px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.char-counter {
  position: absolute;
  bottom: 10px;
  right: 14px;
  font-size: 0.75rem;
  color: var(--text-dim);
}
.char-counter.near-limit { color: var(--warning); }
.char-counter.at-limit   { color: var(--danger); }

.field-input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 12px 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.field-hint { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-icon { position: absolute; left: 14px; color: var(--text-dim); font-size: 0.9rem; pointer-events: none; }
.input-wrap .field-input { padding-left: 40px; }
.toggle-pass {
  position: absolute;
  right: 12px;
  color: var(--text-dim);
  padding: 4px;
  transition: color var(--transition);
}
.toggle-pass:hover { color: var(--text-muted); }

/* ── Upload zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(155,89,182,0.05);
}
.upload-input { display: none; }
.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 20px;
  color: var(--text-muted);
  text-align: center;
}
.upload-placeholder i { font-size: 2rem; color: var(--accent); opacity: 0.7; }
.upload-placeholder span { font-size: 0.9rem; }
.upload-placeholder small { font-size: 0.78rem; color: var(--text-dim); }
.upload-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 240px;
  overflow: hidden;
}
.upload-preview img { width: 100%; object-fit: cover; }
.remove-img {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  z-index: 2;
}
.remove-img:hover { background: var(--danger); }

/* ── Anon notice ── */
.anon-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(155,89,182,0.08);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.anon-notice i { color: var(--accent); margin-top: 1px; flex-shrink: 0; }

/* ═══════════════════════════════════════════════
   ADMIN PAGES
═══════════════════════════════════════════════ */

/* Login */
.admin-login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--nav-h) - 80px);
}
.admin-login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow);
}
.admin-login-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(155,89,182,0.12);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--accent);
  margin: 0 auto 16px;
}
.admin-login-card h1 { font-size: 1.5rem; margin-bottom: 4px; }
.admin-login-sub { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 28px; }
.admin-login-form { display: flex; flex-direction: column; gap: 18px; text-align: left; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-dim);
  transition: color var(--transition);
}
.back-link:hover { color: var(--text-muted); }

/* Dashboard */
.admin-page { max-width: 100%; }
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.admin-title {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-title i { color: var(--accent); }
.admin-sub { color: var(--text-dim); font-size: 0.85rem; margin-top: 4px; }
.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.88rem;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

.admin-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-tab {
  padding: 7px 14px;
  border-radius: 50px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition);
}
.filter-tab:hover { border-color: var(--accent); color: var(--accent-bright); }
.filter-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.search-form { margin-left: auto; }
.search-wrap {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 50px;
  overflow: hidden;
  transition: border-color var(--transition);
}
.search-wrap:focus-within { border-color: var(--accent); }
.search-icon { padding: 0 12px; color: var(--text-dim); font-size: 0.85rem; }
.search-input {
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.88rem;
  padding: 9px 0;
  width: 220px;
  outline: none;
}
.search-btn {
  padding: 9px 18px;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  transition: background var(--transition);
}
.search-btn:hover { background: var(--accent-bright); }

/* Admin table */
.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.admin-table th {
  padding: 12px 16px;
  text-align: left;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(155,89,182,0.05);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(155,89,182,0.07);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(155,89,182,0.04); }
.row-hidden td { opacity: 0.5; }

.col-id { color: var(--text-dim); font-size: 0.8rem; width: 50px; }
.col-content { max-width: 400px; }
.content-preview { color: var(--text); line-height: 1.5; margin-bottom: 6px; }
.col-votes { white-space: nowrap; }
.col-date  { white-space: nowrap; color: var(--text-muted); }
.col-status { white-space: nowrap; }
.col-actions { white-space: nowrap; }

.vote-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #e74c3c;
  font-weight: 600;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-visible { background: rgba(46,204,113,0.12); color: #2ecc71; border: 1px solid rgba(46,204,113,0.25); }
.status-hidden  { background: rgba(231,76,60,0.12);  color: #e74c3c;  border: 1px solid rgba(231,76,60,0.25); }

.action-btns { display: flex; gap: 6px; }
.action-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  font-size: 0.82rem;
  transition: all var(--transition);
  color: var(--text-muted);
}
.btn-edit:hover   { border-color: var(--accent); color: var(--accent); background: rgba(155,89,182,0.1); }
.btn-hide:hover   { border-color: var(--warning); color: var(--warning); background: rgba(243,156,18,0.1); }
.btn-show:hover   { border-color: var(--success); color: var(--success); background: rgba(46,204,113,0.1); }
.btn-delete:hover { border-color: var(--danger); color: var(--danger); background: rgba(231,76,60,0.1); }

.inline-form { display: inline; margin: 0; }

/* Edit page */
.edit-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.edit-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.panel-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title i { color: var(--accent); }
.original-text {
  font-size: 0.93rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  padding: 14px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.04);
  margin-bottom: 16px;
}
.edit-image-preview {
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.edit-image-preview img { width: 100%; max-height: 200px; object-fit: cover; }
.img-label {
  display: block;
  padding: 6px 12px;
  font-size: 0.78rem;
  color: var(--text-dim);
  background: rgba(255,255,255,0.02);
}
.story-meta-info {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.story-meta-info span { display: flex; align-items: center; gap: 5px; }

.edit-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.edit-actions .btn-submit { flex: 1; min-width: 160px; }
.btn-cancel {
  padding: 14px 20px;
  border-radius: 50px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: all var(--transition);
  text-align: center;
}
.btn-cancel:hover { border-color: var(--danger); color: var(--danger); }

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: rgba(8,8,15,0.97);
    backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px 20px;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    z-index: 99;
  }
  .nav-links.open { display: flex; }
  .nav-link { padding: 12px 16px; font-size: 1rem; }
  .nav-cta { margin-left: 0; margin-top: 8px; justify-content: center; }

  .fab { display: flex; }

  .stories-grid {
    grid-template-columns: 1fr;
  }

  .submit-card { padding: 28px 20px; }

  .edit-layout { grid-template-columns: 1fr; }

  .admin-controls { flex-direction: column; align-items: stretch; }
  .search-form { margin-left: 0; }
  .search-input { width: 100%; }
  .search-wrap { border-radius: var(--radius-sm); }

  .admin-table th:nth-child(4),
  .admin-table td:nth-child(4) { display: none; } /* ocultar fecha en mobile */

  .flash-container { right: 8px; left: 8px; max-width: none; width: auto; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .stories-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================
   Story Detail Page + Reply System
   ============================================================ */

.story-detail-page {
  max-width: 740px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.back-link-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
  transition: color var(--transition);
}
.back-link-top:hover { color: var(--accent-bright); }

/* Main story card on detail page */
.story-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 32px;
}
.story-detail-card .card-body { padding: 20px 20px 4px; }
.story-detail-card .card-footer { padding: 12px 20px 16px; }
.story-detail-card .card-header { padding: 16px 20px 0; }

.story-text-full {
  white-space: pre-wrap;
  font-size: 1.05rem;
  line-height: 1.75;
}

/* ── Replies section ── */
.replies-section {
  margin-top: 4px;
}

.replies-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.replies-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.reply-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  padding: 16px 18px;
  position: relative;
}

.reply-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.reply-avatar {
  width: 36px !important;
  height: 36px !important;
  font-size: 1.1rem !important;
  flex-shrink: 0;
}

.reply-body p {
  font-size: 0.97rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
}

.reply-admin-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

/* ── No replies state ── */
.no-replies {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-dim);
  margin-bottom: 24px;
}
.no-replies i {
  font-size: 2.2rem;
  margin-bottom: 10px;
  display: block;
  color: var(--text-dim);
}
.no-replies p { font-size: 0.95rem; }

/* ── Reply form ── */
.reply-form-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 8px;
}

.reply-form-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-bright);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Smaller avatar picker for reply form */
.avatar-picker-sm {
  gap: 6px;
}
.avatar-picker-sm .avatar-option {
  width: 40px;
  height: 40px;
  font-size: 1.3rem;
  border-radius: 10px;
}

/* Reply count button — static (non-link) variant in story detail */
.reply-count-btn.static {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.88rem;
  pointer-events: none;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .story-detail-page { padding: 16px 12px 48px; }
  .reply-form-wrap { padding: 18px 14px; }
  .story-detail-card .card-body,
  .story-detail-card .card-header { padding-left: 14px; padding-right: 14px; }
}
