:root {
  --primary-cyan: #009cb9;
  --primary-blue: #004576;
  --popular-orange: #ff7800;
  --popular-orange-hover: #e86a00;
  --popular-navy: #00305a;
  --disabled-gray: #a6a6a6;
  --keypad-bg: #edf2f7;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html {
  background-color: #009cb9;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #009cb9;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  color: #ffffff;
  overflow-x: hidden;
}

/* 9:16 Mobile Canvas Container */
.mobile-frame {
  width: 100%;
  max-width: 412px;
  height: 100vh;
  height: 100dvh;
  max-height: 870px;
  background: linear-gradient(180deg, #009cb9 0%, #0087a9 30%, #005f8d 68%, #003766 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

@media (max-width: 500px) {
  body {
    background-color: #009cb9;
    padding: 0;
  }
  .mobile-frame {
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (min-width: 501px) {
  .mobile-frame {
    border-radius: 38px;
  }
}

/* Hide scrollbars across all browsers */
.screen, .mobile-frame, * {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  display: none;
}

/* Screen management */
.screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateX(25px);
  transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1), transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
  z-index: 10;
}

/* Gradient screens background (Screen 1 & 2) */
.theme-gradient {
  background: linear-gradient(180deg, #009cb9 0%, #0087a9 30%, #005f8d 68%, #003766 100%);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 20px calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Header with Popular logo */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  margin-top: 4px;
  margin-bottom: 18px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto;
  transform: translateX(14px);
}

.popular-symbol-img {
  width: 42px;
  height: 42px;
  border: 1.5px solid #ffffff;
  border-radius: 2px;
  object-fit: cover;
  display: block;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.popular-text {
  font-size: 26px;
  font-weight: 800;
  font-style: italic;
  color: #ffffff;
  letter-spacing: 0.5px;
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  line-height: 1;
}

.close-btn {
  background: none;
  border: none;
  color: #ffffff;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}
.close-btn:active {
  transform: scale(0.9);
}

/* Navigation tabs */
.nav-tabs-popular {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 0 2px;
}

.nav-tab-item {
  color: rgba(255, 255, 255, 0.95);
  font-size: 16.5px;
  font-weight: 500;
  padding: 8px 20px;
  border-radius: 30px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  background: transparent;
  border: none;
}

.nav-tab-item.active {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
  font-weight: 600;
  color: #ffffff;
}

/* Experience announcement banner */
.experience-card {
  background: rgba(255, 255, 255, 0.17);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 22px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.experience-icon {
  flex-shrink: 0;
  width: 52px;
  height: 44px;
}

.experience-text {
  font-size: 14.5px;
  line-height: 1.35;
  color: #ffffff;
  margin: 0;
  font-weight: 400;
  letter-spacing: -0.1px;
}

.experience-text strong {
  font-weight: 700;
}

/* Screen 1 Title */
.greeting-title {
  font-size: 32px;
  font-weight: 400;
  text-align: center;
  margin-top: 10px;
  margin-bottom: 30px;
  color: #ffffff;
}

.greeting-title strong {
  font-weight: 700;
}

/* Screen 2 Title */
.form-title {
  font-size: 30px;
  font-weight: 400;
  text-align: center;
  margin-top: -2px;
  margin-bottom: 22px;
  color: #ffffff;
  letter-spacing: -0.3px;
}

/* Orange CTA button */
.btn-popular-orange {
  background: var(--popular-orange);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  padding: 14px 20px;
  width: 100%;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 120, 0, 0.35);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-popular-orange:hover,
.btn-popular-orange:focus {
  background: var(--popular-orange-hover);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(255, 120, 0, 0.45);
}

.btn-popular-orange:active {
  transform: scale(0.985);
}

/* Inactive / Disabled button */
.btn-popular-disabled {
  background: #9ea4a9 !important;
  color: #f0f0f0 !important;
  box-shadow: none !important;
  cursor: not-allowed;
}

/* Input fields */
.popular-input-group {
  margin-bottom: 14px;
  position: relative;
}

.popular-input {
  width: 100%;
  height: 52px;
  background: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 16px;
  color: #1a1a1a;
  outline: none;
  transition: box-shadow 0.2s;
  font-family: inherit;
  user-select: text;
}

.popular-input::placeholder {
  color: #9c9c9c;
  font-weight: 400;
}

.popular-input:focus {
  box-shadow: 0 0 0 2.5px rgba(255, 120, 0, 0.85);
}

.input-icon-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: #555555;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-icon-btn:active {
  transform: translateY(-50%) scale(0.9);
}

/* Links on Screen 1 & Screen 2 */
.forgot-link {
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  display: block;
  text-align: center;
  margin-top: 16px;
  margin-bottom: 10px;
}

.footer-register {
  margin-top: auto;
  text-align: center;
  padding-top: 12px;
}

.register-link {
  color: #ffffff;
  font-size: 14.5px;
  text-decoration: none;
  display: block;
  margin-bottom: 18px;
}

.register-link strong {
  font-weight: 700;
}

.security-tips {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #ffffff;
  font-size: 14.5px;
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 6px;
}

.security-icon-circle {
  width: 30px;
  height: 30px;
  border: 1.8px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================================
   SCREEN 3: TOKEN POPULAR (Light Theme)
   ========================================= */
.theme-light {
  background: #ffffff;
  color: #1a1a1a;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.token-top-bar {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #edf1f7;
  position: relative;
}

.token-back-btn {
  background: none;
  border: none;
  color: var(--popular-orange);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  position: absolute;
  left: 14px;
}

.token-title {
  font-size: 20px;
  font-weight: 800;
  color: #00305a;
  width: 100%;
  text-align: center;
  margin: 0;
  letter-spacing: -0.2px;
}

.token-content-area {
  padding: 18px 20px 10px;
  flex: 1;
  overflow-y: auto;
}

.token-instruction {
  font-size: 15px;
  line-height: 1.45;
  color: #002244;
  margin-bottom: 20px;
  letter-spacing: -0.1px;
}

.token-instruction strong {
  font-weight: 800;
}

/* Orange bordered token input */
.token-input-card {
  border: 2px solid var(--popular-orange);
  border-radius: 12px;
  height: 54px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  background: #ffffff;
  cursor: pointer;
  position: relative;
}

.token-display-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  letter-spacing: 7px;
  font-size: 24px;
  font-weight: 700;
  color: #00305a;
  font-family: 'Roboto Mono', 'SF Mono', Consolas, monospace;
  padding-left: 8px;
}

.blinking-cursor {
  display: inline-block;
  width: 2.5px;
  height: 26px;
  background-color: #0084ff;
  animation: blink 1s infinite;
  margin-left: 2px;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.token-paste-btn {
  background: none;
  border: none;
  color: var(--popular-orange);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-token-submit {
  background: #e9f0f8;
  color: #557597;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
  padding: 14px 20px;
  width: 100%;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: -0.2px;
}

.btn-token-submit.ready {
  background: var(--popular-orange);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(255, 120, 0, 0.35);
}

/* Keypad section */
.keypad-container {
  background: #dfe6ee;
  padding: 10px 12px 18px;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.key-btn {
  background: #ffffff;
  border: none;
  border-radius: 8px;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.1s ease;
  user-select: none;
}

.key-btn:active {
  background: #edf2f7;
  transform: scale(0.96);
}

.key-num {
  font-size: 22px;
  font-weight: 700;
  color: #000000;
  line-height: 1;
}

.key-alpha {
  font-size: 9.5px;
  font-weight: 700;
  color: #000000;
  letter-spacing: 2px;
  margin-top: 2px;
  text-transform: uppercase;
  padding-left: 2px;
}

.key-btn.empty-key {
  background: transparent;
  box-shadow: none;
  cursor: default;
}

.key-btn.backspace-key {
  background: transparent;
  box-shadow: none;
  color: #000000;
}

.key-btn.backspace-key:active {
  transform: scale(0.9);
  background: rgba(0,0,0,0.05);
}

/* =========================================
   SCREEN 4: MODAL POPUP ERROR DIALOG
   ========================================= */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  border-radius: 26px;
  padding: 30px 24px 26px;
  width: 100%;
  max-width: 350px;
  text-align: left;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.alert-circle-icon {
  width: 56px;
  height: 56px;
  border: 3.5px solid var(--popular-orange);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.alert-exclamation {
  font-size: 32px;
  font-weight: 800;
  color: var(--popular-orange);
  line-height: 1;
}

.modal-title {
  font-size: 25px;
  font-weight: 800;
  color: #002244;
  line-height: 1.22;
  margin-bottom: 12px;
  letter-spacing: -0.4px;
}

.modal-message {
  font-size: 16.5px;
  color: #4b5869;
  margin-bottom: 26px;
  font-weight: 400;
}

/* =========================================
   SCREEN 5: DISPOSITIVO EN VALIDACIÓN
   ========================================= */
.validation-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  padding-top: 10px;
}

.validation-icon-container {
  position: relative;
  width: 86px;
  height: 86px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.validation-icon-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.35) 0%, rgba(0, 156, 185, 0.1) 70%, transparent 100%);
  animation: pulseGlow 2s ease-in-out infinite alternate;
}

.validation-icon-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0087a9 0%, #004576 100%);
  border: 3px solid #00e5ff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 229, 255, 0.35);
  position: relative;
  z-index: 2;
}

.validation-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #e0f7fa;
  margin-bottom: 16px;
  backdrop-filter: blur(8px);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #00e5ff;
  box-shadow: 0 0 8px #00e5ff;
  animation: blink 1.2s infinite;
}

.validation-hero-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
  color: #ffffff;
  margin-bottom: 14px;
  letter-spacing: -0.4px;
}

.validation-highlight-card {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  width: 100%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.validation-main-message {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  color: #ffffff;
  margin: 0;
}

.validation-details-box {
  width: 100%;
  background: rgba(0, 36, 68, 0.45);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 14px 16px;
  margin-bottom: 18px;
  text-align: left;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: 13.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.detail-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.detail-item:first-child {
  padding-top: 0;
}

.detail-label {
  color: rgba(255, 255, 255, 0.75);
}

.detail-val {
  font-weight: 600;
  color: #ffffff;
}

.detail-val.status-active {
  color: #38bdf8;
}

.security-notice-note {
  font-size: 12.5px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 18px;
  padding: 0 4px;
}

.loader-status-text {
  margin-top: 22px;
  font-size: 15px;
  font-weight: 500;
  color: #ffffff;
  letter-spacing: 0.3px;
  text-align: center;
  animation: pulseGlow 1.8s ease-in-out infinite alternate;
}

/* Success Toast (Desactivado) */

/* ========================================================
   SUPER AESTHETIC MODULE LOADER (Entre Módulos)
   ======================================================== */
.module-loader {
  position: absolute;
  inset: 0;
  z-index: 150;
  background: radial-gradient(circle at 50% 38%, rgba(0, 75, 122, 0.95) 0%, rgba(0, 24, 48, 0.98) 100%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.module-loader.active {
  opacity: 1;
  pointer-events: auto;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  transform: scale(0.92);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.module-loader.active .loader-content {
  transform: scale(1);
}

/* Orbital Rings & Logo */
.loader-orbital-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.orbital-glow {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.45) 0%, rgba(0, 156, 185, 0.18) 50%, transparent 70%);
  filter: blur(14px);
  animation: pulseGlow 1.8s ease-in-out infinite alternate;
}

.orbital-ring {
  position: absolute;
  border-radius: 50%;
  box-sizing: border-box;
}

.orbital-ring.ring-outer {
  inset: 0;
  border: 2.5px solid transparent;
  border-top-color: #00e5ff;
  border-right-color: #009cb9;
  border-bottom-color: rgba(0, 229, 255, 0.3);
  filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.85));
  animation: spinClockwise 1.05s cubic-bezier(0.5, 0.15, 0.5, 0.85) infinite;
}

.orbital-ring.ring-inner {
  inset: 9px;
  border: 2px solid transparent;
  border-bottom-color: #38bdf8;
  border-left-color: rgba(255, 255, 255, 0.8);
  animation: spinCounterClockwise 1.35s linear infinite;
}

.loader-logo-badge {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 13px;
  background: #00223d;
  border: 2px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), 0 0 20px rgba(0, 229, 255, 0.4);
  animation: subtleBounce 2s ease-in-out infinite;
}

.loader-symbol-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@keyframes spinClockwise {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

@keyframes pulseGlow {
  0% { opacity: 0.45; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1.12); }
}

@keyframes subtleBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
