:root {
  /* Acento morado (igual que antes) */
  --primary-color: #7c3aed;
  --primary-dark: #5b21b6;
  --primary-light: #8b5cf6; /* un poco menos pastel */
  --secondary-color: #6d28d9; /* más sobrio */
  --accent-color: #8b5cf6;

  /* Neutros serios */
  --dark-color: #111827; /* títulos, textos destacados */
  --text-color: #1f2937; /* texto base */
  --text-light: #6b7280; /* texto secundario */

  /* Fondos y bordes NEUTROS (adiós lila) */
  --light-color: #ffffff; /* ← fondo general BLANCO */
  --gray-color: #e5e7eb; /* bordes/bgs ligeros gris neutro */

  /* Sombras (neutras) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.12);

  --transition-fast: all 0.2s ease;
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);

  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --border-radius-full: 9999px;

  --sidebar-width: 280px;
  --sidebar-collapsed: 70px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  position: relative;
}

body {
  font-family: "Poppins", sans-serif;
  color: var(--text-color);
  line-height: 1.6;
  background-color: var(--light-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 1.25rem;
  color: var(--dark-color);
}

/* Contenedor principal sin desbordes */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
  min-width: 0;
  position: relative;
  overflow-x: hidden;
}

/* Sidebar Styles */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  transition: width var(--transition-normal) ease;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  color: var(--white-color);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-header h2,
.sidebar.collapsed .menu-item .label {
  display: none;
}

.sidebar.collapsed .menu-item {
  justify-content: center;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--white-color);
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--white-color);
  cursor: pointer;
  font-size: 1.5rem;
}

.sidebar-menu {
  list-style: none;
  padding: 1rem 0;
}

.menu-item {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-fast);
  border-left: 4px solid transparent;
  margin: 0.25rem 0.5rem;
  border-radius: var(--border-radius-md);
}

.menu-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateX(5px);
}

.menu-item.active {
  background-color: rgba(255, 255, 255, 0.15);
  border-left: 4px solid var(--accent-color);
}

.menu-item .material-icons {
  margin-right: 15px;
  font-size: 1.5rem;
}

.menu-item span {
  font-weight: 500;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 1.5rem;
  transition: margin-left var(--transition-normal) ease;
  background-color: var(--light-color);
  width: calc(100% - var(--sidebar-width));
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed);
  width: calc(100% - var(--sidebar-collapsed));
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--gray-color);
  flex-wrap: wrap;
  gap: 1rem;
}

.content-title {
  flex: 1 1 auto;
  order: 1;
  min-width: 0;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto; /* IMPORTANTE: Empuja a la derecha */
  order: 2; /* Siempre a la derecha */
  flex: 0 0 auto;
}

.header-controls select {
  padding: 0.45rem 1.75rem 0.45rem 0.75rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--gray-color);
  background-color: var(--light-color);
  color: var(--dark-color);
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
  min-width: 105px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--dark-color) 50%),
    linear-gradient(135deg, var(--dark-color) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.header-controls select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.mobile-toggle {
  display: none; /* Oculto por defecto en PC */
  background: none;
  border: none;
  color: var(--dark-color);
  cursor: pointer;
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius-md);
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.mobile-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

.mobile-toggle:active {
  transform: scale(0.95);
  background: rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
  .header-controls {
    gap: 0.65rem;
  }

  .header-controls select {
    min-width: 94px;
    padding: 0.35rem 1.5rem 0.35rem 0.65rem;
    font-size: 0.85rem;
  }
}

.content-title {
  font-size: 1.8rem;
  color: var(--dark-color);
  font-weight: 600;
}

.content-title:empty {
  display: none;
}

.content-section {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.content-section.active {
  display: block;
  animation: fadeIn 0.5s;
}

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

/* Card Styles */
.card {
  background-color: var(--white-color);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-color);
  transition: var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.card-title {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Dashboard Styles */
.metrics-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: var(--transition-normal);
  color: var(--white-color);
}

.metric-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.metric-card .material-icons {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.9;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  margin: 0.5rem 0;
}

.metric-label {
  opacity: 0.9;
  font-size: 0.9rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--dark-color);
}

.form-input {
  width: 100%;
  padding: 0.875rem 1rem;
  background-color: var(--white-color);
  border: 1px solid var(--gray-color);
  border-radius: var(--border-radius-md);
  color: var(--text-color);
  font-size: 1rem;
  transition: var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-md);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-normal);
  font-size: 0.95rem;
  border: none;
  outline: none;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
}

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

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Table Styles */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.table th,
.table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-color);
}

.table th {
  background-color: #f1f5f9;
  font-weight: 600;
  color: var(--dark-color);
}

.table tr:hover {
  background-color: #f8fafc;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.product-card {
  background-color: var(--white-color);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-normal);
  border: 1px solid var(--gray-color);
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

.product-image {
  height: 160px;
  background: linear-gradient(
    135deg,
    var(--primary-light) 0%,
    var(--primary-color) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image .material-icons {
  font-size: 3rem;
  color: var(--white-color);
}

.product-info {
  padding: 1.25rem;
}

.product-title {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--dark-color);
}

.product-price {
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  display: none;
}

.modal {
  background-color: var(--white-color);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gray-color);
}

.modal-header h2 {
  margin-bottom: 0;
  color: var(--dark-color);
}

.close-modal {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.close-modal:hover {
  color: var(--dark-color);
  transform: rotate(90deg);
}

/* Responsive Styles */

/* Tablets y móviles (hasta 768px) */
@media (max-width: 768px) {
  .main-content {
    margin-left: 0;
    padding: 1rem;
    width: 100%;
  }

  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-collapsed);
    z-index: 2000;
    /* MÓVIL: Fondo blanco premium con border morado - FORZADO */
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: none !important;
    border-right: 3px solid #7c3aed !important;
    box-shadow: 4px 0 20px rgba(124, 58, 237, 0.15) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  /* Cuando está visible, solo mostrar iconos */
  .sidebar.expanded {
    transform: translateX(0);
    width: var(--sidebar-collapsed) !important; /* Ancho de iconos solamente */
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: none !important;
  }

  /* FORZAR: Siempre ocultar texto en móvil, incluso si está "expanded" */
  .sidebar .sidebar-header h2,
  .sidebar .menu-item .label {
    display: none !important; /* Nunca mostrar texto en móvil */
  }

  /* Iconos centrados con estilo profesional */
  .sidebar .menu-item {
    justify-content: center !important;
    padding: 1rem 0.5rem !important;
    margin: 0.35rem 0.5rem !important;
    border-radius: 10px !important;
    transition: all 0.3s ease !important;
    background: transparent !important;
  }

  .sidebar .menu-item .material-icons {
    font-size: 1.5rem !important;
    color: #1f2a5f !important;
    transition: all 0.3s ease !important;
  }

  /* Hover sutil */
  .sidebar .menu-item:hover {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(37, 99, 235, 0.08)) !important;
    transform: scale(1.05) !important;
  }

  .sidebar .menu-item:hover .material-icons {
    color: #7c3aed !important;
  }

  /* Item activo con gradiente morado */
  .sidebar .menu-item.active {
    background: linear-gradient(135deg, #7c3aed, #2563eb) !important;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3) !important;
    border-left: none !important;
  }

  .sidebar .menu-item.active .material-icons {
    color: #ffffff !important;
  }

  /* Logo del sidebar en móvil */
  .sidebar-logo {
    max-width: 45px !important;
    height: auto !important;
  }

  .sidebar-header {
    padding: 1.25rem 0.5rem !important;
    justify-content: center !important;
    border-bottom: 2px solid rgba(124, 58, 237, 0.15) !important;
    background: #ffffff !important;
  }

  .menu-toggle {
    display: none !important; /* Ocultar toggle interno en móvil */
  }

  /* Animación suave al abrir sidebar */
  .mobile-toggle {
    display: flex; /* Visible en móvil con flex para centrar el icono */
  }

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

  .content-header {
    padding: 0.75rem 0;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
  }
  
  .content-title {
    font-size: 1.5rem;
    flex: 1 1 100%;
    order: 1;
    margin-bottom: 0.5rem;
  }

  .header-controls {
    flex: 0 0 auto;
    margin-left: auto;
    order: 2;
    justify-content: flex-end;
  }

  .metrics-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .form-input {
    padding: 0.75rem;
    font-size: 0.95rem;
  }
  
  .btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
  }
}

/* Tablets en orientación horizontal (769px - 992px) */
@media (max-width: 992px) and (min-width: 769px) {
  .metrics-container {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .main-content {
    padding: 1.25rem;
  }
}

/* Móviles pequeños (hasta 480px) */
@media (max-width: 480px) {
  .main-content {
    padding: 0.75rem;
  }
  
  .content-header {
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    display: flex !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
  }
  
  .content-title {
    font-size: 1.35rem;
    flex: 1 1 auto !important;
    order: 1 !important;
  }
  
  .header-controls {
    margin-left: auto !important;
    order: 2 !important;
    flex: 0 0 auto !important;
  }
  
  .header-controls select {
    min-width: 80px;
    padding: 0.3rem 1.25rem 0.3rem 0.5rem;
    font-size: 0.8rem;
  }
  
  .card {
    padding: 0.875rem;
    border-radius: var(--border-radius-md);
  }
  
  .card-title {
    font-size: 1.1rem;
  }
  
  .metric-card {
    padding: 1.25rem;
  }
  
  .metric-value {
    font-size: 1.75rem;
  }
  
  .form-input {
    padding: 0.65rem 0.75rem;
  }
  
  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }
}

/* Tablets grandes (1024px - 1200px) */
@media (min-width: 1025px) and (max-width: 1200px) {
  .main-content {
    padding: 1.5rem;
  }
  
  .metrics-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

.animate {
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}

.delay-1 {
  animation-delay: 0.1s;
}

.delay-2 {
  animation-delay: 0.2s;
}

.delay-3 {
  animation-delay: 0.3s;
}

.content-section {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.content-section.ready {
  opacity: 1;
}

/* Sidebar: texto e íconos SIEMPRE blancos */
.sidebar,
.sidebar-header h2,
.sidebar .menu-item .label,
.sidebar .menu-item .material-icons,
.sidebar a {
  color: #fff;
}

/* Estados visuales conservadores en blanco */
.sidebar .menu-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .menu-item.active {
  background-color: rgba(255, 255, 255, 0.16);
  border-left-color: var(--primary-color);
}

/* --- Scroll por sección, no en el contenedor principal --- */
.main-content {
  /* fallback: permite scroll vertical si el scroll interno falla */
  overflow-x: hidden;
  overflow-y: auto;
  /* que tome el alto de la ventana */
  height: 100dvh;
  min-height: 100vh;
  /* para que el header quede fijo arriba y la sección crezca abajo */
  display: flex;
  flex-direction: column;
}

/* el header queda en su tamaño natural */
.content-header {
  flex: 0 0 auto;
}

/* todas las secciones comparten reglas: por defecto no se ven */
.content-section {
  display: none;
  flex: 1 1 auto; /* ocupa el espacio disponible */
  min-height: 0; /* CLAVE para permitir scroll interno en flex */
  overflow-y: auto; /* cada sección scrollea por dentro */
  height: 100%;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

/* la activa sí se muestra */
.content-section.active {
  display: block;
}

/* Anti-FOUC: oculta secciones hasta que estén listas */
.content-section {
  opacity: 0;
  pointer-events: none;
}
.content-section.ready {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.15s ease;
}

/* Loader simple centrado */
.section-loader {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: #6b7280;
  font:
    500 14px/1.4 Poppins,
    system-ui,
    sans-serif;
}
.section-loader::before {
  content: "";
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0, 0, 0, 0.12);
  border-top-color: #2563eb;
  border-radius: 50%;
  display: block;
  margin: 0 auto 12px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* === Ultra Light Blue–Purple — Dashboard limpio (texto azul+morado) === */
:root {
  --brand-blue: #2563eb;
  --brand-purple: #7c3aed;
  --text-900: #1f2a5f; /* indigo pro: azul+morado para texto principal */
  --text-600: #4c51bf; /* indigo más claro para secundarios */
  --border: #e5e7eb;
}

/* Lienzo blanco (sin degradados) */
body {
  background: #ffffff !important;
  color: var(--text-900) !important;
}

/* Sidebar blanca con borde y acentos sutiles */
.sidebar {
  background: #fff !important;
  color: var(--text-900) !important;
  border-right: 1px solid var(--border) !important;
  box-shadow: none !important;
}
.sidebar .menu-item,
.sidebar .menu-item .material-icons,
.sidebar .menu-item .label,
.sidebar-header h2,
.sidebar a {
  color: var(--text-900) !important;
}

.sidebar .menu-item:hover {
  background: #f8fafc !important;
  transform: none !important;
}
.sidebar .menu-item.active {
  background: linear-gradient(
    0deg,
    rgba(37, 99, 235, 0.06),
    rgba(124, 58, 237, 0.06)
  ) !important;
  border-left: 3px solid var(--brand-purple) !important;
}

/* Contenido y tarjetas claras */
.main-content {
  background: #fff !important;
}

.card,
.product-card {
  background: #fff !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06) !important;
}
.card-title {
  color: var(--text-900) !important;
}

/* Acento pro: títulos y valores con degradado azul↔morado */
.content-title,
.card-title,
.metric-value {
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
}

/* Métricas en blanco con icono acento */
.metric-card {
  background: #fff !important;
  color: var(--text-900) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06) !important;
  text-align: left;
}
.metric-card .material-icons {
  color: var(--brand-purple) !important;
  opacity: 1 !important;
}
.metric-label {
  color: var(--text-600) !important;
}

/* Inputs y tablas */
.form-input {
  background: #fff !important;
  color: var(--text-900) !important;
  border-color: var(--border) !important;
}
.form-input:focus {
  border-color: var(--brand-blue) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}
.table th {
  background: #f8fafc !important;
  color: var(--text-900) !important;
  border-bottom: 1px solid var(--border) !important;
}
.table td {
  border-bottom: 1px solid var(--border) !important;
}
.table tr:hover {
  background: #f9fafb !important;
}

/* Botones: acento suave, resto neutro */
.btn,
.btn-primary {
  background: linear-gradient(90deg, #3b82f6, #a78bfa) !important;
  color: #fff !important;
  border: 0 !important;
  box-shadow: 0 8px 18px rgba(124, 58, 237, 0.18) !important;
}
.btn:hover,
.btn-primary:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}
.btn-outline {
  background: #fff !important;
  color: var(--text-900) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}

/* Productos */
.product-image {
  background: linear-gradient(135deg, #f8fafc, #eef2ff) !important;
}
.product-image .material-icons {
  color: var(--brand-purple) !important;
}

/* Links del contenido con azul→morado */
.main-content a {
  color: var(--brand-blue) !important;
  text-decoration: none;
}
.main-content a:hover {
  color: var(--brand-purple) !important;
  text-decoration: underline;
}

/* Detalle superior en cards (muy sutil) */
.card,
.product-card {
  position: relative;
  overflow: hidden;
}
.card::before,
.product-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(
    90deg,
    rgba(37, 99, 235, 0.55),
    rgba(124, 58, 237, 0.55)
  );
  pointer-events: none;
}

/* Todo “muted” en indigo oscuro */
.muted,
.muted * {
  color: var(--text-900) !important;
}

/* === Anti-flicker sin tocar HTML (icons y botones) === */

/* 1) Oculta ligaduras de Material Icons hasta que cargue la font */
html:not(.icons-ready) .material-icons {
  visibility: hidden;
}
html.icons-ready .material-icons {
  visibility: visible;
  transition: opacity 0.12s ease;
}
/* Reserva ancho para que no "salte" el layout cuando aparezcan */
.material-icons {
  width: 1em;
  text-align: center;
}

/* 2) Desactiva menús/botones mientras la app inicializa */
html.app-loading .menu-item,
html.app-loading .menu-toggle,
html.app-loading .mobile-toggle {
  pointer-events: none;
  opacity: 0;
}
html.app-loading .content-header {
  visibility: hidden;
}

/* 3) Activa todo cuando la primera sección ya está lista */
html.ready-ui .menu-item,
html.ready-ui .menu-toggle,
html.ready-ui .mobile-toggle {
  pointer-events: auto;
  opacity: 1;
  transition: opacity 0.12s ease;
}
html.ready-ui .content-header {
  visibility: visible;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
}
.sidebar-logo {
  height: 28px;
  width: auto;
  display: block;
  object-fit: contain;
}
@media (max-width: 600px) {
  .sidebar-logo {
    height: 24px;
  }
}

/* Logo normal */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
}
.sidebar-logo {
  height: 28px;
  width: auto;
  display: block;
  object-fit: contain;
  transition:
    opacity 0.2s,
    transform 0.2s;
}

/* Al colapsar la barra, ocultar el logo */
.sidebar.collapsed .sidebar-logo {
  opacity: 0;
  pointer-events: none;
  width: 0; /* evita que reserve espacio */
  height: 0;
  transform: scale(0.95);
}

/* (opcional) un poquito más compacto en móviles */
@media (max-width: 600px) {
  .sidebar-logo {
    height: 24px;
  }
}

/* Botón: caja cuadrada y centrado del ícono */
.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
}

/* Al colapsar: centrar header y ocultar totalmente el logo */
.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 12px; /* simétrico */
}
.sidebar.collapsed .sidebar-logo {
  display: none !important; /* elimina cualquier espacio fantasma */
}

/* Por si algún margen empuja el botón, anúlalo */
.sidebar.collapsed .menu-toggle {
  margin: 0 auto;
}

/* (Opcional) íconos del menú sin sangría cuando está colapsado */
.sidebar.collapsed .menu-item .material-icons {
  margin-right: 0;
}

/* Anti-clip en Sponsor (username/email) */
#register-root .sponsor-block {
  align-items: center; /* centra vertical */
  padding: 12px 14px; /* un pelín más de aire */
}

#register-root .sponsor-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.25;
  overflow: visible; /* ← evita cortar la segunda línea */
}

#register-root .sponsor-info div:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-bottom: 2px; /* evita corte de descendentes */
}

/* Android: ocultar el botón del header mientras el sidebar está abierto */
@media (max-width: 768px) {
  html.is-android aside.sidebar.expanded ~ .main-content .mobile-toggle {
    display: none !important;
  }
}

/* Ocultar el botón del header cuando el sidebar móvil está abierto */
@media (max-width: 768px) {
  aside.sidebar.expanded ~ .main-content .mobile-toggle {
    display: none !important;
  }
}

/* Modal body scrollable y ancho cómodo para textos largos */
.modal {
  max-width: 720px;
}
.modal-body {
  max-height: 70vh;
  overflow-y: auto;
  line-height: 1.55;
}

/* evita que la traducción alargue el menú lateral */
.sidebar .label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ========================================
   🎨 SIDEBAR MÓVIL BLANCO - PRIORIDAD MÁXIMA
   ======================================== */
@media (max-width: 768px) {
  /* FORZAR fondo blanco en móvil - Máxima especificidad */
  html body aside.sidebar,
  html body aside#sidebar,
  html body .sidebar.expanded,
  html body aside.sidebar.expanded,
  body aside.sidebar,
  body aside#sidebar {
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: none !important;
    border-right: 3px solid #7c3aed !important;
  }

  /* Header blanco también */
  html body .sidebar .sidebar-header,
  html body aside.sidebar .sidebar-header,
  body .sidebar .sidebar-header {
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: none !important;
  }

  /* Menu items background transparent */
  html body .sidebar .menu-item,
  body .sidebar .menu-item {
    background: transparent !important;
  }

  /* Iconos oscuros para contraste */
  html body .sidebar .menu-item .material-icons,
  body .sidebar .menu-item .material-icons {
    color: #1f2a5f !important;
  }

  /* Item activo morado */
  html body .sidebar .menu-item.active,
  body .sidebar .menu-item.active {
    background: linear-gradient(135deg, #7c3aed, #2563eb) !important;
  }

  html body .sidebar .menu-item.active .material-icons,
  body .sidebar .menu-item.active .material-icons {
    color: #ffffff !important;
  }

  /* Sidebar menu background */
  html body .sidebar .sidebar-menu,
  body .sidebar .sidebar-menu {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
  }
  
  /* Menu items sin fondo por defecto */
  html body .sidebar .menu-item,
  body .sidebar .menu-item {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
  }
  
  /* Item activo con gradiente morado */
  html body .sidebar .menu-item.active,
  body .sidebar .menu-item.active {
    background: linear-gradient(135deg, #7c3aed, #2563eb) !important;
    background-image: linear-gradient(135deg, #7c3aed, #2563eb) !important;
  }
}
