/* ============ MGPANEL BASE STYLES ============ */
/* Estilos base para componentes MGPanel disponibles globalmente */

/* ============ PANEL DE PERSONALIZACIÓN ESTILO CANVA ============ */

.mgpanel-customizer {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  pointer-events: none;
}

.mgpanel-customizer * {
  pointer-events: all;
}

/* Botón flotante principal */
.mgpanel-customizer-trigger {
  width: 48px;
  height: 48px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
  user-select: none;
  position: relative;
  overflow: hidden;
}

.mgpanel-customizer-trigger:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 8px 24px rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
}

.mgpanel-customizer-trigger.active {
  background: #6366f1;
  border-color: #6366f1;
  color: white;
  transform: scale(1.05);
}

.mgpanel-customizer-icon {
  width: 20px;
  height: 20px;
  transition: all 0.2s ease;
  position: relative;
}

.mgpanel-customizer-trigger.active .mgpanel-customizer-icon {
  transform: rotate(45deg);
}

/* Panel lateral estilo Canva */
.mgpanel-customizer-panel {
  position: absolute;
  top: 50%;
  right: calc(100% + 12px);
  transform: translateY(-50%);
  width: 280px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-50%) translateX(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.mgpanel-customizer.open .mgpanel-customizer-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0) scale(1);
}

/* Header del panel */
.mgpanel-customizer-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(249, 250, 251, 0.8);
}

.mgpanel-customizer-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mgpanel-customizer-subtitle {
  font-size: 12px;
  color: #6b7280;
  margin: 2px 0 0 0;
  font-weight: 400;
}

/* Contenido del panel */
.mgpanel-customizer-content {
  padding: 0;
  max-height: 400px;
  overflow-y: auto;
}

/* Sección del panel */
.mgpanel-customizer-section {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.mgpanel-customizer-section:last-child {
  border-bottom: none;
}

.mgpanel-customizer-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mgpanel-customizer-section-icon {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

/* Opciones de idioma */
.mgpanel-lang-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mgpanel-lang-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: #374151;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
}

.mgpanel-lang-option:hover {
  background: rgba(99, 102, 241, 0.04);
  border-color: rgba(99, 102, 241, 0.1);
  text-decoration: none;
  color: #6366f1;
}

.mgpanel-lang-option.active {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.2);
  color: #6366f1;
  font-weight: 600;
}

.mgpanel-lang-flag {
  width: 20px;
  height: 15px;
  border-radius: 3px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.mgpanel-lang-flag[data-lang="es"] {
  background-image: url('/public/base/base-12.0.1/media/flags/es.png');
}

.mgpanel-lang-flag[data-lang="us"] {
  background-image: url('/public/base/base-12.0.1/media/flags/us.png');
}

/* Posiciones del panel */
.mgpanel-customizer.position-left {
  left: 20px;
  right: auto;
}

.mgpanel-customizer.position-left .mgpanel-customizer-panel {
  left: calc(100% + 12px);
  right: auto;
  transform: translateY(-50%) translateX(-20px) scale(0.95);
}

.mgpanel-customizer.position-left.open .mgpanel-customizer-panel {
  transform: translateY(-50%) translateX(0) scale(1);
}

.mgpanel-customizer.position-top {
  top: 20px;
  transform: none;
}

.mgpanel-customizer.position-top .mgpanel-customizer-panel {
  top: calc(100% + 12px);
  transform: translateX(-50%) translateY(-20px) scale(0.95);
  left: 50%;
  right: auto;
}

.mgpanel-customizer.position-top.open .mgpanel-customizer-panel {
  transform: translateX(-50%) translateY(0) scale(1);
}

.mgpanel-customizer.position-bottom {
  bottom: 20px;
  top: auto;
  transform: none;
}

.mgpanel-customizer.position-bottom .mgpanel-customizer-panel {
  bottom: calc(100% + 12px);
  top: auto;
  transform: translateX(-50%) translateY(20px) scale(0.95);
  left: 50%;
  right: auto;
}

.mgpanel-customizer.position-bottom.open .mgpanel-customizer-panel {
  transform: translateX(-50%) translateY(0) scale(1);
}

/* Tema oscuro */
.mgpanel-customizer.theme-dark .mgpanel-customizer-trigger {
  background: #1f2937;
  border-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.mgpanel-customizer.theme-dark .mgpanel-customizer-trigger:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.mgpanel-customizer.theme-dark .mgpanel-customizer-trigger.active {
  background: #6366f1;
}

.mgpanel-customizer.theme-dark .mgpanel-customizer-panel {
  background: #1f2937;
  border-color: rgba(255, 255, 255, 0.1);
}

.mgpanel-customizer.theme-dark .mgpanel-customizer-header {
  background: rgba(31, 41, 55, 0.8);
  border-color: rgba(255, 255, 255, 0.1);
}

.mgpanel-customizer.theme-dark .mgpanel-customizer-title {
  color: #f9fafb;
}

.mgpanel-customizer.theme-dark .mgpanel-customizer-subtitle {
  color: #9ca3af;
}

.mgpanel-customizer.theme-dark .mgpanel-customizer-section {
  border-color: rgba(255, 255, 255, 0.05);
}

.mgpanel-customizer.theme-dark .mgpanel-customizer-section-title {
  color: #e5e7eb;
}

.mgpanel-customizer.theme-dark .mgpanel-lang-option {
  color: #e5e7eb;
}

.mgpanel-customizer.theme-dark .mgpanel-lang-option:hover {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

.mgpanel-customizer.theme-dark .mgpanel-lang-option.active {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

/* Responsive */
@media (max-width: 768px) {
  .mgpanel-customizer {
    right: 16px;
  }
  
  .mgpanel-customizer.position-left {
    left: 16px;
  }
  
  .mgpanel-customizer.position-top {
    top: 16px;
  }
  
  .mgpanel-customizer.position-bottom {
    bottom: 16px;
  }
  
  .mgpanel-customizer-trigger {
    width: 44px;
    height: 44px;
  }
  
  .mgpanel-customizer-icon {
    width: 18px;
    height: 18px;
  }
  
  .mgpanel-customizer-panel {
    width: 260px;
    max-height: 70vh;
  }
  
  .mgpanel-customizer-content {
    max-height: 300px;
  }
}

/* Animaciones */
.mgpanel-customizer {
  animation: mgpanel-fade-in 0.4s ease-out;
}

@keyframes mgpanel-fade-in {
  from {
    opacity: 0;
    transform: translateY(-50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

/* Estados de carga */
.mgpanel-customizer.loading .mgpanel-customizer-trigger {
  opacity: 0.7;
  pointer-events: none;
}

.mgpanel-customizer.loading .mgpanel-customizer-trigger::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: mgpanel-spin 1s linear infinite;
}

@keyframes mgpanel-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Scrollbar personalizado para el panel */
.mgpanel-customizer-content::-webkit-scrollbar {
  width: 4px;
}

.mgpanel-customizer-content::-webkit-scrollbar-track {
  background: transparent;
}

.mgpanel-customizer-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

.mgpanel-customizer-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}
