/* ===== VARIABLES Y TEMAS ===== */
:root{
  --green-700:#166534;
  --green-600:#16a34a;
  --green-500:#22c55e;
  --green-400:#4ade80;
  --green-100:#dcfce7;
  
  /* Tema Claro */
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-panel: #ffffff;
  --bg-chat: #f5f7fa;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow: 0 2px 8px rgba(0,0,0,.04);
  --shadow-hover: 0 4px 12px rgba(0,0,0,.08);
  --shadow-strong: 0 6px 20px rgba(0,0,0,.1);
}

[data-theme="dark"]{
  --green-700:#10b981;
  --green-600:#059669;
  --green-500:#34d399;
  --green-400:#6ee7b7;
  --green-100:#064e3b;
  
  /* Tema Oscuro Moderno */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-panel: #1e293b;
  --bg-chat: #0f172a;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --border-color: #334155;
  --shadow: 0 4px 16px rgba(0,0,0,.4);
  --shadow-hover: 0 8px 24px rgba(0,0,0,.6);
  --shadow-strong: 0 12px 32px rgba(0,0,0,.7);
}

/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ===== RESET Y BASE ===== */
*{box-sizing:border-box; margin: 0; padding: 0;}
html,body{height:100%; transition: background-color 0.3s ease, color 0.3s ease;}
html{scroll-behavior: smooth;}

body{
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: linear-gradient(180deg, var(--bg-secondary), var(--bg-primary));
  background-attachment: fixed;
  color: var(--text-primary);
  font-size: 13.3px;
  line-height: 1.6;
  zoom: 0.92;
  overflow: hidden;
  height: 100vh;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--green-500);
  border-radius: 10px;
  border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--green-600);
}

/* ===== HEADER ESTILO UAM COMPACTO ===== */
.app-header{
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #f8fafb 0%, #e8f5e9 100%);
  border-bottom: 2px solid rgba(22, 163, 74, 0.15);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

html[data-theme='dark'] .app-header {
  background: linear-gradient(135deg, #064e3b 0%, #047857 100%);
  border-bottom: none;
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.35);
}

.header-container {
  max-width: 1800px;
  margin: 0 auto;
  padding: 0px 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0;
}

.logo-uam {
  width: 90px;
  height: 90px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
  transition: all 0.3s ease;
}

html[data-theme='dark'] .logo-uam {
  filter: brightness(0) invert(1) drop-shadow(0 2px 8px rgba(255,255,255,0.5));
}

.logo-uam:hover {
  transform: scale(1.08);
}

.university-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.university-name {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.7px;
  line-height: 1.2;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

html[data-theme='dark'] .university-name {
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.unit-name {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: #16a34a;
  letter-spacing: 0.3px;
}

html[data-theme='dark'] .unit-name {
  color: #d1fae5;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Header Right - Theme Toggle Only */
.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Theme Toggle Minimalista */
.theme-toggle{
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(22, 163, 74, 0.08);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.2rem;
}

.theme-toggle:hover {
  background: rgba(22, 163, 74, 0.15);
  transform: scale(1.05);
}

html[data-theme='dark'] .theme-toggle {
  background: rgba(255, 255, 255, 0.15);
}

html[data-theme='dark'] .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* Deprecated header nav - mantener por compatibilidad */
.header-top {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-bottom: 3px solid #16a34a;
}

html[data-theme='dark'] .header-top {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-bottom: 3px solid #22c55e;
}

.header-nav {
  background: #16a34a;
  padding: 8px 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

html[data-theme='dark'] .header-nav {
  background: #15803d;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.assistant-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
}

.assistant-title .icon {
  font-size: 1.3rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

.assistant-title .text {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.assistant-title .badge {
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme Toggle */
.theme-toggle{
  --track-w: 56px;
  --track-h: 28px;
  --knob-d: 22px;
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: transparent;
  border: 2px solid var(--border-color);
  border-radius: 24px;
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: var(--bg-secondary);
  border-color: var(--green-600);
}

html[data-theme='dark'] .theme-toggle {
  border-color: rgba(255, 255, 255, 0.3);
}

html[data-theme='dark'] .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.theme-toggle .track{
  position: relative;
  width: var(--track-w);
  height: var(--track-h);
  background: var(--bg-secondary);
  border-radius: calc(var(--track-h) / 2);
  display: flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

html[data-theme='dark'] .theme-toggle .track{
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.theme-toggle .knob{
  width: var(--knob-d);
  height: var(--knob-d);
  background: var(--text-primary);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transform: translateX(0);
  transition: transform 0.3s cubic-bezier(.2,.9,.2,1), background 0.3s;
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-size: 0.85rem;
}

html[data-theme='dark'] .theme-toggle .knob{
  transform: translateX(calc(var(--track-w) - var(--knob-d) - 6px));
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

.theme-toggle .label{
  font-weight: 600; 
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: color 0.3s ease;
}

html[data-theme='dark'] .theme-toggle .label{
  color: #ffffff;
}

/* Deprecated - mantener por compatibilidad */
.assistant-badge, .badge-icon, .badge-text, .badge-beta {
  display: none;
}

/* ===== LAYOUT PRINCIPAL - 3 COLUMNAS CON SCROLL ===== */
.layout{
  max-width: 1800px;
  margin: 15px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 40% 1fr 1fr;
  gap: 20px;
  animation: fadeIn 0.6s ease;
  height: calc(100vh - 125px);
  overflow: hidden;
}

/* Columna Izquierda: Chat (40%) */
.left-column{
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Columna Centro: Anuncios + Recursos + FAQ */
.center-column{
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  overflow-y: scroll !important;
  overflow-x: hidden;
  padding-right: 4px;
  height: 100%;
  padding-bottom: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--green-500) var(--bg-secondary);
}

/* Columna Derecha: Enlaces + Stats + Contacto */
.right-column{
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  overflow-y: scroll !important;
  overflow-x: hidden;
  padding-right: 4px;
  height: 100%;
  padding-bottom: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--green-500) var(--bg-secondary);
}

/* Forzar scrollbar visible en Chrome/Edge/Safari */
.center-column::-webkit-scrollbar,
.right-column::-webkit-scrollbar {
  width: 10px;
  display: block !important;
}

.center-column::-webkit-scrollbar-track,
.right-column::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 10px;
}

.center-column::-webkit-scrollbar-thumb,
.right-column::-webkit-scrollbar-thumb {
  background: var(--green-500);
  border-radius: 10px;
  border: 2px solid var(--bg-secondary);
}

.center-column::-webkit-scrollbar-thumb:hover,
.right-column::-webkit-scrollbar-thumb:hover {
  background: var(--green-600);
}

/* Evitar que los paneles se encojan y oculten contenido */
.center-column .panel,
.right-column .panel {
  flex-shrink: 0;
  min-height: fit-content;
}

/* Deprecated - mantener por compatibilidad */
.main-column{
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
}

.sidebar{
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
}

/* ===== PANELES ===== */
.panel{
  background: var(--bg-panel); 
  border: 1px solid var(--border-color); 
  border-radius: 12px; 
  box-shadow: var(--shadow); 
  overflow: hidden; 
  transition: all 0.3s ease;
}

.panel:hover {
  box-shadow: var(--shadow-hover);
}

.panel-header{
  padding: 12px 16px; 
  border-bottom: 1px solid var(--border-color); 
  background: linear-gradient(135deg, var(--bg-panel) 0%, var(--bg-secondary) 100%);
}

.panel-header h2{
  margin: 0; 
  font-size: 1rem; 
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== CHAT PANEL ===== */
.chat-panel{
  display: flex; 
  flex-direction: column; 
  height: 100%;
  flex-shrink: 0;
  min-height: 500px;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-header h2 {
  font-size: 1rem;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.chat-actions {
  display: flex;
  gap: 6px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--bg-panel);
  border-color: var(--green-600);
  transform: scale(1.05);
}

.chat-messages{
  flex: 1; 
  padding: 16px; 
  display: flex; 
  flex-direction: column; 
  gap: 10px; 
  overflow: auto; 
  background: var(--bg-chat);
  scroll-behavior: smooth;
}

.msg{
  max-width: 75%; 
  padding: 10px 14px; 
  border-radius: 12px; 
  line-height: 1.4; 
  transition: all 0.2s ease;
  word-wrap: break-word;
  font-size: 0.9rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.msg.user{
  align-self: flex-end; 
  background: var(--green-600);
  color: white; 
  border-bottom-right-radius: 4px;
  animation: slideInRight 0.3s ease;
}

.msg.bot{
  align-self: flex-start; 
  background: var(--bg-panel);
  border: 1px solid var(--border-color); 
  color: var(--text-primary); 
  border-bottom-left-radius: 4px;
  animation: slideInLeft 0.3s ease;
}

.msg:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Avatar del agente */
.agent-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-panel);
  margin-right: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  vertical-align: middle;
}

.agent-avatar img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.msg.bot .msg-text {
  vertical-align: middle;
  display: inline-block;
  max-width: calc(100% - 36px);
  word-break: break-word;
}

/* Mensaje de Bienvenida Mejorado */
.welcome-message {
  max-width: 90% !important;
  background: linear-gradient(135deg, var(--green-500) 0%, var(--green-600) 100%) !important;
  border: none !important;
  padding: 0 !important;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25) !important;
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

html[data-theme='dark'] .welcome-message {
  background: linear-gradient(135deg, var(--green-600) 0%, #059669 100%) !important;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4) !important;
}

.welcome-content {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
}

.uamito-welcome-avatar {
  width: 60px;
  height: 60px;
  min-width: 60px;
  border-radius: 50%;
  background: white;
  padding: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  animation: float 3s ease-in-out infinite;
}

.uamito-welcome-avatar::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.5);
  animation: pulse-border 2s ease-out infinite;
}

.uamito-welcome-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.welcome-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: white;
}

.welcome-greeting {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  min-height: 24px;
}

.welcome-description {
  font-size: 0.85rem;
  opacity: 0.95;
  line-height: 1.4;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

@media (max-width: 640px) {
  .welcome-message {
    max-width: 95% !important;
  }
  
  .welcome-content {
    gap: 12px;
    padding: 14px;
  }
  
  .uamito-welcome-avatar {
    width: 50px;
    height: 50px;
    min-width: 50px;
  }
  
  .welcome-greeting {
    font-size: 0.95rem;
  }
  
  .welcome-description {
    font-size: 0.75rem;
  }
}


/* Avatar Uamito Pensando (independiente) */
.uamito-thinking {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  align-self: flex-start;
  animation: slideInLeft 0.3s ease;
}

.uamito-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
  padding: 4px;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
  position: relative;
  animation: float 2s ease-in-out infinite;
}

.uamito-avatar::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--green-500);
  opacity: 0.5;
  animation: pulse-border 2s ease-out infinite;
}

@keyframes pulse-border {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.2;
  }
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
}

.uamito-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: white;
}

.thinking-dots {
  display: flex;
  gap: 4px;
  padding: 10px 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.thinking-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-600);
  animation: thinking-bounce 1.4s infinite ease-in-out;
}

.thinking-dots span:nth-child(1) {
  animation-delay: 0s;
}

.thinking-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes thinking-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Typing indicator (legacy - mantenido por compatibilidad) */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  max-width: 60px;
  align-self: flex-start;
  animation: slideInLeft 0.3s ease;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-600);
  animation: pulse 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

.chat-input{
  display: flex; 
  gap: 10px; 
  padding: 12px 16px; 
  border-top: 1px solid var(--border-color);
  background: var(--bg-panel);
}

.chat-input input{
  flex: 1; 
  padding: 10px 14px; 
  border: 1px solid var(--border-color); 
  border-radius: 10px; 
  outline: none; 
  background: var(--bg-secondary);
  color: var(--text-primary); 
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.chat-input input::placeholder{
  color: var(--text-secondary); 
  opacity: 0.7;
}

.chat-input input:focus{
  border-color: var(--green-600); 
  box-shadow: 0 0 0 3px rgba(34,197,94,0.1);
  background: var(--bg-primary);
}

.btn{
  padding: 10px 20px; 
  border-radius: 10px; 
  border: none; 
  cursor: pointer; 
  font-weight: 600; 
  transition: all 0.2s ease;
  font-size: 0.9rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary{
  background: var(--green-600);
  color: white;
}

.btn.primary:hover{
  background: var(--green-700);
  box-shadow: 0 2px 8px rgba(34,197,94,0.3);
}

.btn.primary:disabled{
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.chat-hint{
  padding: 10px 16px; 
  color: var(--text-secondary); 
  font-size: 0.8rem; 
  text-align: center;
  font-style: italic;
  background: var(--bg-secondary);
}

/* ===== RECURSOS PANEL ===== */
.resources-panel {
  background: var(--bg-panel);
}

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

.resource-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.3s ease;
  cursor: pointer;
  text-align: center;
  min-height: 100px;
}

.resource-card:hover {
  background: var(--bg-panel);
  border-color: var(--green-500);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.resource-icon {
  font-size: 1.8rem;
  transition: transform 0.3s ease;
}

.resource-card:hover .resource-icon {
  transform: scale(1.15);
}

.resource-card span {
  font-size: 0.85rem;
  font-weight: 600;
}

/* ===== CARRUSEL DE BANNERS ===== */
.banners-panel .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.carousel-controls {
  display: flex;
  gap: 6px;
}

.carousel-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  line-height: 1;
  padding: 0;
}

.carousel-btn:hover {
  background: var(--green-600);
  color: white;
  border-color: var(--green-600);
  transform: scale(1.1);
}

.carousel-btn:active {
  transform: scale(0.95);
}

.carousel-container {
  position: relative;
  overflow: hidden;
  padding: 0;
  border-radius: 8px;
  width: 100%;
  margin: 12px auto;
  max-width: 100%;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  gap: 0;
}

.carousel-slide {
  min-width: 100%;
  max-width: 100%;
  width: 100%;
  flex-shrink: 0;
  flex-grow: 0;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  margin: 0;
}

.carousel-slide:hover {
  box-shadow: var(--shadow-hover);
}

.carousel-slide img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}

.carousel-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.5) 70%, transparent 100%);
  color: white;
  padding: 20px 16px 12px;
  transform: translateY(0);
  transition: all 0.3s ease;
}

.carousel-slide:hover .carousel-caption {
  background: linear-gradient(to top, rgba(22,163,74,0.9) 0%, rgba(22,163,74,0.6) 70%, transparent 100%);
}

.carousel-caption h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.carousel-caption p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.95;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
  cursor: pointer;
  transition: all 0.3s ease;
}

.indicator:hover {
  background: var(--green-500);
  transform: scale(1.2);
}

.indicator.active {
  background: var(--green-600);
  width: 24px;
  border-radius: 4px;
}

/* ===== FAQ PANEL ===== */
.faq-compact {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-compact details{
  border: 1px solid var(--border-color); 
  border-radius: 8px; 
  padding: 10px 12px; 
  background: var(--bg-secondary); 
  transition: all 0.3s ease;
  cursor: pointer;
}

.faq-compact details:hover {
  border-color: var(--green-500);
  transform: translateX(3px);
}

.faq-compact details[open] {
  background: var(--green-100);
  border-color: var(--green-600);
}

.faq-compact summary{
  cursor: pointer; 
  font-weight: 600; 
  color: var(--text-primary); 
  font-size: 0.85rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.faq-compact summary::-webkit-details-marker {
  display: none;
}

.faq-compact summary::before {
  content: '▶';
  font-size: 0.7rem;
  transition: transform 0.3s ease;
  color: var(--green-600);
}

.faq-compact details[open] summary::before {
  transform: rotate(90deg);
}

.faq-compact p{
  margin: 6px 0 0; 
  color: var(--text-secondary); 
  font-size: 0.8rem;
  padding-left: 16px;
  line-height: 1.4;
}

/* ===== CONTACT PANEL ===== */
.contact-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border-radius: 8px;
  transition: all 0.3s ease;
  font-size: 0.85rem;
}

.contact-item:hover {
  background: var(--bg-panel);
  border: 1px solid var(--green-500);
  transform: translateX(3px);
}

.contact-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* ===== ENLACES ÚTILES PANEL ===== */
.links-panel {
  background: var(--bg-panel);
}

.links-list {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.3s ease;
  cursor: pointer;
}

.link-item:hover {
  background: var(--bg-panel);
  border-color: var(--green-500);
  transform: translateX(5px);
  box-shadow: var(--shadow-hover);
}

.link-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.link-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.link-content strong {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.link-content small {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ===== ESTADÍSTICAS PANEL ===== */
.stats-panel {
  background: var(--bg-panel);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 12px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: var(--green-500);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.stat-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--green-600);
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== FOOTER ===== */
.app-footer{
  max-width: 1400px; 
  margin: 0 auto; 
  padding: 10px 16px; 
  color: var(--text-secondary); 
  border-top: 1px solid var(--border-color); 
  text-align: center;
  font-size: 0.8rem;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  z-index: 100;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 1600px){
  .layout{
    grid-template-columns: 42% 1fr 1fr;
    max-width: 1900px;
    height: calc(100vh - 100px);
  }
  
  .center-column,
  .right-column {
    height: 100%;
  }
}

@media (max-width: 1400px){
  .layout{
    grid-template-columns: 40% 1fr 1fr;
    height: calc(100vh - 120px);
  }
  
  .center-column,
  .right-column {
    height: 100%;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1200px){
  .layout{
    grid-template-columns: 45% 1fr;
    height: calc(100vh - 130px);
  }
  
  .right-column {
    display: none;
  }
  
  .center-column {
    height: 100%;
  }
  
  .resources-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 980px){
  .layout{
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  
  .left-column {
    order: 1;
    overflow: visible;
  }
  
  .center-column {
    order: 2;
    display: flex;
    overflow: visible;
    max-height: none;
  }
  
  .right-column {
    order: 3;
    display: flex;
    overflow: visible;
    max-height: none;
  }
  
  .carousel-slide img{
    height: 200px;
  }
  
  .chat-panel{
    height: 450px;
    min-height: 450px;
  }
  
  .resources-grid {
    grid-template-columns: repeat(3, 1fr);
    padding: 12px;
    gap: 10px;
  }
  
  .resource-card{
    padding: 14px 10px;
  }
  
  .resource-icon{
    font-size: 1.6rem;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Header responsive */
  .header-container {
    padding: 8px 20px;
  }
  
  .logo-uam {
    width: 50px;
    height: 50px;
  }
  
  .university-name {
    font-size: 0.85rem;
  }
  
  .unit-name {
    font-size: 0.75rem;
  }
  
  .badge-text {
    font-size: 0.75rem;
  }
  
  .badge-beta {
    font-size: 0.6rem;
  }
}

@media (max-width: 640px){
  .layout{
    padding: 0 10px;
    gap: 12px;
    margin: 12px auto;
  }
  
  .resources-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .resource-card {
    padding: 10px 8px;
  }
  
  .resource-icon {
    font-size: 1.5rem;
  }
  
  .resource-card span {
    font-size: 0.75rem;
  }
  
  .msg{
    max-width: 90%; 
    font-size: 0.85rem;
  }
  
  .panel{
    border-radius: 10px;
  }
  
  .btn{
    padding: 8px 14px; 
    font-size: 0.85rem;
  }
  
  .chat-panel{
    height: 400px;
    min-height: 400px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  /* Header mobile */
  .header-container {
    padding: 6px 16px;
    flex-wrap: wrap;
  }
  
  .logo-section {
    gap: 10px;
  }
  
  .logo-uam {
    width: 45px;
    height: 45px;
  }
  
  .university-name {
    font-size: 0.75rem;
    letter-spacing: 0.3px;
  }
  
  .unit-name {
    font-size: 0.7rem;
  }
  
  .header-right {
    gap: 10px;
  }
  
  .assistant-badge {
    padding: 4px 8px;
  }
  
  .badge-icon {
    font-size: 0.85rem;
  }
  
  .badge-text {
    font-size: 0.7rem;
  }
  
  .badge-beta {
    font-size: 0.55rem;
    padding: 1px 4px;
  }
  
  .theme-toggle{
    --track-w: 50px;
    --track-h: 24px;
    --knob-d: 18px;
  }
  
  .theme-toggle .label{
    font-size: 0.75rem;
  }
  
  html[data-theme='dark'] .theme-toggle .knob{
    transform: translateX(calc(var(--track-w) - var(--knob-d) - 6px));
  }
  
  /* Carrusel mobile */
  .carousel-slide img {
    height: 160px;
  }
  
  .carousel-caption {
    padding: 16px 12px 10px;
  }
  
  .carousel-caption h3 {
    font-size: 0.9rem;
  }
  
  .carousel-caption p {
    font-size: 0.75rem;
  }
  
  .carousel-btn {
    width: 28px;
    height: 28px;
    font-size: 1.3rem;
  }
  
  /* Uamito pensando mobile */
  .uamito-avatar {
    width: 40px;
    height: 40px;
  }
  
  .thinking-dots {
    padding: 8px 12px;
  }
  
  .thinking-dots span {
    width: 6px;
    height: 6px;
  }
}
