/* ==========================================================================
   PORTAL OFICIAL MONSTRUOFERTAS 2026 — LOGIN PREMIUM
   Feria Empresarial Distrimayor 2026
   ========================================================================== */

:root {
  --portal-night: #171026;
  --portal-deep-purple: #11071f;
  --portal-plum: #46206b;
  --portal-orange: #ff8500;
  --portal-orange-glow: #ff9f22;
  --portal-lime: #a5ef00;
  --portal-white: #ffffff;
  --portal-gray-text: #c5bdd1;
  --portal-border: rgba(165, 239, 0, 0.22);
}

/* Reset del layout general para el portal */
body {
  margin: 0;
  padding: 0;
  background-color: var(--portal-night) !important;
  color: var(--portal-white);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
}

/* Ocultar el carousel de fotos de fondo original para priorizar el escenario 3D */
#bg-wrapper {
  display: none !important;
}

/* Contenedor dividido en 2 columnas: 60% Escenario 3D / 40% Login */
.split-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  background: var(--portal-night);
  overflow: hidden;
}

/* --- PANEL IZQUIERDO (60% ESCRITORIO): ESCENARIO 3D --- */
.left-panel {
  flex: 0 0 60%;
  width: 60%;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background: var(--portal-deep-purple) !important;
  display: block;
}

.portal-3d-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.portal-3d-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Spinner sutil de carga Three.js */
.portal-3d-loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #1e0d33 0%, #10061c 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  color: #ede9df;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  z-index: 10;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.portal-3d-loader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.portal-spinner {
  width: 44px;
  height: 44px;
  border: 3.5px solid rgba(165, 239, 0, 0.15);
  border-top-color: var(--portal-lime);
  border-right-color: var(--portal-orange);
  border-radius: 50%;
  animation: portal-spin 0.85s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

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

/* --- PANEL DERECHO (40% ESCRITORIO): AUTENTICACIÓN PREMIUM --- */
.right-panel {
  flex: 0 0 40%;
  width: 40%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  overflow-x: hidden;
  background: radial-gradient(circle at 75% 25%, #2a1344 0%, var(--portal-night) 75%);
  padding: 1.5rem 2rem;
  box-sizing: border-box;
  position: relative;
  z-index: 2;
  border-left: 1px solid rgba(165, 239, 0, 0.12);
}

.right-panel .content {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
}

/* Tarjeta contenedora de autenticación */
.portal-card {
  width: 100%;
  background: rgba(28, 17, 44, 0.78);
  border: 1px solid var(--portal-border);
  border-radius: 18px;
  padding: 1.6rem 1.8rem 1.4rem;
  box-sizing: border-box;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 133, 0, 0.20);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  animation: portalFadeInUp 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes portalFadeInUp {
  0% {
    opacity: 0;
    transform: translateY(18px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Cabecera del panel derecho con el logo oficial */
.portal-brand-header {
  text-align: center;
  margin-bottom: 0.65rem;
  width: 100%;
  display: flex;
  justify-content: center;
}

.portal-official-logo {
  max-width: 220px;
  width: 72%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.70)) drop-shadow(0 0 14px rgba(165, 239, 0, 0.16));
  transition: transform 0.3s ease;
}

.portal-official-logo:hover {
  transform: scale(1.02);
}

/* Título y subtítulo */
.portal-title {
  margin: 0.2rem 0 0.2rem;
  font-size: 1.30rem;
  font-weight: 800;
  text-align: center;
  color: var(--portal-white);
  letter-spacing: 0.03em;
  text-shadow: 0 2px 10px rgba(165, 239, 0, 0.25);
}

.portal-subtitle {
  margin: 0 0 1.15rem;
  font-size: 0.85rem;
  color: var(--portal-gray-text);
  text-align: center;
  font-weight: 400;
}

/* Alerta de credenciales incorrectas */
.portal-error-alert {
  background: rgba(215, 25, 32, 0.20);
  border: 1px solid rgba(255, 90, 95, 0.45);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  color: #ffc7c9;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  width: 100%;
  box-sizing: border-box;
  animation: portalFadeInUp 0.3s ease-out;
}

/* Formulario */
.portal-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Grupos de campos con labels accesibles */
.portal-input-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  text-align: left;
}

.portal-label {
  font-size: 0.80rem;
  font-weight: 600;
  color: var(--portal-gray-text);
  letter-spacing: 0.02em;
}

.portal-input {
  width: 100%;
  height: 44px;
  background: rgba(18, 10, 30, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 0 0.95rem;
  font-size: 0.92rem;
  color: var(--portal-white);
  box-sizing: border-box;
  font-family: inherit;
  transition: all 0.22s ease;
}

.portal-input:focus {
  outline: none;
  border-color: var(--portal-lime);
  background: rgba(22, 12, 38, 0.95);
  box-shadow: 0 0 0 3px rgba(165, 239, 0, 0.22);
}

.portal-input::placeholder {
  color: rgba(197, 189, 209, 0.4);
}

/* Botón ENTRAR naranja con iluminación sutil al hover */
.btn-portal-submit {
  width: 100%;
  height: 46px;
  margin-top: 0.3rem;
  background: linear-gradient(135deg, #ff8500 0%, #ff9f1c 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: #170900;
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(255, 133, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-portal-submit:hover {
  background: linear-gradient(135deg, #ffa02e 0%, #ffb13b 100%);
  transform: translateY(-1.5px);
  box-shadow: 0 0 24px rgba(255, 146, 46, 0.65), 0 6px 20px rgba(0, 0, 0, 0.4);
  border-color: #ffffff;
}

.btn-portal-submit:active {
  transform: translateY(0.5px);
  box-shadow: 0 2px 8px rgba(255, 133, 0, 0.4);
}

/* Tarjeta interactiva EXPLORAR FERIA VIRTUAL 3D */
.portal-experience-card {
  width: 100%;
  margin-top: 0.85rem;
  padding: 0.65rem 0.95rem;
  box-sizing: border-box;
  background: linear-gradient(135deg, rgba(70, 32, 107, 0.45) 0%, rgba(23, 16, 38, 0.65) 100%);
  border: 1px solid rgba(165, 239, 0, 0.30);
  border-radius: 10px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.25s ease;
}

.portal-experience-card:hover {
  border-color: var(--portal-lime);
  background: linear-gradient(135deg, rgba(85, 38, 130, 0.55) 0%, rgba(32, 20, 52, 0.75) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(165, 239, 0, 0.22);
}

.experience-card-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.experience-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.experience-card-eyebrow {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--portal-orange);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.experience-card-title {
  font-size: 0.86rem;
  color: var(--portal-lime);
  font-weight: 800;
  letter-spacing: 0.03em;
}

.experience-card-desc {
  font-size: 0.72rem;
  color: #c9c1d6;
  margin-top: 1px;
}

.experience-card-arrow {
  color: var(--portal-lime);
  font-size: 1.15rem;
  font-weight: bold;
  transition: transform 0.25s ease;
}

.portal-experience-card:hover .experience-card-arrow {
  transform: translateX(4px);
}

/* Área de instalación PWA / Android */
.portal-pwa-area {
  margin-top: 0.65rem;
  text-align: center;
  width: 100%;
}

.portal-pwa-btn {
  background: none;
  border: 1px dashed rgba(165, 239, 0, 0.4);
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  color: var(--portal-lime);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.portal-pwa-btn:hover {
  background: rgba(165, 239, 0, 0.12);
  border-style: solid;
}

.pwa-note {
  font-size: 0.74rem;
  color: var(--portal-gray-text);
  margin: 0.25rem 0 0;
}

/* Footer: Política de Privacidad y Firma Distrimayor */
.portal-footer {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.portal-privacy-link {
  color: #9f96ad;
  font-size: 0.76rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

.portal-privacy-link:hover {
  color: var(--portal-orange);
  text-decoration: underline;
}

.portal-distrimayor-sign {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  color: #8c829e;
}

.portal-distri-logo {
  height: 20px;
  width: auto;
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.portal-distri-logo:hover {
  opacity: 1;
}

/* Encabezado estático compacto exclusivo para móvil */
.portal-mobile-header {
  display: none;
}

/* ==========================================================================
   ADAPTACIONES RESPONSIVAS ESPECÍFICAS
   ========================================================================== */

/* 1. Laptop estándar (1366 × 768 y pantallas de baja altura): cero scroll vertical */
@media (max-height: 820px) and (min-width: 901px) {
  .right-panel {
    padding: 0.85rem 1.4rem;
  }
  .portal-card {
    padding: 1.15rem 1.4rem 1.0rem;
    border-radius: 14px;
  }
  .portal-official-logo {
    max-width: 180px;
    width: 60%;
  }
  .portal-title {
    font-size: 1.15rem;
    margin: 0.1rem 0;
  }
  .portal-subtitle {
    font-size: 0.78rem;
    margin-bottom: 0.75rem;
  }
  .portal-input-group {
    gap: 0.2rem;
  }
  .portal-label {
    font-size: 0.74rem;
  }
  .portal-input {
    height: 38px;
    font-size: 0.88rem;
    padding: 0 0.8rem;
  }
  .btn-portal-submit {
    height: 40px;
    font-size: 0.88rem;
    margin-top: 0.15rem;
  }
  .portal-experience-card {
    margin-top: 0.60rem;
    padding: 0.50rem 0.80rem;
  }
  .experience-card-title {
    font-size: 0.80rem;
  }
  .experience-card-desc {
    font-size: 0.68rem;
  }
  .portal-footer {
    margin-top: 0.60rem;
    gap: 0.35rem;
  }
}

/* 2. Tablet (769px a 1024px): distribución 50/50 balanceada */
@media (max-width: 1024px) and (min-width: 769px) {
  .left-panel {
    flex: 0 0 50%;
    width: 50%;
  }
  .right-panel {
    flex: 0 0 50%;
    width: 50%;
    padding: 1.5rem;
  }
  .portal-card {
    padding: 1.4rem;
  }
  .portal-official-logo {
    max-width: 190px;
  }
}

/* 3. Móvil (390 × 844 y pantallas <= 768px): modo estático ultraliviano sin GLBs */
@media (max-width: 768px) {
  .split-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-y: auto;
  }

  /* Ocultar panel 3D para evitar descarga de 32.5 MB */
  .left-panel {
    display: none !important;
  }

  /* Encabezado visual compacto con identidad Monstruofertas */
  .portal-mobile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.75rem 1rem 1.25rem;
    background: radial-gradient(circle at 50% 30%, #351754 0%, var(--portal-night) 90%);
    border-bottom: 1.5px solid rgba(165, 239, 0, 0.25);
    text-align: center;
  }

  .portal-mobile-header .portal-official-logo {
    max-width: 200px;
    width: 65%;
  }

  .portal-mobile-badge {
    margin-top: 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--portal-lime);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(165, 239, 0, 0.12);
    border: 1px solid rgba(165, 239, 0, 0.30);
    padding: 0.2rem 0.65rem;
    border-radius: 12px;
  }

  /* Formulario a ancho completo centrado */
  .right-panel {
    flex: 1 0 auto;
    width: 100%;
    height: auto;
    min-height: calc(100vh - 160px);
    border-left: none;
    padding: 1.5rem 1.25rem 3.5rem;
    align-items: flex-start;
  }

  .portal-card {
    padding: 1.5rem 1.25rem;
    background: rgba(28, 17, 44, 0.88);
  }

  /* En móvil el logo ya está en el header */
  .portal-card .portal-brand-header {
    display: none;
  }
}
