/* ========================================
   PERSONALIZACIÓN TOTAL - COLLAGE CORREGIDO
======================================== */

.branding-section {
  min-height: 100vh;
  background: var(--bg);
  padding: 120px 0 60px;
  position: relative;
  overflow: hidden;
}

.branding-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.branding-header {
  text-align: center;
  margin-bottom: 80px;
}

/* ========== COLLAGE GRID 2x2 ========== */
.branding-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 24px; /* ESPACIADO UNIFORME */
  margin-bottom: 60px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  align-items: start;
}

.branding-mockup {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.branding-mockup.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ESTILOS BASE */
.mockup-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.4s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  /* ASEGURAR QUE EL CONTENIDO NO SE DESBORDE */
  overflow: hidden;
}

.mockup-wrapper:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 15px 40px rgba(0, 188, 212, 0.15);
}

/* CONTENEDOR DE IMAGEN */
.mockup-image {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* LIMITAR ALTURA PARA QUE NO APLASTE EL TEXTO */
  max-height: 85%;
  flex-shrink: 0;
}

.mockup-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: all 0.4s ease;
  display: block;
}

/* ========== PROPORCIONES ESPECÍFICAS ========== */

/* HORIZONTALES (16:9) - 1280x720px */
.branding-mockup:nth-child(1) .mockup-image,
.branding-mockup:nth-child(4) .mockup-image {
  aspect-ratio: 16 / 9;
}

/* VERTICALES (9:16) - 720x1280px */
.branding-mockup:nth-child(2) .mockup-image,
.branding-mockup:nth-child(3) .mockup-image {
  aspect-ratio: 9 / 16;
  /* ESPECIAL PARA APP MÓVIL: ASEGURAR QUE EL TEXTO SE VEA */
  max-height: 80%;
}

/* ========== POSICIONAMIENTO EN GRID ========== */

/* 1. IZQUIERDA SUPERIOR - Horizontal 16:9 */
.branding-mockup:nth-child(1) {
  grid-column: 1;
  grid-row: 1;
}

/* 2. DERECHA SUPERIOR - Vertical 9:16 */
.branding-mockup:nth-child(2) {
  grid-column: 2;
  grid-row: 1 / span 2; /* Ocupa ambas filas */
  height: 100%;
  /* ESPACIADO EXTRA PARA ALINEAR CON LOS OTROS */
  margin-top: 0;
  margin-bottom: 0;
}

/* 3. IZQUIERDA INFERIOR - Vertical 9:16 */
.branding-mockup:nth-child(3) {
  grid-column: 1;
  grid-row: 2;
}

/* 4. DERECHA INFERIOR - Horizontal 16:9 */
.branding-mockup:nth-child(4) {
  grid-column: 2;
  grid-row: 2;
  align-self: end; /* Alinea al fondo de la celda */
}

/* ========== ESPACIADO UNIFORME ADICIONAL ========== */
/* Asegurar que todas las celdas tengan el mismo espaciado interno */
.branding-mockup:nth-child(1),
.branding-mockup:nth-child(3),
.branding-mockup:nth-child(4) {
  margin: 0;
  padding: 0;
}

/* ========== LABELS (ARREGLADO PARA APP MÓVIL) ========== */
.mockup-label {
  text-align: center;
  padding-top: 12px;
  /* ASEGURAR QUE EL TEXTO SIEMPRE SEA VISIBLE */
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-shrink: 0;
  width: 100%;
  height: 50px;
}

.mockup-label h4 {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.2;
}

.mockup-label p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.3;
  /* EVITAR QUE EL TEXTO SE SALGA */
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

/* ESPECIAL PARA APP MÓVIL (2do elemento) */
.branding-mockup:nth-child(2) .mockup-label {
  padding-top: 16px;
}

/* Dashboard Principal - Horizontal (Izq Sup) */
.branding-mockup:nth-child(1) .mockup-logo-highlight {
  top: 2px;
  left: 5px;
  width: 120px;
  height: 35px;
  font-size: 10px;
}

/* App Móvil - Vertical (Der Sup) */
.branding-mockup:nth-child(2) .mockup-logo-highlight {
  top: auto;
  bottom: 15%; /* BAJADO PARA NO INTERFERIR CON EL TEXTO */
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 90px;
  border-radius: 12px;
}

/* Solicitud de Inscripción - Vertical (Izq Inf) */
.branding-mockup:nth-child(3) .mockup-logo-highlight {
  top: 8%;
  right: 8%;
  left: auto;
  width: 100px;
  height: 50px;
}

/* Portal de Acceso - Horizontal (Der Inf) */
.branding-mockup:nth-child(4) .mockup-logo-highlight {
  top: 15%;
  left: 8%;
  width: 160px;
  height: 65px;
}

/* ========== RESPONSIVE ========== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
  .branding-grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, auto);
    gap: 24px; /* MANTENER ESPACIADO UNIFORME */
    max-width: 500px;
  }

  /* Reset todas las posiciones */
  .branding-mockup:nth-child(1),
  .branding-mockup:nth-child(2),
  .branding-mockup:nth-child(3),
  .branding-mockup:nth-child(4) {
    grid-column: 1;
    grid-row: auto;
    height: auto;
  }

  /* En tablet, mantener proporciones pero ajustar verticales */
  .branding-mockup:nth-child(2) .mockup-image,
  .branding-mockup:nth-child(3) .mockup-image {
    aspect-ratio: 3 / 4; /* Más manejable en tablet */
    max-height: 85%; /* ASEGURAR QUE EL TEXTO SE VEA */
  }

  /* AJUSTAR ESPACIADO EN TABLET */
  .branding-mockup:nth-child(2) {
    margin-top: 0;
    margin-bottom: 0;
  }
}

/* Móvil (hasta 768px) */
@media (max-width: 768px) {
  .branding-section {
    padding: 80px 0 60px;
  }

  .branding-header {
    margin-bottom: 50px;
  }

  .branding-grid {
    gap: 20px; /* ESPACIADO UNIFORME EN MÓVIL */
    margin-bottom: 50px;
  }

  .mockup-wrapper {
    padding: 12px;
  }

  /* En móvil, ajustar verticales a proporción más cuadrada */
  .branding-mockup:nth-child(2) .mockup-image,
  .branding-mockup:nth-child(3) .mockup-image {
    aspect-ratio: 2 / 3;
    max-height: 80%; /* ASEGURAR ESPACIO PARA TEXTO */
  }

  /* Ajustar tamaño de highlights */
  .branding-mockup:nth-child(1) .mockup-logo-highlight {
    width: 120px;
    height: 50px;
  }

  .branding-mockup:nth-child(2) .mockup-logo-highlight {
    width: 70px;
    height: 70px;
    bottom: 20%; /* MÁS ARRIBA EN MÓVIL */
  }

  .branding-mockup:nth-child(3) .mockup-logo-highlight {
    width: 90px;
    height: 45px;
  }

  .branding-mockup:nth-child(4) .mockup-logo-highlight {
    width: 140px;
    height: 55px;
  }

  /* ESPECIAL PARA MÓVIL: ASEGURAR QUE EL TEXTO SE VEA */
  .mockup-label {
    min-height: 50px;
    padding-top: 10px;
  }

  .branding-mockup:nth-child(2) .mockup-label {
    min-height: 60px;
  }
}

/* Móvil pequeño (hasta 480px) */
@media (max-width: 480px) {
  .branding-grid {
    gap: 16px; /* ESPACIADO UNIFORME MÁS PEQUEÑO */
  }

  .mockup-wrapper {
    padding: 10px;
  }

  .mockup-label h4 {
    font-size: 14px;
  }

  .mockup-label p {
    font-size: 12px;
  }

  /* ASEGURAR QUE EL TEXTO NO SE SALGA EN MÓVILES PEQUEÑOS */
  .mockup-label {
    min-height: 45px;
  }
}

/* ========== FEATURES DE PERSONALIZACIÓN ========== */
.branding-features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 80px;
}

.branding-feature-item {
  text-align: center;
  padding: 32px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: all 0.3s ease;
}

.branding-feature-item:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 188, 212, 0.1);
}

.feature-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: linear-gradient(
    135deg,
    rgba(0, 188, 212, 0.1),
    rgba(0, 229, 255, 0.1)
  );
  border: 1px solid rgba(0, 188, 212, 0.3);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.branding-feature-item:hover .feature-icon {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-color: var(--primary);
  transform: scale(1.1);
}

.feature-icon svg {
  color: var(--primary);
  transition: color 0.3s ease;
}

.branding-feature-item:hover .feature-icon svg {
  color: #fff;
}

.branding-feature-item h4 {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.branding-feature-item p {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.6;
}

/* ========== CTA DE PERSONALIZACIÓN ========== */
.branding-cta {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  padding: 48px;
  background: linear-gradient(
    135deg,
    rgba(0, 188, 212, 0.08),
    rgba(0, 229, 255, 0.08)
  );
  border: 1.5px solid rgba(0, 188, 212, 0.25);
  border-radius: 24px;
}

.branding-cta h3 {
  font-family: var(--font);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.branding-cta p {
  font-size: 16px;
  color: var(--text-soft);
  margin-bottom: 28px;
}

/* ========== MODAL DE PERSONALIZACIÓN ========== */
.personalization-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.personalization-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.personalization-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.4s ease;
}

.personalization-modal-overlay.active .personalization-modal-content {
  transform: scale(1) translateY(0);
}

.personalization-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.personalization-modal-close:hover {
  background: var(--error);
  border-color: var(--error);
  transform: rotate(90deg);
}

.personalization-modal-close svg {
  color: var(--text);
}

.personalization-modal-close:hover svg {
  color: #fff;
}

.personalization-modal-header {
  text-align: center;
  padding: 50px 40px 30px;
  border-bottom: 1px solid var(--border);
}

.personalization-modal-header .modal-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.personalization-modal-header .modal-icon svg {
  color: #fff;
}

.personalization-modal-header h2 {
  font-family: var(--font);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.personalization-modal-header p {
  font-size: 15px;
  color: var(--text-soft);
}

.personalization-modal-body {
  padding: 40px;
}

/* ========== FORM GROUPS ========== */
.personalization-form-group {
  margin-bottom: 28px;
}

.personalization-form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.personalization-form-group input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  transition: all 0.2s ease;
}

.personalization-form-group input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.1);
}

/* ========== LOGO UPLOAD ========== */
.logo-upload-area {
  position: relative;
  width: 100%;
  min-height: 180px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--bg);
  cursor: pointer;
  transition: all 0.3s ease;
}

.logo-upload-area:hover {
  border-color: var(--primary);
  background: rgba(0, 188, 212, 0.05);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.upload-placeholder svg {
  color: var(--text-muted);
  margin-bottom: 16px;
}

.upload-placeholder p {
  font-size: 15px;
  color: var(--text-soft);
  margin-bottom: 8px;
}

.upload-placeholder strong {
  color: var(--primary);
}

.upload-placeholder span {
  font-size: 13px;
  color: var(--text-muted);
}

.upload-preview {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.upload-preview img {
  max-width: 200px;
  max-height: 120px;
  object-fit: contain;
  border-radius: 8px;
}

.remove-logo {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 32px;
  height: 32px;
  background: var(--error);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.remove-logo:hover {
  transform: scale(1.1);
}

.remove-logo svg {
  color: #fff;
}

/* ========== PREVIEW DEL MOCKUP ========== */
.personalization-preview {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.personalization-preview h4 {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.preview-mockup {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  min-height: 200px;
}

.preview-logo-area {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  margin-bottom: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.preview-logo-area::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(0, 188, 212, 0.05),
    rgba(0, 229, 255, 0.05)
  );
}

#previewLogo {
  max-width: 180px;
  max-height: 60px;
  object-fit: contain;
  z-index: 2;
}

.preview-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.preview-text svg {
  color: var(--primary);
}

.preview-text span {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.preview-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  animation: preview-shimmer 2s ease-in-out infinite;
}

.preview-bar.short {
  width: 60%;
}

.preview-bar.medium {
  width: 80%;
}

@keyframes preview-shimmer {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
  }
}

/* ========== ACCIONES ========== */
.personalization-actions {
  margin-top: 32px;
  text-align: center;
}

.personalization-note {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .branding-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .branding-features {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 968px) {
  .branding-section {
    padding: 80px 0 60px;
  }

  .branding-header {
    margin-bottom: 60px;
  }

  .branding-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 60px;
  }

  /* En móvil, ajustar aspect ratios para mejor visualización */
  .branding-mockup:nth-child(2) .mockup-image,
  .branding-mockup:nth-child(3) .mockup-image {
    aspect-ratio: 3 / 4; /* Menos vertical en móvil */
  }

  .branding-features {
    gap: 16px;
    margin-bottom: 60px;
  }

  .branding-cta {
    padding: 40px 32px;
  }
}

@media (max-width: 768px) {
  .branding-section {
    padding: 60px 0 50px;
  }

  .branding-features {
    grid-template-columns: 1fr;
  }

  .personalization-modal-header {
    padding: 40px 30px 25px;
  }

  .personalization-modal-body {
    padding: 30px 25px;
  }

  /* Ajustes de highlights para móvil */
  .branding-mockup:nth-child(1) .mockup-logo-highlight {
    width: 140px;
    height: 60px;
  }

  .branding-mockup:nth-child(2) .mockup-logo-highlight {
    width: 85px;
    height: 85px;
  }

  .branding-mockup:nth-child(3) .mockup-logo-highlight {
    width: 100px;
    height: 50px;
  }

  .branding-mockup:nth-child(4) .mockup-logo-highlight {
    width: 160px;
    height: 70px;
  }
}

@media (max-width: 640px) {
  .mockup-wrapper {
    padding: 20px;
  }

  .logo-placeholder svg {
    width: 32px;
    height: 32px;
  }

  .logo-placeholder span {
    font-size: 10px;
  }

  .branding-cta {
    padding: 32px 24px;
  }

  .branding-cta h3 {
    font-size: 24px;
  }

  .personalization-modal-content {
    max-height: 95vh;
  }

  .personalization-modal-header {
    padding: 35px 20px 20px;
  }

  .personalization-modal-body {
    padding: 25px 20px;
  }
}

/* ========== PREVIEW BUTTONS ========== */
.preview-buttons-container {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.preview-buttons-container h4 {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  text-align: center;
}

.preview-buttons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.preview-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font);
}

.preview-btn:hover {
  border-color: var(--primary);
  background: rgba(0, 188, 212, 0.05);
  transform: translateY(-2px);
}

.preview-btn svg {
  color: var(--primary);
}

.preview-btn span {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* ========== PREVIEW MODAL ========== */
.preview-modal-large {
  max-width: 90vw;
  max-height: 90vh;
}

.preview-modal-image-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 500px;
  padding: 20px;
}

.preview-image-wrapper {
  position: relative;
  max-width: 100%;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-base-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  display: block;
}

/* ========== RESPONSIVE PREVIEW ========== */
@media (max-width: 768px) {
  .preview-buttons-grid {
    grid-template-columns: 1fr;
  }

  .preview-modal-large {
    max-width: 95vw;
  }

  .preview-image-wrapper {
    max-height: 60vh;
  }

  .preview-base-image {
    max-height: 60vh;
  }
}

/* ========== FORM HELPER ========== */
.form-helper {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ========== PREVIEW BUTTONS DESC ========== */
.preview-buttons-desc {
  font-size: 13px;
  color: var(--text-soft);
  text-align: center;
  margin-bottom: 16px;
}

/* ========== MEJOR ALINEACIÓN LOGO + TEXTO ========== */
.preview-logo-overlay img {
  display: block;
}

.preview-logo-overlay span {
  display: block;
}

/* Ajuste específico para logos cuadrados */
.preview-image-wrapper {
  position: relative;
  display: inline-block;
}

[data-theme="light"] .preview-logo-overlay span {
  color: var(--text);
}

/* ========== BOTÓN DE SOLICITAR DEMO EN PERSONALIZACIÓN ========== */
.personalization-cta-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.btn-request-demo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 188, 212, 0.3);
}

.btn-request-demo:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 188, 212, 0.4);
}

.btn-request-demo svg {
  flex-shrink: 0;
}

.personalization-cta-text {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .btn-request-demo {
    width: 100%;
    padding: 12px 24px;
    font-size: 15px;
  }
}
