/* ===============================
   RESET Y BOX MODEL
================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===============================
   VARIABLES CSS
================================ */
:root {
  /* === Colores Principales === */
  --primary: #2b3a8f;
  --primary-light: #5a67d8;
  --primary-dark: #1a2456;
  --secondary: #6d5bd0;
  --secondary-light: #9b8ee3;
  --secondary-dark: #4a3d8f;
  
  /* === Colores de Estado === */
  --success: #28a745;
  --success-light: #4caf50;
  --error: #dc3545;
  --error-light: #f44336;
  --warning: #ffc107;
  --warning-light: #ffeb3b;
  --info: #17a2b8;
  --info-light: #29b6d1;
  
  /* === Fondos === */
  --bg-light: #f4f6fb;
  --bg-lighter: #eef1f7;
  --bg-white: #ffffff;
  --bg-dark: #212529;
  
  /* === Textos === */
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-light: #adb5bd;
  --text-white: #ffffff;
  
  /* === Bordes y Sombras === */
  --border-color: #dee2e6;
  --border-light: #e9ecef;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);
  --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.20);
  
  /* === Transiciones === */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  
  /* === Espaciados === */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* === Border Radius === */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  
  /* === Z-Index === */
  --z-base: 1;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}


/* ===============================
   ANIMACIONES GLOBALES
================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* ===============================
   BODY Y ESTRUCTURA BASE
================================ */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-lighter) 100%);
  font-variant-emoji: emoji;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* Marca de agua Azogues */
body::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  background-image: url('../img/Azogues.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.2;
  z-index: 0;
  pointer-events: none;
}

/* ===============================
   TIPOGRAFÍA
================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
  color: var(--primary-dark);
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
  text-align: center;
  color: #1f3a5f;
}

h3 {
  font-size: 1.75rem;
}

h4 {
  font-size: 1.5rem;
}

h5 {
  font-size: 1.25rem;
}

h6 {
  font-size: 1rem;
}

p {
  margin-bottom: var(--spacing-md);
  line-height: 1.6;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-light);
}

/* ===============================
   HEADER Y FOOTER
================================ */
header, footer {
  background: linear-gradient(135deg, #2b3a8f 0%, #5a67d8 50%, #6d5bd0 100%);
  color: var(--text-white);
  padding: var(--spacing-2xl) var(--spacing-md);
  position: relative;
  z-index: 10;
  box-shadow: 0 8px 32px rgba(43, 58, 143, 0.3);
  overflow: visible;
}

header {
  text-align: center;
  display: block;
  position: relative;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 400px;
  height: 400px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  animation: float 6s ease-in-out infinite;
  pointer-events: none;
}

header::after {
  content: '';
  position: absolute;
  bottom: -50px;
  left: -100px;
  width: 300px;
  height: 300px;
  background: rgba(109, 91, 208, 0.1);
  border-radius: 50%;
  animation: float 8s ease-in-out infinite reverse;
  pointer-events: none;
}

/* Logo Casa de la Cultura en Header */
header .casa-cultura-logo {
  position: absolute;
  right: var(--spacing-2xl);
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  flex-shrink: 0;
}

header .casa-cultura-logo img {
  height: 100px;
  width: auto;
  object-fit: contain;
  transition: all var(--transition-base);
  filter: brightness(1.2) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

header .casa-cultura-logo:hover img {
  transform: scale(1.15);
  filter: brightness(1.4) drop-shadow(0 4px 12px rgba(255, 255, 255, 0.4));
}

@media (max-width: 768px) {
  header {
    padding-top: var(--spacing-xl);
    padding-bottom: var(--spacing-xl);
  }

  header .casa-cultura-logo {
    position: static;
    transform: none;
    margin: 0 auto var(--spacing-md);
    display: flex;
    justify-content: center;
  }

  header .casa-cultura-logo img {
    height: 72px;
  }
}

@media (max-width: 480px) {
  header .casa-cultura-logo img {
    height: 60px;
  }
}

footer::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  pointer-events: none;
  animation: shimmer 3s ease-in-out 1;
}

header h1, header h2, header h3, header h4, header h5, header h6, 
header p, header a, header .page-title, header .page-subtitle,
footer h1, footer h2, footer h3, footer h4, footer h5, footer h6, 
footer p, footer a {
  color: var(--text-white);
  position: relative;
  z-index: 1;
}

/* Animaciones para títulos en header */
header .page-title {
  animation: fadeInDown 0.8s ease;
}

header .page-subtitle {
  animation: fadeInUp 0.8s ease 0.2s both;
}

header a:hover, footer a:hover {
  color: #e6e9ff;
  text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

/* ===============================
   NAVEGACIÓN
================================ */
nav {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  padding: var(--spacing-sm) var(--spacing-md);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  animation: fadeInDown 0.4s ease;
}

.nav-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
}

/* ===============================
   BOTONES DE AUTENTICACIÓN
================================ */
.auth-button {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: auto;
  gap: var(--spacing-sm);
}

.login-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--text-white);
  border: none;
  padding: 0.7em 1.4em;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 0.95em;
  font-weight: 600;
  transition: all var(--transition-base);
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.login-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.login-btn:hover::before {
  width: 300px;
  height: 300px;
}

.login-btn:hover {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  transform: translateY(-3px) scale(1.05);
  box-shadow: var(--shadow-lg);
}

.login-btn:active {
  transform: translateY(-1px) scale(1.02);
  box-shadow: var(--shadow-sm);
}

/* ===============================
   MENÚ DE USUARIO
================================ */
.user-menu {
  position: relative;
  display: flex;
  align-items: center;
}

.user-button {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  position: relative;
}

.user-button:hover {
  background-color: rgba(109, 91, 208, 0.2);
  transform: scale(1.05);
}

.user-button:active {
  transform: scale(0.98);
}

.user-photo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--bg-white);
  margin-right: var(--spacing-xs);
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: border-color var(--transition-base);
}

.user-button:hover .user-photo {
  border-color: rgba(255, 255, 255, 0.6);
}

.user-button i {
  color: var(--text-white);
  font-size: 1.1em;
  transition: transform var(--transition-base);
}

.user-button:hover i {
  transform: rotate(180deg);
}

/* Dropdown del usuario */
.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  min-width: 200px;
  z-index: var(--z-dropdown);
  animation: fadeInDown 0.3s ease;
  overflow: hidden;
}

.user-dropdown::before {
  content: '';
  position: absolute;
  top: -8px;
  right: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--bg-white);
}

.user-dropdown a {
  display: block;
  padding: var(--spacing-md) var(--spacing-lg);
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition-fast);
  font-weight: 500;
  border-left: 3px solid transparent;
  font-size: 0.95em;
}

.user-dropdown a:not(:last-child) {
  border-bottom: 1px solid var(--border-light);
}

.user-dropdown a:hover {
  background: linear-gradient(90deg, rgba(43, 58, 143, 0.08) 0%, transparent 100%);
  border-left-color: var(--primary);
  padding-left: calc(var(--spacing-lg) + 4px);
  color: var(--primary);
}

.user-dropdown a i {
  margin-right: var(--spacing-sm);
  width: 20px;
  text-align: center;
  color: var(--primary-light);
}

.user-menu:hover .user-dropdown {
  display: block;
}

/* ===============================
   SIDEBAR LATERAL
================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  flex-direction: column;
  padding: var(--spacing-xl) var(--spacing-md);
  z-index: var(--z-modal);
  transition: left var(--transition-base);
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.sidebar.open {
  left: 0;
  animation: slideInLeft 0.3s ease;
}

.sidebar a {
  color: var(--text-white);
  margin: var(--spacing-sm) 0;
  text-decoration: none;
  padding: var(--spacing-md);
  transition: all var(--transition-base);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.sidebar a:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(8px);
  color: #e6e9ff;
}

.sidebar a.active {
  background: rgba(109, 91, 208, 0.3);
  color: #e6e9ff;
  font-weight: bold;
  border-left: 4px solid var(--secondary);
}

.close-sidebar {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  font-size: 1.5em;
  color: var(--text-white);
  cursor: pointer;
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.close-sidebar:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  z-index: calc(var(--z-modal) - 10);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
}

/* ===============================
   NAVEGACIÓN - LINKS
================================ */
.nav-links {
  display: flex;
  gap: var(--spacing-md);
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

.nav-links a {
  color: #e6e9ff;
  text-decoration: none;
  font-weight: 500;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: #ffcc00;
  transition: width 0.3s, left 0.3s;
}

.nav-links a:hover {
  color: #ffcc00;
  background: rgba(255, 204, 0, 0.1);
}

.nav-links a:hover::after {
  width: 100%;
  left: 0;
}

.nav-links a.active {
  color: #ffcc00;
  font-weight: bold;
}

.nav-links a.active::after {
  width: 100%;
  left: 0;
}

.menu-toggle {
  font-size: 1.5em;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-white);
  cursor: pointer;
  margin-right: var(--spacing-md);
  display: none;
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* ===============================
   CONTENIDO PRINCIPAL
================================ */
.content {
  padding: var(--spacing-xl);
  animation: fadeInUp 0.6s ease;
  flex: 1 0 auto;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 5;
}

.section {
  margin: 0 auto var(--spacing-xl) auto;
  background: var(--bg-white);
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  max-width: 100%;
  animation: fadeInUp 0.5s ease;
  transition: all var(--transition-base);
  border: 1px solid var(--border-light);
}

.section:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary-light);
}

/* ===============================
   FOOTER
================================ */
footer {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: var(--text-white);
  padding: var(--spacing-xl) var(--spacing-md);
  text-align: center;
  flex-shrink: 0;
  margin-top: auto;
  position: relative;
  overflow: hidden;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--secondary) 25%, 
    var(--primary-light) 50%, 
    var(--secondary) 75%, 
    transparent 100%);
}

.footer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-lg);
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ===============================
   USER BOX
================================ */
.user-box {
    display: flex;
    align-items: center;
    background-color: #0059b3;
    border-radius: 6px;
    padding: 0.2em 0.5em;
    gap: 0.5em;
    cursor: pointer;
}
.user-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    color: #004080;
}
.user-name {
    color: white;
    font-size: 0.9em;
}
.user-arrow {
    color: white;
    font-size: 0.9em;
}
.login-link {
    color: white;
    background: #004080;
    padding: 0.4em 0.8em;
    border-radius: 6px;
    border: 2px solid #0073e6;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.4em;
}
.login-link:hover {
    background: #0059b3;
}
.content {
    padding: 2em;
    animation: fadeIn 0.6s ease;
    flex: 1 0 auto;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}
.section {
    margin: 0 auto 1em auto;
    background: white;
    padding: 1em;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    max-width: 100%;
    animation: fadeInUp 0.5s ease;
}
/* Indicador de menú activo */
.nav-links a.active {
    color: #ffcc00;
    font-weight: bold;
    border-bottom: 3px solid #ffcc00;
    padding-bottom: 0.3em;
}
.counter {
    font-weight: bold;
    text-align: center;
    margin-top: 2em;
}

footer {
  background-color: #003366;
  color: white;
  padding: 2em 1em;
  text-align: center;
  flex-shrink: 0;
  margin-top: auto;
}

.footer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2em;
}

.footer-branding h3 {
  margin: 0;
  font-size: 1.6em;
}

.footer-branding p {
  margin: 0.3em 0 0;
  font-size: 0.95em;
}

.footer-thanks p {
  margin: 0;
  font-size: 0.95em;
  font-style: italic;
}

.footer-contact p {
  margin: 0.2em 0;
  font-size: 0.9em;
}

.footer-social {
  display: flex;
  gap: 1em;
  margin-top: 0.5em;
}

.footer-social a {
  background-color: #004080;
  color: #fff;
  font-size: 1.2em;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.3s, transform 0.3s;
  box-shadow: 0 0 8px rgba(0,0,0,0.3);
}

.footer-social a:hover {
  background-color: #ffcc00;
  color: #003366;
}

.footer-copy p {
  margin: 0;
  font-size: 0.85em;
  color: #ddd;
}

/* Animación de entrada suave para los íconos sociales */
.footer-social a {
  animation: popIn 0.4s ease forwards;
  opacity: 0;
}

.footer-social a:nth-child(1) { animation-delay: 0.1s; }
.footer-social a:nth-child(2) { animation-delay: 0.2s; }
.footer-social a:nth-child(3) { animation-delay: 0.3s; }

.profile-pic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background-color: #fff;
  min-width: 160px;
  box-shadow: 0 0 5px rgba(0,0,0,0.2);
  z-index: 1;
}

.dropdown-content a {
  padding: 8px 12px;
  display: block;
  text-decoration: none;
  color: #000;
}

.dropdown-content a:hover {
  background-color: #eee;
}

.dropdown-content.show {
  display: block;
}
.user-info {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.user-photo {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin-right: 8px;
}

.hidden {
  display: none;
}


@keyframes popIn {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 768px) {
    .nav-links {
    display: none;
    }
    .menu-toggle {
    display: block;
    }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===============================
   BOTÓN FLOTANTE (TOGGLE)
================================ */
#chatbot-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #004080 0%, #0066cc 100%);
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0, 64, 128, 0.3);
  cursor: pointer;
  z-index: var(--z-popover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  transition: all 0.3s ease;
  animation: fadeInScale 0.4s ease;
}

#chatbot-toggle:hover {
  background: linear-gradient(135deg, #0066cc 0%, #0080ff 100%);
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 102, 204, 0.4);
}

#chatbot-toggle.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.8);
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===============================
   CONTENEDOR CHATBOT
================================ */
#chatbot-widget {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 360px;
  max-height: 100vh;
  background: #ffffff;
  border-radius: 16px 0 0 16px;
  box-shadow: -8px 0 28px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: "Segoe UI", system-ui, sans-serif;
  z-index: var(--z-popover);
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#chatbot-widget.activo {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (max-width: 768px) {
  #chatbot-widget {
    width: 100%;
    border-radius: 0;
  }
}

/* ===============================
   HEADER
================================ */
.chatbot-header {
  background: linear-gradient(135deg, #004080 0%, #0066cc 100%);
  color: #ffffff;
  padding: 16px 14px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 64, 128, 0.2);
}

#chatbot-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

#chatbot-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* ===============================
   MENSAJES
================================ */
.chatbot-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: #f5f7fa;
}

/* Scroll moderno */
.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}
.chatbot-messages::-webkit-scrollbar-thumb {
  background: #c2c7d0;
  border-radius: 4px;
}

/* ===============================
   MENSAJE BASE
================================ */
.chat-msg {
  max-width: 80%;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  animation: fadeIn 0.2s ease;
}

/* Usuario */
.chat-msg.usuario {
  margin-left: auto;
  background: #004080;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* Bot */
.chat-msg.bot {
  margin-right: auto;
  background: #ffffff;
  color: #333333;
  border: 1px solid #e0e0e0;
  border-bottom-left-radius: 4px;
}

/* Aviso login */
.chat-msg.aviso-login-chat {
  background: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
}

/* ===============================
   INPUT
================================ */
.chatbot-input {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid #dddddd;
  background: #ffffff;
}

#cb-input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cccccc;
  font-size: 14px;
  outline: none;
}

#cb-input:focus {
  border-color: #004080;
}

#cb-send {
  background: linear-gradient(135deg, #004080 0%, #0066cc 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 64, 128, 0.3);
}

#cb-send:hover {
  background: linear-gradient(135deg, #0066cc 0%, #0080ff 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 102, 204, 0.4);
}

#cb-send:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 64, 128, 0.3);
}

/* ===============================
   BOTÓN LOGIN CHAT
================================ */
.btn-login-chat {
  margin-top: 10px;
  background: linear-gradient(135deg, #004080 0%, #0066cc 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 64, 128, 0.3);
}

.btn-login-chat:hover {
  background: linear-gradient(135deg, #0066cc 0%, #0080ff 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 102, 204, 0.4);
}

.btn-login-chat:active {
  transform: translateY(0);     
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
}

/* ===============================
   ANIMACIONES
================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================================== */
/* MENÚ DE USUARIO                       */
/* ===================================== */

.user-menu-container {
  position: relative;
}

.user-menu-btn {
  background-color: #0073e6;
  color: white;
  border: none;
  padding: 0.6em 1.2em;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 500;
  transition: all 0.3s ease;
}

.user-menu-btn:hover {
  background-color: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.user-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  margin-top: 8px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

.user-menu-dropdown.show {
  opacity: 1;
  visibility: visible;
}

.menu-item {
  display: block;
  padding: 0.8em 1.2em;
  color: #333;
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.menu-item:hover {
  background-color: #f5f5f5;
  border-left-color: #0073e6;
  padding-left: 1.4em;
}

.menu-item.logout-item {
  color: #d32f2f;
}

.menu-item.logout-item:hover {
  background-color: #ffebee;
}

.menu-divider {
  margin: 0.5em 0;
  border: none;
  border-top: 1px solid #e0e0e0;
}

/* ===================================== */
/* MODAL DE CAMBIO DE CONTRASEÑA         */
/* ===================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  max-width: 450px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideIn 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5em;
  border-bottom: 1px solid #e0e0e0;
  background: linear-gradient(135deg, #003366 0%, #0073e6 100%);
  color: white;
}

.modal-header h2 {
  margin: 0;
  color: white;
  text-align: left;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: white;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.modal-close:hover {
  opacity: 1;
}

#changePasswordForm {
  padding: 2em 1.5em;
}

.form-group {
  margin-bottom: 1.5em;
}

.form-group label {
  display: block;
  margin-bottom: 0.5em;
  color: #333;
  font-weight: 500;
  font-size: 0.95em;
}

.form-group input {
  width: 100%;
  padding: 0.8em;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 1em;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #0073e6;
  box-shadow: 0 0 0 3px rgba(0, 115, 230, 0.1);
}

.hint {
  display: block;
  font-size: 0.85em;
  color: #999;
  margin-top: 0.3em;
  transition: color 0.2s;
}

.hint.valid {
  color: #4caf50;
  font-weight: 500;
}

.modal-actions {
  display: flex;
  gap: 1em;
  margin-top: 2em;
  justify-content: flex-end;
}

.btn-cancel,
.btn-primary {
  padding: 0.8em 1.6em;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  font-size: 0.95em;
}

.btn-cancel {
  background-color: #e0e0e0;
  color: #333;
}

.btn-cancel:hover {
  background-color: #d0d0d0;
}

.btn-primary {
  background-color: #0073e6;
  color: white;
}

.btn-primary:hover {
  background-color: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 115, 230, 0.3);
}

.btn-primary:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  transform: none;
}

.message-container {
  margin-top: 1.5em;
}

.message {
  padding: 0.8em 1em;
  border-radius: 6px;
  font-weight: 500;
  text-align: center;
}

.message.success {
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.message.error {
  background-color: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

/* Login button para usuarios no autenticados */
.login-btn {
  background-color: #0073e6;
  color: white;
  border: none;
  padding: 0.6em 1.2em;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 500;
  transition: all 0.3s ease;
}

.login-btn:hover {
  background-color: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* ========== ESTILOS PÁGINA DE INICIO ========== */

/* Grid para galerías de obras y noticias */
.galeria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  padding: 1rem 0;
}

/* TARJETA DE NOTICIA */
.noticia-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.noticia-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.noticia-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.noticia-imagen {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.noticia-texto {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.noticia-texto h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  color: #003366;
  line-height: 1.3;
}

.noticia-texto p {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  color: #666;
  flex-grow: 1;
}

.noticia-texto small {
  color: #999;
  font-size: 0.85rem;
}

/* TARJETA DE OBRA */

.obra-card:hover img {
  transform: scale(1.05);
}

.obra-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 51, 102, 0.95), rgba(0, 51, 102, 0));
  color: white;
  padding: 1rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 40%;
}

.obra-card:hover .obra-overlay {
  transform: translateY(0);
}

.obra-overlay h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  line-height: 1.3;
}

.obra-overlay p {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}

/* TARJETA DE GALERÍA */
.galeria-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #f0f0f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  aspect-ratio: 1;
  cursor: pointer;
  transition: all 0.3s ease;
}

.galeria-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.galeria-item:hover img {
  transform: scale(1.1);
}

.galeria-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 51, 102, 0.95), rgba(0, 51, 102, 0));
  color: white;
  padding: 1rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  min-height: 30%;
}

.galeria-item:hover .galeria-overlay {
  transform: translateY(0);
}

.galeria-overlay h5 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.2;
}
/* Dropdown */
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(0,0,0,0.12);
  padding: 6px;
  display: none; /* controlado por JS */
  z-index: 1000;
}

/* Mostrar menú */
.user-menu-dropdown.show {
  display: block;
}

/* Botones internos */
.user-menu-dropdown button {
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 500;
  color: #111827;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.12s ease;
}

.user-menu-dropdown button:hover {
  background: #f3f4f6;
}

/* Separador */
.user-menu-dropdown hr {
  border: none;
  height: 1px;
  background: #e5e7eb;
  margin: 6px 0;
}

/* Logout destacado */
.user-menu-dropdown .logout {
  color: #dc2626;
  font-weight: 600;
}

.user-menu-dropdown .logout:hover {
  background: #fee2e2;
}

/* Responsive */
@media (max-width: 768px) {
  .galeria-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
  }

  .noticia-card {
    grid-column: span 1;
  }

  .noticia-imagen {
    height: 120px;
  }
}

@media (max-width: 480px) {
  .galeria-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .carousel-item { min-width: 85%; }
  .noticia-card { grid-template-columns: 1fr; }
  .noticia-imagen { width: 100%; height: 160px; }
  .evento-card { grid-template-columns: 1fr; }
  .evento-card img { width: 100%; height: 160px; }
}

/* ===============================
   ESTILOS MEJORADOS CHATBOT - TARJETAS
================================ */

#chatbot-widget .chat-data-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
  max-height: 350px;
  overflow-y: auto;
  padding-right: 0.25rem;
}
#chatbot-widget .chat-data-container::-webkit-scrollbar { width: 4px; }
#chatbot-widget .chat-data-container::-webkit-scrollbar-thumb { background: #004080; border-radius: 4px; }

#chatbot-widget .chat-item-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 10px;
  padding: 0.75rem;
  border-left: 4px solid #004080;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  animation: slideInCard 0.3s ease-out;
}
#chatbot-widget .chat-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border-left-color: #0066cc;
}
#chatbot-widget .chat-obra-card { cursor: pointer; border-left-color: #0073e6; }
#chatbot-widget .chat-obra-card:hover {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border-left-color: #0066cc;
}
#chatbot-widget .obra-card-content { display: flex; gap: 0.75rem; align-items: flex-start; }
#chatbot-widget .obra-thumb { width: 60px; height: 85px; object-fit: cover; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); flex-shrink: 0; }
#chatbot-widget .obra-info { flex: 1; font-size: 0.85rem; }
#chatbot-widget .obra-info strong { color: #1a1a1a; font-size: 0.9rem; display: block; margin-bottom: 0.25rem; }
#chatbot-widget .obra-tipo { display: inline-block; background: #004080; color: white; padding: 0.15rem 0.5rem; border-radius: 12px; font-size: 0.7rem; font-weight: 600; margin: 0.25rem 0; }
#chatbot-widget .obra-rating { color: #ff9800; font-size: 0.8rem; margin: 0.25rem 0; }
#chatbot-widget .obra-precio { color: #2e7d32; font-weight: 700; font-size: 0.9rem; margin: 0.25rem 0; }
#chatbot-widget .obra-desc { color: #555; font-size: 0.75rem; line-height: 1.3; display: block; margin-top: 0.25rem; }
#chatbot-widget .obra-ver-mas { color: #0073e6; font-weight: 600; font-size: 0.75rem; margin-top: 0.5rem; display: inline-flex; align-items: center; gap: 0.25rem; }
#chatbot-widget .chat-imagen-card { cursor: pointer; border-left-color: #9c27b0; }
#chatbot-widget .chat-imagen-card:hover { background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%); border-left-color: #7b1fa2; }
#chatbot-widget .imagen-card-content { display: flex; flex-direction: column; gap: 0.5rem; }
#chatbot-widget .galeria-thumb { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
#chatbot-widget .imagen-info { display: flex; flex-direction: column; gap: 0.25rem; }
#chatbot-widget .imagen-desc { color: #333; font-size: 0.8rem; font-weight: 500; }
#chatbot-widget .imagen-ver-mas { color: #9c27b0; font-weight: 600; font-size: 0.75rem; display: inline-flex; align-items: center; gap: 0.25rem; }

@keyframes slideInCard {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===============================
   LOADING - PÁGINA COMPLETA
================================ */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 246, 251, 0.98) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 1;
  transition: opacity var(--transition-base);
  backdrop-filter: blur(10px);
}

.page-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ===============================
   SPINNER ANIMADO
================================ */
.spinner {
  width: 60px;
  height: 60px;
  border: 5px solid var(--border-light);
  border-top-color: var(--primary);
  border-right-color: var(--secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  position: relative;
}

.spinner::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  border: 3px solid transparent;
  border-top-color: var(--primary-light);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: spin 1.2s linear infinite reverse;
}

.loader-text {
  margin-top: var(--spacing-lg);
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 600;
  animation: pulse 1.5s ease-in-out infinite;
}

/* ===============================
   LOADING - CONTENEDORES
================================ */
.content-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-2xl);
  min-height: 250px;
  background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-lighter) 100%);
  border-radius: var(--radius-lg);
  animation: fadeIn 0.3s ease;
}

.content-loader .spinner {
  width: 45px;
  height: 45px;
  border-width: 4px;
}

.content-loader .loader-text {
  font-size: 0.95rem;
  margin-top: var(--spacing-md);
}

/* ===============================
   SKELETON LOADER (opcional)
================================ */
.skeleton {
  background: linear-gradient(90deg, 
    var(--bg-lighter) 0%, 
    var(--bg-light) 50%, 
    var(--bg-lighter) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 1rem;
  margin-bottom: var(--spacing-sm);
}

.skeleton-title {
  height: 2rem;
  width: 60%;
  margin-bottom: var(--spacing-md);
}

.skeleton-image {
  height: 200px;
  width: 100%;
}
