/* =========================================
   COMUNIDAD CSS - PREMIUM READER INTERFACE
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --gold-primary: #FFD700;
  --gold-dark: #D4AF37;
  --bg-dark: rgba(10, 10, 10, 0.65);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 215, 0, 0.15);
  --text-primary: rgba(255, 255, 255, 0.9);
  --text-secondary: rgba(255, 255, 255, 0.6);
}

body {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  /* The background image is provided globally by pages.css. Add an extra dark tint if needed, but pages.css usually handles body::before */
  background: url('assets/fondo-login.png') no-repeat center center fixed;
  background-size: cover;
}

/* Base Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 30px;
  background: rgba(8, 6, 5, 0.85);
  border-bottom: 1px solid var(--glass-border);
  height: 70px;
  box-sizing: border-box;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  position: relative;
  z-index: 10;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 25px;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--gold-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  transition: text-shadow 0.3s ease;
}

.topbar-logo:hover {
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

.topbar-logo img {
  height: 35px;
}

.nav-tab {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  opacity: 0.7;
  transition: all 0.3s;
}

.nav-tab:hover, .nav-tab.active {
  opacity: 1;
  color: var(--gold-primary);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

.search-box {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  padding: 8px 15px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.3s;
}

.search-box:focus-within {
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
  background: rgba(255, 255, 255, 0.12);
}

.search-box input {
  background: transparent;
  border: none;
  color: white;
  margin-left: 10px;
  outline: none;
  width: 180px;
  font-family: 'Inter', sans-serif;
}

.search-box input::placeholder {
  color: rgba(255,255,255,0.4);
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.icon-btn:hover {
  background: var(--glass-bg);
  transform: scale(1.15);
}

.profile-bubble {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFD700, #ff8c00);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.profile-bubble:hover {
  transform: scale(1.15);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

/* COMUNIDAD LAYOUT */
.comunidad-layout {
  display: flex;
  height: calc(100vh - 70px);
  position: relative;
  z-index: 1;
}

/* SIDEBAR */
.sidebar {
  width: 320px;
  background: rgba(12, 10, 8, 0.85); /* Dark brownish glass */
  border-right: 1px solid var(--glass-border);
  padding: 30px 0;
  display: flex;
  flex-direction: column;
  gap: 30px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,215,0,0.3);
  border-radius: 4px;
}

.sidebar-section {
  padding: 0 25px;
}

.toc-header {
  display: flex;
  align-items: center;
  gap: 15px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), transparent);
  padding: 18px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  transition: transform 0.3s ease;
}

.toc-header:hover {
  transform: translateY(-2px);
}

.toc-icon {
  font-size: 26px;
  filter: drop-shadow(0 0 5px rgba(255,215,0,0.5));
}

.toc-header strong {
  color: var(--gold-primary);
  display: block;
  font-size: 15px;
  letter-spacing: 0.5px;
  text-shadow: 0 0 5px rgba(255,215,0,0.3);
}

.toc-header p {
  margin: 4px 0 0 0;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-item {
  padding: 12px 25px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
  font-size: 14px;
  font-weight: 500;
}

.nav-item .icon {
  font-size: 18px;
  opacity: 0.7;
  transition: opacity 0.3s;
}

.nav-item:hover, .nav-item.active {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.1) 0%, transparent 100%);
  color: var(--gold-primary);
  border-left-color: var(--gold-primary);
}

.nav-item:hover .icon, .nav-item.active .icon {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(255,215,0,0.5));
}

.sidebar-chapters {
  padding: 0 25px;
  margin-top: 20px;
}

.sidebar-chapters h4 {
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 20px;
  text-transform: uppercase;
}

.chapter-link {
  display: block;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  padding: 10px 0;
  font-size: 14px;
  transition: all 0.3s;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.chapter-link:last-child {
  border-bottom: none;
}

.chapter-link:hover, .chapter-link.active {
  color: var(--gold-primary);
  transform: translateX(8px);
}

/* MAIN READER */
.reader-main {
  flex: 1;
  padding: 0; /* padding handled inside story-content to allow scrollbar at edge */
  background: rgba(22, 18, 14, 0.75); /* Deep rich dark brown tint */
  box-sizing: border-box;
  overflow-y: auto;
  scroll-behavior: smooth;
  backdrop-filter: blur(10px);
}

.reader-main::-webkit-scrollbar {
  width: 8px;
}
.reader-main::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.3);
  border-radius: 4px;
}
.reader-main::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.2);
}

.story-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 80px 40px;
}

.story-header {
  margin-bottom: 70px;
  text-align: center;
}

.story-meta {
  color: var(--gold-dark);
  font-size: 12px;
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 20px;
  opacity: 0.8;
}

.story-title {
  font-family: 'Playfair Display', serif;
  font-size: 4rem;
  margin: 0 0 30px 0;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
}

.text-glow {
  color: #fff;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.3), 0 0 30px rgba(255, 215, 0, 0.1);
}

.glow-text {
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.story-quote {
  font-size: 1.3rem;
  font-style: italic;
  color: rgba(255,255,255,0.85);
  border-left: 3px solid var(--gold-primary);
  padding-left: 25px;
  margin: 40px auto;
  max-width: 650px;
  line-height: 1.6;
  font-family: 'Playfair Display', serif;
}

.story-author {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  margin-top: 30px;
}

.author-name {
  color: var(--gold-primary);
  font-weight: 600;
}

.glow-hover {
  cursor: pointer;
  transition: all 0.3s;
}
.glow-hover:hover {
  color: #fff;
  text-shadow: 0 0 10px var(--gold-primary), 0 0 20px var(--gold-primary);
}

/* STORY BODY */
.story-body {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  line-height: 1.9;
  color: rgba(255,255,255,0.85);
}

.story-body p {
  margin-bottom: 35px;
  text-align: justify;
}

.story-body p::first-letter {
  /* Drop cap for paragraphs directly after a container if desired, but let's keep it simple and elegant */
}

/* MEDIA & FLOATING ELEMENTS */
.media-container {
  position: relative;
  margin: 70px 0;
  display: flex;
  justify-content: center;
}

.story-image {
  width: 100%;
  max-width: 700px;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  border: 1px solid rgba(255,215,0,0.15);
  transition: transform 0.5s ease;
}

.story-image:hover {
  transform: scale(1.02);
}

.placeholder-image {
  width: 100%;
  height: 400px;
  max-width: 700px;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  background: linear-gradient(135deg, #1a1005, #35210a, #4a2e0e, #5c3a21);
  background-size: 400% 400%;
  animation: gradientShift 10s ease infinite;
  border: 1px solid rgba(255,215,0,0.15);
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.image-caption {
  position: absolute;
  bottom: -35px;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
}

.side-note {
  position: absolute;
  right: -100px;
  top: 50%;
  transform: translateY(-50%);
  width: 260px;
  padding: 20px 25px;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255,255,255,0.75);
  box-shadow: 0 15px 35px rgba(0,0,0,0.6);
  z-index: 5;
}

.quote-icon {
  color: var(--gold-primary);
  font-size: 30px;
  position: absolute;
  top: 5px;
  left: 15px;
  opacity: 0.3;
  font-family: Georgia, serif;
}

/* GLASS PANEL REUSABLE */
.glass-panel {
  background: rgba(25, 20, 15, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
}

.quote-card {
  margin: 60px auto;
  padding: 40px;
  border-radius: 12px;
  text-align: center;
  max-width: 600px;
  box-shadow: 0 15px 30px rgba(0,0,0,0.4);
}

.quote-card p {
  font-size: 1.4rem;
  color: var(--gold-primary);
  margin-bottom: 20px;
  line-height: 1.5;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.quote-author {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}

/* FLOATING BUTTONS */
.action-float-btn, .edit-float-btn {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(20, 15, 10, 0.9);
  border: 1px solid var(--gold-primary);
  color: var(--gold-primary);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.action-float-btn {
  bottom: -25px;
  right: -25px;
}

.edit-float-btn {
  background: linear-gradient(135deg, #FFD700, #ff8c00);
  color: #000;
  border: none;
  right: -50px;
  margin-top: 15px;
  box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4);
}

.pulse-glow {
  animation: pulse 2.5s infinite;
}

.shake-hover:hover {
  transform: scale(1.15) rotate(10deg);
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.7);
}

/* PAGINATION */
.chapter-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 100px 0 60px 0;
  padding-top: 50px;
  border-top: 1px solid rgba(255,215,0,0.15);
}

.prev-chapter, .next-chapter {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  max-width: 200px;
}

.next-chapter {
  text-align: right;
}

.chap-label {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 2px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.chap-title {
  color: rgba(255,255,255,0.9);
  font-weight: 600;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  line-height: 1.4;
}

.progress-bar-container {
  flex: 1;
  height: 2px;
  background: rgba(255,255,255,0.08);
  margin: 0 40px;
  position: relative;
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #D4AF37, #FFD700);
  width: 0%;
  transition: width 0.1s ease;
  box-shadow: 0 0 10px var(--gold-primary);
}

/* DISCUSSION */
.discussion-section {
  margin-top: 60px;
  padding-bottom: 60px;
}

.section-title {
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 15px;
  margin-bottom: 40px;
}

.section-title h3 {
  font-family: 'Inter', sans-serif;
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.5rem;
  margin: 0;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 25px;
  margin-bottom: 40px;
}

.comment {
  padding: 30px;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.comment:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 15px;
}

.comment-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.comment-avatar.blue { background: linear-gradient(135deg, #1976D2, #0d47a1); }
.comment-avatar.gold { background: linear-gradient(135deg, #FFD700, #ff8c00); color: #000; }

.comment-meta strong {
  display: block;
  color: #fff;
  font-size: 15px;
  margin-bottom: 2px;
}

.comment-meta span {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

.comment-body p {
  color: rgba(255,255,255,0.85);
  line-height: 1.7;
  font-size: 15px;
  margin: 0;
}

.comment-actions {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}

.action-text {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid transparent;
  transition: all 0.3s;
  cursor: pointer;
  background: transparent;
  font-family: 'Inter', sans-serif;
}

.action-text:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  color: #fff;
}

/* ANIMATIONS FOR INTERSECTION OBSERVER */
@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 10px rgba(255, 215, 0, 0.2); }
  50% { transform: scale(1.08); box-shadow: 0 0 25px rgba(255, 215, 0, 0.6), 0 0 40px rgba(255, 215, 0, 0.2); }
  100% { transform: scale(1); box-shadow: 0 0 10px rgba(255, 215, 0, 0.2); }
}

.fade-in { opacity: 0; transition: opacity 1.2s ease-out; }
.fade-in.visible { opacity: 1; }

.slide-up { opacity: 0; transform: translateY(50px); transition: all 1.2s cubic-bezier(0.165, 0.84, 0.44, 1); }
.slide-up.visible { opacity: 1; transform: translateY(0); }

.fade-in-up { opacity: 0; transform: translateY(30px); transition: all 1.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.fade-in-up.visible { opacity: 1; transform: translateY(0); }

.drop-in { opacity: 0; transform: translateY(-30px); transition: all 1.2s cubic-bezier(0.34, 1.56, 0.64, 1); }
.drop-in.visible { opacity: 1; transform: translateY(-50%); } 

.side-note.drop-in { transform: translateY(-80%); }
.side-note.drop-in.visible { transform: translateY(-50%); }

.drop-in-scale { opacity: 0; transform: scale(0.9) translateY(30px); transition: all 1.2s cubic-bezier(0.34, 1.56, 0.64, 1); }
.drop-in-scale.visible { opacity: 1; transform: scale(1) translateY(0); }

/* HAMBURGER MENU TOGGLE */
.menu-toggle {
  display: none; /* Hidden on desktop */
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 10005; /* Must be higher than overlay modal */
}

.menu-toggle span {
  width: 100%;
  height: 2px;
  background-color: #ffd700;
  transition: all 0.3s ease;
  border-radius: 2px;
}

/* Hamburger animations to 'X' */
.menu-toggle.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Mobile drawer style */
.mobile-nav {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: -280px; /* Hidden offscreen on the right */
  width: 280px;
  height: 100vh;
  background: rgba(15, 12, 10, 0.98);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 215, 0, 0.25);
  padding: 80px 24px 40px; /* Padding top for layout spacing */
  gap: 20px;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.8);
  z-index: 10000; /* Must be higher than other elements */
}

.mobile-nav.active {
  right: 0;
}

.mobile-nav a {
  font-size: 16px;
  font-weight: 500;
  padding: 12px 16px;
  border-radius: 8px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.05);
  display: flex;
  align-items: center;
  color: #ccc;
  text-decoration: none;
  transition: all 0.3s ease;
}

.mobile-nav a:hover, .mobile-nav a.active {
  background: rgba(255, 215, 0, 0.08);
  color: #f59f0a;
  border-bottom-color: rgba(255, 215, 0, 0.2);
  padding-left: 24px;
}

/* RESPONSIVE DESIGN */
@media (max-width: 1100px) {
  .side-note {
    position: relative;
    right: 0;
    top: 0;
    transform: none !important;
    width: 100%;
    margin-top: 25px;
    box-sizing: border-box;
  }
}

/* SIDEBAR TOGGLE BUTTON */
.sidebar-toggle-btn {
  display: none; /* Hidden on desktop */
  background: transparent;
  border: 1px solid rgba(255, 215, 0, 0.3);
  color: #ffd700;
  font-size: 20px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  z-index: 100;
  transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
  background: rgba(255, 215, 0, 0.1);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

@media (max-width: 850px) {
  .sidebar-toggle-btn {
    display: inline-block; /* Show on mobile/tablet */
  }

  .comunidad-layout {
    position: relative;
    height: calc(100vh - 70px);
    overflow: hidden;
  }
  
  .sidebar {
    position: fixed;
    top: 70px;
    left: -320px; /* Start offscreen left */
    width: 320px;
    height: calc(100vh - 70px);
    border-right: 1px solid var(--glass-border);
    z-index: 998;
    transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
    display: flex; /* Ensure it stays visible as flexbox inside drawer */
  }
  
  .sidebar.active {
    left: 0;
  }
  
  .reader-main {
    flex: 1;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 40px 5%;
  }
  
  .story-title {
    font-size: clamp(2rem, 8vw, 3rem);
  }
  
  .story-content {
    padding: 40px 20px;
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }
  .mobile-nav {
    display: flex;
  }
}

@media (max-width: 600px) {
  .topbar-logo span {
    display: none; /* Hide logo text to prevent overflow */
  }
  .topbar-tabs {
    display: none;
  }
  .search-box {
    display: none;
  }
}

/* =========================================
   MODALES Y AJUSTES DE LECTURA
   ========================================= */

.overlay-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s ease;
}

.overlay-modal.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  width: 90%;
  max-width: 450px;
  background: rgba(20, 15, 10, 0.95);
  padding: 30px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

.overlay-modal.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 15px;
}

.modal-header h3 {
  margin: 0;
  color: var(--gold-primary);
  font-size: 1.4rem;
}

.close-modal {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.close-modal:hover { opacity: 1; }

.setting-group {
  margin-bottom: 25px;
}

.setting-group label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 10px;
}

.font-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(255,255,255,0.05);
  padding: 10px 20px;
  border-radius: 12px;
  justify-content: center;
}

.font-controls button {
  background: var(--gold-primary);
  border: none;
  color: #000;
  width: 35px;
  height: 35px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s;
}

.font-controls button:active { transform: scale(0.9); }

.font-controls span {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--gold-primary);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.theme-btn {
  padding: 12px;
  text-align: center;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.3s;
}

.theme-dark { background: #111; color: #eee; }
.theme-sepia { background: #f4ecd8 !important; color: #5b4636 !important; border-color: #d3c4a8; }
.theme-light { background: #ffffff !important; color: #111 !important; border-color: #ccc; }

.theme-btn.active {
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

/* TEMAS APLICADOS AL LECTOR */
.reader-main.theme-sepia {
  background: #f4ecd8;
}
.reader-main.theme-sepia .story-body, 
.reader-main.theme-sepia .story-title,
.reader-main.theme-sepia .story-quote,
.reader-main.theme-sepia .story-author,
.reader-main.theme-sepia .author-name {
  color: #3e2b1f;
}

.reader-main.theme-light {
  background: #ffffff;
}
.reader-main.theme-light .story-body,
.reader-main.theme-light .story-title,
.reader-main.theme-light .story-author,
.reader-main.theme-light .author-name,
.reader-main.theme-light .story-quote {
  color: #1a1a1a;
}

/* ANOTACIONES */
.side-drawer {
    width: 400px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.notes-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

.notes-container::-webkit-scrollbar { width: 4px; }
.notes-container::-webkit-scrollbar-thumb { background: var(--gold-primary); }

.note-item {
    background: rgba(255,255,255,0.05);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 12px;
    border-left: 3px solid var(--gold-primary);
}

.note-item p {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255,255,255,0.9);
}

.note-item span {
    font-size: 11px;
    color: #ff4444;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 700;
}

.new-note-box {
    margin-top: auto;
    border-top: 1px solid var(--glass-border);
    padding-top: 20px;
}

.new-note-box textarea {
    width: 100%;
    height: 80px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    padding: 12px;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    margin-bottom: 10px;
    outline: none;
}

.new-note-box textarea:focus {
    border-color: var(--gold-primary);
}

.btn-save-note {
    width: 100%;
    background: var(--gold-primary);
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    color: #000;
    transition: all 0.3s;
}

.btn-save-note:hover {
    background: #FF8C00;
    box-shadow: 0 0 15px rgba(255, 140, 0, 0.5);
}

#fontFamily {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 10px;
    border-radius: 10px;
    outline: none;
}

#fontFamily option {
    background: #222;
}

/* =========================================
   INVITACIONES
   ========================================= */

.invite-desc {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 30px;
    text-align: center;
}

.invite-box {
    margin-bottom: 25px;
}

.invite-box label {
    display: block;
    font-size: 11px;
    color: var(--gold-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.link-field {
    display: flex;
    gap: 10px;
}

.link-field input {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: #fff;
    padding: 12px 15px;
    font-size: 13px;
    outline: none;
}

.link-field button {
    background: var(--gold-primary);
    border: none;
    padding: 0 20px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    color: #000;
    transition: all 0.3s;
}

.share-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid var(--glass-border);
}

.share-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    color: white;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.3s, filter 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-icon:hover {
    transform: translateY(-5px);
    filter: brightness(1.2);
}

.share-icon.wa { background: #25D366; }
.share-icon.fb { background: #1877F2; }
.share-icon.tw { background: #000000; border: 1px solid #333; }
