/* ==========================================================================
   CEDEPRO - LANDING DE CONSENTIMIENTO DE IMAGEN
   DISEÑO EJECUTIVO / CORPORATIVO (FONDO BLANCO Y SOBRIO)
   ========================================================================== */

:root {
  /* Paleta Corporativa Ejecutiva */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-alt: #f1f5f9;
  --bg-legal: #f8fafc;
  
  /* Azul y Marino Institucional */
  --navy-dark: #091224;
  --navy-primary: #0f172a;
  --navy-light: #1e293b;
  --blue-accent: #1e40af;
  --blue-hover: #1d4ed8;
  
  /* Estados */
  --emerald-success: #059669;
  --emerald-bg: #ecfdf5;
  --emerald-border: #a7f3d0;
  
  /* Textos WCAG AAA */
  --text-heading: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  
  /* Bordes y Sombras */
  --border-light: #e2e8f0;
  --border-focus: #2563eb;
  --shadow-card: 0 20px 40px -10px rgba(15, 23, 42, 0.07), 0 0 1px 1px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 4px 6px -1px rgba(15, 23, 42, 0.05);

  /* Transiciones y Radios */
  --radius: 8px;
  --radius-sm: 6px;
  --transition: all 0.25s ease;
}

/* Reset y Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Tipografía */
h1, h2, h3, h4, .font-heading {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.02em;
}

/* Contenedor Principal */
.app-wrapper {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Encabezado Corporativo */
.header-brand {
  text-align: center;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* Contenedor Marino Elegante para el Logo Blanco */
.logo-container {
  background: var(--navy-dark);
  padding: 0.85rem 2rem;
  border-radius: var(--radius);
  box-shadow: 0 10px 25px -5px rgba(9, 18, 36, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-logo {
  height: 44px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy-primary);
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  padding: 0.4rem 1rem;
  border-radius: 999px;
}

.security-badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-success);
}

/* Tarjeta Principal */
.main-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 2.75rem 2.5rem;
  box-shadow: var(--shadow-card);
  position: relative;
}

/* Barra Superior Institucional */
.main-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #091224 0%, #1e40af 100%);
  border-radius: var(--radius) var(--radius) 0 0;
}

/* Encabezado del Formulario */
.card-header {
  margin-bottom: 2rem;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 1.5rem;
}

.card-title {
  font-size: 1.75rem;
  line-height: 1.25;
  color: var(--navy-dark);
  margin-bottom: 0.5rem;
}

.card-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Notificación de Registro Previo en este Dispositivo */
.cache-alert {
  display: none;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1.75rem;
  align-items: flex-start;
  gap: 1rem;
}

.cache-alert.active {
  display: flex;
}

.cache-alert__icon {
  color: var(--emerald-success);
  font-size: 1.3rem;
  flex-shrink: 0;
  line-height: 1;
}

.cache-alert__content {
  flex: 1;
  text-align: left;
}

.cache-alert__title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #166534;
  margin-bottom: 0.25rem;
}

.cache-alert__text {
  font-size: 0.85rem;
  color: #15803d;
  line-height: 1.45;
}

.cache-alert__btn {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--blue-accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-top: 0.4rem;
  text-decoration: underline;
}

/* Sección de Contexto */
.info-section {
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  text-align: left;
}

.info-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: #e2e8f0;
  color: var(--navy-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.info-content h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy-dark);
  margin-bottom: 0.25rem;
}

.info-content p {
  font-size: 0.88rem;
  color: var(--text-body);
  line-height: 1.5;
}

/* Declaración Legal */
.legal-box {
  background: var(--bg-legal);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--navy-dark);
  border-radius: var(--radius-sm);
  padding: 1.4rem 1.5rem;
  margin-bottom: 2rem;
  text-align: left;
}

.legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.legal-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy-dark);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.legal-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  background: #e2e8f0;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.legal-text {
  font-size: 0.86rem;
  color: var(--text-body);
  line-height: 1.6;
  text-align: justify;
}

/* Formulario */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
}

.form-group--full {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--navy-light);
}

.form-label .req {
  color: #dc2626;
}

.form-input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: #ffffff;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--navy-dark);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
  outline: none;
}

.form-input::placeholder {
  color: var(--text-subtle);
  font-weight: normal;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Tarjeta de Checkbox */
.consent-checkbox-card {
  background: #ffffff;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.4rem;
  margin: 1.75rem 0 2rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  text-align: left;
}

.consent-checkbox-card:hover {
  border-color: #cbd5e1;
  background: var(--bg-alt);
}

.consent-checkbox-card.checked {
  background: var(--emerald-bg);
  border-color: var(--emerald-success);
}

.custom-checkbox-wrapper {
  position: relative;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.custom-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid #94a3b8;
  border-radius: 4px;
  background: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.custom-checkbox:checked {
  background: var(--emerald-success);
  border-color: var(--emerald-success);
}

.custom-checkbox:checked::after {
  content: '✓';
  color: #ffffff;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1;
}

.consent-label-text {
  font-size: 0.9rem;
  color: var(--navy-dark);
  line-height: 1.5;
  font-weight: 600;
}

/* Botón de Envío */
.submit-btn-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.btn-submit {
  width: 100%;
  padding: 1.1rem 2rem;
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #ffffff;
  background: var(--navy-dark);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-shadow: 0 4px 12px rgba(9, 18, 36, 0.2);
}

.btn-submit:hover:not(:disabled) {
  background: var(--blue-accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(30, 64, 175, 0.3);
}

/* Deshabilitado */
.btn-submit:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-status-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-status-hint.ready {
  color: var(--emerald-success);
  font-weight: 600;
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Pantalla de Éxito */
.success-card {
  display: none;
  text-align: center;
  padding: 1.5rem 0.5rem;
  animation: fadeInSuccess 0.4s ease forwards;
}

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

.success-icon-badge {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--emerald-bg);
  border: 2px solid var(--emerald-success);
  color: var(--emerald-success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: bold;
  margin: 0 auto 1.5rem;
}

.success-title {
  font-size: 1.85rem;
  color: var(--navy-dark);
  margin-bottom: 0.5rem;
}

.success-text {
  font-size: 0.98rem;
  color: var(--text-body);
  max-width: 540px;
  margin: 0 auto 2rem;
}

/* Comprobante Digital */
.receipt-box {
  background: #ffffff;
  border: 1.5px solid var(--border-light);
  border-top: 3px solid var(--emerald-success);
  border-radius: var(--radius-sm);
  padding: 1.75rem;
  max-width: 520px;
  margin: 0 auto 2rem;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed var(--border-light);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.receipt-header h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--navy-dark);
}

.receipt-stamp {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--emerald-success);
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.receipt-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  margin-bottom: 0.6rem;
}

.receipt-label {
  color: var(--text-muted);
}

.receipt-val {
  font-weight: 600;
  color: var(--navy-dark);
}

.success-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn-secondary {
  padding: 0.8rem 1.5rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--navy-dark);
  background: #ffffff;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--bg-alt);
  border-color: #cbd5e1;
}

/* Footer */
.footer-simple {
  margin-top: 3rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-link:hover {
  color: var(--navy-dark);
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 640px) {
  .app-wrapper {
    padding: 1.5rem 1rem 3rem;
  }
  
  .main-card {
    padding: 1.75rem 1.25rem;
  }
  
  .card-title {
    font-size: 1.45rem;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .info-section {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .success-actions {
    flex-direction: column;
  }
}
