/* =========================
   VARIABLES MODERNAS
   ========================= */
:root {
  --sidebar-width: 270px;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-gradient: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  --sidebar-gradient: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  --footer-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --sidebar-hover: rgba(59, 130, 246, 0.15);
  --text-white: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --topbar-height: 65px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
  --glow-primary: 0 0 15px rgba(59, 130, 246, 0.3);
}

/* =========================
   RESET MEJORADO
   ========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Roboto', 'Segoe UI', sans-serif;
  background: #f1f5f9;
  overflow-x: hidden;
  min-height: 100vh;
}

/* =========================
   SIDEBAR MODERNO
   ========================= */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--sidebar-gradient);
  backdrop-filter: blur(10px);
  color: var(--text-white);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
  z-index: 1000;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar.hidden {
  transform: translateX(-100%);
  box-shadow: none;
}

/* Header del sidebar */
.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.sidebar-title {
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #fff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sidebar-title i {
  font-size: 1.6rem;
  color: var(--primary);
  filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.5));
}

.sidebar-close {
  display: none;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-white);
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.sidebar-close:hover {
  background: rgba(59, 130, 246, 0.2);
  transform: rotate(90deg);
}

/* Navegación */
.sidebar-nav {
  flex: 1;
  padding: 1.25rem 0.75rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.4);
  border-radius: 10px;
}

.accordion {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.accordion-item {
  margin-bottom: 0.1rem;
}

/* Botones del menú */
.accordion-button,
.accordion-link {
  width: 100%;
  padding: 0.8rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.accordion-button i:first-child,
.accordion-link i {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.accordion-button {
  justify-content: space-between;
}

.accordion-arrow {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  margin-left: auto;
}

.accordion-item.active .accordion-arrow {
  transform: rotate(90deg);
}

/* Hover effects */
.accordion-button:hover,
.accordion-link:hover {
  background: var(--sidebar-hover);
  color: var(--text-white);
  transform: translateX(5px);
}

.accordion-button:hover i:first-child,
.accordion-link:hover i {
  color: var(--primary);
  transform: scale(1.1);
}

/* Active state */
.accordion-link.active,
.accordion-button.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.15), transparent);
  color: white;
  border-left: 3px solid var(--primary);
}

.accordion-link.active i:first-child,
.accordion-button.active i:first-child {
  color: var(--primary);
}

/* Submenú */
.accordion-content {
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.5rem 0 0.5rem 1.5rem;
  margin-left: 1.8rem;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.accordion-item.active .accordion-content {
  display: flex;
  animation: slideDown 0.25s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.accordion-content a {
  padding: 0.6rem 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  transition: var(--transition-smooth);
}

.accordion-content a i {
  font-size: 0.95rem;
  width: 20px;
}

.accordion-content a:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--text-white);
  transform: translateX(5px);
}

.accordion-content a:hover i {
  color: var(--primary);
}

/* Separador */
.sidebar-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  margin: 1rem 0.5rem;
}

/* Logout link */
.logout-link {
  color: #fca5a5 !important;
}

.logout-link:hover {
  background: rgba(239, 68, 68, 0.1) !important;
  color: #f87171 !important;
}

.logout-link:hover i {
  color: #ef4444 !important;
}

/* Overlay móvil */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-smooth);
  z-index: 999;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* =========================
   MAIN CONTAINER
   ========================= */
.main-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f1f5f9;
  transition: var(--transition-smooth);
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
}

.main-container.sidebar-hidden {
  margin-left: 0;
  width: 100%;
}

/* =========================
   TOPBAR MEJORADO
   ========================= */
.topbar {
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 1.8rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid #e2e8f0;
}

.sidebar-toggle {
  width: 42px;
  height: 42px;
  border: none;
  background: #f1f5f9;
  color: #475569;
  font-size: 1.3rem;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.sidebar-toggle:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.05);
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
  flex: 1;
}

/* =========================
   FOOTER MEJORADO - CONECTADO CON EL SIDEBAR
   ========================= */
.main-footer {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: var(--text-muted);
  padding: 2rem 2rem 1.5rem;
  position: relative;
  margin-top: auto;
  border-top: 1px solid rgba(59, 130, 246, 0.2);
  box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Efecto de unión con el sidebar */
.main-footer::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    var(--primary),
    rgba(59, 130, 246, 0.5),
    transparent
  );
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.footer-section {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  animation: fadeInUp 0.5s ease backwards;
  animation-delay: calc(0.1s * var(--i, 1));
}

.footer-section:nth-child(1) { --i: 1; }
.footer-section:nth-child(2) { --i: 2; }
.footer-section:nth-child(3) { --i: 3; }

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

.footer-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-white);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  letter-spacing: -0.2px;
}

.footer-title i {
  color: var(--primary);
  font-size: 1.1rem;
  filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.3));
}

.footer-text {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  transition: var(--transition-smooth);
  width: fit-content;
  padding: 0.3rem 0;
}

.footer-link i {
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

.footer-link:hover {
  color: var(--primary);
  transform: translateX(5px);
}

.footer-link:hover i {
  transform: scale(1.1);
}

.footer-disclaimer {
  font-size: 0.75rem;
  color: #475569;
  font-style: italic;
  margin-top: 0.3rem;
}

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.copyright-text {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.copyright-text i {
  color: #10b981;
  font-size: 0.9rem;
  animation: pulse 2s infinite;
}

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

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 85%;
    max-width: 300px;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main-container {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .topbar {
    padding: 0 1rem;
  }

  .topbar-title {
    font-size: 0.9rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 1.5rem;
  }

  .footer-section {
    align-items: center;
  }

  .footer-link {
    justify-content: center;
  }

  .contact-info {
    align-items: center;
  }

  .copyright-text {
    flex-direction: column;
    gap: 0.3rem;
  }
}

@media (max-width: 480px) {
  .footer-content {
    gap: 1.2rem;
  }

  .footer-title {
    justify-content: center;
  }

  .footer-text {
    text-align: center;
  }
}

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

::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 10px;
}

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


/* =========================
   ANIMACIONES ADICIONALES
   ========================= */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}



/* =========================
   FIJAR FOOTER AL FONDO
   ========================= */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1 0 auto;
}

.main-footer {
    flex-shrink: 0;
    margin-top: auto;
}
