/* ==============================================================================
   SATURCOM SOPORTE INTELIGENTE - SISTEMA DE DISENO UI/UX
   PORTAL OFICIAL DE ENROLAMIENTO TELEGRAM (telegram.saturcom.mx)
   ESCUADRON SERIE W | DIRECTIVA DEC-086 / DEC-098
   DISENADOR: W03 (UI/UX & Experiencia Digital)
   ============================================================================== */

:root {
  /* Paleta Cromatica Soberana */
  --stc-bg-deep: #050b14;
  --stc-bg-surface: #0a1424;
  --stc-card-bg: rgba(12, 25, 41, 0.85);
  --stc-card-border: rgba(255, 255, 255, 0.08);
  --stc-card-border-focus: rgba(0, 210, 211, 0.4);

  --stc-navy-950: #070e18;
  --stc-navy-900: #0c1929;
  --stc-navy-800: #12263f;
  --stc-navy-700: #1a365d;
  --stc-navy-600: #2b4c7e;

  --stc-cyan-500: #00adb5;
  --stc-cyan-400: #00d2d3;
  --stc-cyan-glow: rgba(0, 210, 211, 0.25);
  
  --stc-blue-500: #0284c7;
  --stc-blue-600: #0369a1;
  --stc-telegram-blue: #229ED9;
  --stc-telegram-hover: #1b8ec5;

  --stc-text-primary: #f8fafc;
  --stc-text-secondary: #94a3b8;
  --stc-text-muted: #64748b;

  --stc-success: #10b981;
  --stc-success-glow: rgba(16, 185, 129, 0.2);
  --stc-error: #ef4444;
  --stc-error-glow: rgba(239, 68, 68, 0.2);
  --stc-warning: #f59e0b;

  /* Tipografias */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Elevaciones & Sombras */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 20px 40px -15px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--stc-card-border);
  --shadow-btn-primary: 0 8px 24px -4px rgba(0, 173, 181, 0.4);
  --shadow-btn-telegram: 0 10px 28px -4px rgba(34, 158, 217, 0.45);

  /* Transiciones */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 350ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Bordes */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;
}

/* ==============================================================================
   RESET Y BASE
   ============================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background-color: var(--stc-bg-deep);
}

body {
  font-family: var(--font-main);
  background-color: var(--stc-bg-deep);
  color: var(--stc-text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
  padding: 24px 16px;
}

/* ==============================================================================
   ILUMINACION AMBIENTAL DE FONDO
   ============================================================================== */
.background-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

.bg-glow-1 {
  width: 480px;
  height: 480px;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, var(--stc-navy-600) 0%, rgba(11, 25, 44, 0) 70%);
}

.bg-glow-2 {
  width: 360px;
  height: 360px;
  bottom: -80px;
  right: 5%;
  background: radial-gradient(circle, var(--stc-cyan-500) 0%, rgba(0, 173, 181, 0) 70%);
  opacity: 0.15;
}

/* ==============================================================================
   ESTRUCTURA PRINCIPAL Y CONTENEDOR
   ============================================================================== */
.portal-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==============================================================================
   CABECERA INSTITUCIONAL
   ============================================================================== */
.portal-header {
  text-align: center;
  margin-bottom: 24px;
  width: 100%;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(2, 132, 199, 0.12);
  border: 1px solid rgba(0, 210, 211, 0.25);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--stc-cyan-400);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.brand-badge-icon {
  width: 14px;
  height: 14px;
}

.brand-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--stc-text-primary);
  line-height: 1.2;
  margin-bottom: 6px;
  background: linear-gradient(180deg, #ffffff 30%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.95rem;
  color: var(--stc-text-secondary);
  font-weight: 400;
}

/* ==============================================================================
   TARJETA CENTRAL DE REGISTRO
   ============================================================================== */
.portal-card {
  width: 100%;
  background: var(--stc-card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--stc-card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: border-color var(--transition-normal);
}

.card-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: rgba(7, 14, 24, 0.6);
  border-bottom: 1px solid var(--stc-card-border);
  font-size: 0.75rem;
  color: var(--stc-text-muted);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--stc-success);
  box-shadow: 0 0 8px var(--stc-success);
}

.status-governance {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--stc-text-secondary);
}

/* ==============================================================================
   SECCIONES Y FORMULARIO
   ============================================================================== */
.section-container {
  padding: 32px 28px;
}

@media (min-width: 640px) {
  .section-container {
    padding: 36px 36px;
  }
}

.section-intro {
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--stc-text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.section-desc {
  font-size: 0.88rem;
  color: var(--stc-text-secondary);
  line-height: 1.5;
}

/* ==============================================================================
   CAMPOS DE FORMULARIO
   ============================================================================== */
.form-group {
  margin-bottom: 20px;
  position: relative;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (min-width: 640px) {
  .form-row {
    flex-direction: row;
    gap: 16px;
  }
  .flex-1 {
    flex: 1;
  }
}

.label-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 7px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--stc-text-primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.required-mark {
  color: var(--stc-cyan-400);
  font-weight: 700;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--stc-text-muted);
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-slot {
  position: absolute;
  left: 14px;
  color: var(--stc-text-muted);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: color var(--transition-fast);
}

.input-icon-slot svg {
  width: 18px;
  height: 18px;
}

.input-status-slot {
  position: absolute;
  right: 14px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.form-input {
  width: 100%;
  height: 48px;
  padding: 10px 42px 10px 42px;
  background: rgba(18, 38, 63, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--stc-text-primary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
  -webkit-appearance: none;
}

.form-input::placeholder {
  color: var(--stc-text-muted);
  font-weight: 400;
}

.form-input:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(18, 38, 63, 0.6);
}

.form-input:focus {
  outline: none;
  border-color: var(--stc-cyan-400);
  background: rgba(18, 38, 63, 0.75);
  box-shadow: 0 0 0 3px var(--stc-cyan-glow);
}

.form-input:focus + .input-icon-slot,
.input-container:focus-within .input-icon-slot {
  color: var(--stc-cyan-400);
}

/* Estilo Monospace para Codigo de Autorizacion */
.code-input {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

/* Estados de Validacion Visual */
.form-input.is-valid {
  border-color: var(--stc-success);
}

.form-input.is-valid:focus {
  box-shadow: 0 0 0 3px var(--stc-success-glow);
}

.form-input.is-invalid {
  border-color: var(--stc-error);
}

.form-input.is-invalid:focus {
  box-shadow: 0 0 0 3px var(--stc-error-glow);
}

.helper-text {
  display: block;
  font-size: 0.75rem;
  color: var(--stc-text-muted);
  margin-top: 5px;
}

.feedback-msg {
  font-size: 0.75rem;
  margin-top: 5px;
  min-height: 16px;
  display: none;
}

.feedback-msg.error {
  display: block;
  color: var(--stc-error);
}

.feedback-msg.success {
  display: block;
  color: var(--stc-success);
}

/* ==============================================================================
   AVISO DE SEGURIDAD
   ============================================================================== */
.security-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(18, 38, 63, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 24px;
  font-size: 0.78rem;
  color: var(--stc-text-secondary);
  line-height: 1.45;
}

.notice-icon {
  width: 18px;
  height: 18px;
  color: var(--stc-cyan-400);
  flex-shrink: 0;
  margin-top: 1px;
}

/* ==============================================================================
   BANNER DE ALERTAS
   ============================================================================== */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 0.85rem;
  margin-bottom: 20px;
  animation: fadeInDown var(--transition-fast) ease-out;
}

.alert-banner[hidden] {
  display: none;
}

.alert-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--stc-error);
}

/* ==============================================================================
   BOTONES
   ============================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-main);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
  user-select: none;
}

.btn-primary {
  width: 100%;
  height: 52px;
  background: linear-gradient(135deg, var(--stc-cyan-500) 0%, var(--stc-blue-500) 100%);
  color: #ffffff;
  font-size: 0.95rem;
  box-shadow: var(--shadow-btn-primary);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--stc-cyan-400) 0%, var(--stc-blue-600) 100%);
  box-shadow: 0 10px 28px -4px rgba(0, 173, 181, 0.55);
  transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn-icon-arrow {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-fast);
}

.btn-primary:hover .btn-icon-arrow {
  transform: translateX(4px);
}

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

.btn.is-loading .btn-spinner {
  display: inline-block;
}

.btn.is-loading .btn-icon-arrow {
  display: none;
}

/* ==============================================================================
   PANTALLA DE EXITO
   ============================================================================== */
.success-badge-container {
  text-align: center;
  margin-bottom: 26px;
}

.success-icon-pulse {
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.3);
  animation: pulseGlow 2.5s infinite ease-in-out;
}

.success-check-icon {
  width: 34px;
  height: 34px;
  color: var(--stc-success);
}

.success-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--stc-text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.success-subtitle {
  font-size: 0.9rem;
  color: var(--stc-text-secondary);
}

/* ==============================================================================
   TARJETA DE FOLIO OFICIAL CLI-XXXX
   ============================================================================== */
.folio-card {
  background: rgba(7, 14, 24, 0.7);
  border: 1px solid rgba(0, 210, 211, 0.3);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 22px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
}

.folio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.folio-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--stc-cyan-400);
}

.folio-badge-live {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  background: rgba(16, 185, 129, 0.2);
  color: var(--stc-success);
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.folio-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: rgba(18, 38, 63, 0.45);
  border: 1px dashed rgba(0, 210, 211, 0.35);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

.folio-number {
  font-family: var(--font-mono);
  font-size: 1.95rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #ffffff;
  text-shadow: 0 0 16px var(--stc-cyan-glow);
}

.btn-copy-folio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: var(--stc-text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-copy-folio:hover {
  background: rgba(0, 210, 211, 0.15);
  border-color: var(--stc-cyan-400);
  color: var(--stc-cyan-400);
}

.icon-copy {
  width: 16px;
  height: 16px;
}

.folio-note {
  font-size: 0.75rem;
  color: var(--stc-text-muted);
}

/* ==============================================================================
   RESUMEN DE CUENTA
   ============================================================================== */
.summary-card {
  background: rgba(18, 38, 63, 0.35);
  border: 1px solid var(--stc-card-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.summary-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--stc-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.summary-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.summary-row dt {
  color: var(--stc-text-muted);
  font-weight: 500;
}

.summary-row dd {
  color: var(--stc-text-primary);
  font-weight: 600;
  text-align: right;
}

.badge-role {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(2, 132, 199, 0.2);
  color: var(--stc-cyan-400);
  border: 1px solid rgba(0, 210, 211, 0.3);
  font-size: 0.75rem;
}

/* ==============================================================================
   BOTON PROMINENTE DE 1 CLIC: TELEGRAM
   ============================================================================== */
.action-card {
  text-align: center;
  margin-bottom: 20px;
}

.action-prompt {
  margin-bottom: 16px;
}

.action-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--stc-text-primary);
  margin-bottom: 4px;
}

.action-desc {
  font-size: 0.85rem;
  color: var(--stc-text-secondary);
}

.btn-telegram {
  width: 100%;
  height: 56px;
  background: linear-gradient(135deg, var(--stc-telegram-blue) 0%, #1579ab 100%);
  color: #ffffff;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-btn-telegram);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all var(--transition-normal);
}

.btn-telegram:hover {
  background: linear-gradient(135deg, #2bb2f4 0%, var(--stc-telegram-hover) 100%);
  box-shadow: 0 14px 34px -4px rgba(34, 158, 217, 0.6);
  transform: translateY(-2px);
}

.btn-telegram:active {
  transform: translateY(0);
}

.telegram-icon {
  width: 26px;
  height: 26px;
}

.telegram-btn-label {
  font-weight: 700;
}

.direct-link-hint {
  font-size: 0.78rem;
  color: var(--stc-text-muted);
  margin-top: 14px;
}

.direct-link-hint code {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.35);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  color: var(--stc-cyan-400);
  border: 1px solid rgba(0, 210, 211, 0.2);
}

.reset-wrapper {
  text-align: center;
}

.btn-link {
  background: none;
  border: none;
  color: var(--stc-text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition-fast);
}

.btn-link:hover {
  color: var(--stc-cyan-400);
}

/* ==============================================================================
   FOOTER INSTITUCIONAL
   ============================================================================== */
.portal-footer {
  margin-top: 28px;
  text-align: center;
  color: var(--stc-text-muted);
  font-size: 0.78rem;
  width: 100%;
}

.footer-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.badge-item {
  color: var(--stc-text-secondary);
  font-weight: 500;
}

.badge-separator {
  color: var(--stc-text-muted);
  opacity: 0.5;
}

.footer-copyright {
  margin-bottom: 4px;
  font-weight: 500;
}

.footer-meta {
  font-size: 0.72rem;
  opacity: 0.75;
}

/* ==============================================================================
   ANIMACIONES
   ============================================================================== */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.3);
  }
  50% {
    box-shadow: 0 0 32px rgba(16, 185, 129, 0.5);
    border-color: rgba(16, 185, 129, 0.7);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==============================================================================
   ACCESIBILIDAD Y REDUCED MOTION
   ============================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
