/**
 * Tramite Ultralight
 * Versión ultra-minimalista de la página de inicio de trámite
 * Mantiene coherencia visual con el sitio principal
 */

/* ===== MAIN SECTION ===== */
.tramite-ultralight {
  /* Ajuste para navbar fijo (42px top bar + 76px nav = 118px) */
  padding-top: calc(118px + 60px);
  padding-bottom: 80px;
  min-height: calc(100vh - 118px);
  background: linear-gradient(180deg,
      rgba(248, 250, 252, 1) 0%,
      rgba(241, 245, 249, 0.8) 100%);
  display: flex;
  align-items: center;
}

@media (max-width: 768px) {
  .tramite-ultralight {
    padding-top: calc(118px + 40px);
    padding-bottom: 60px;
  }
}

/* ===== WRAPPER ===== */
.tramite-ultralight__wrapper {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

/* ===== CARD CONTAINER ===== */
.tramite-ultralight__card {
  background: #ffffff;
  border-radius: 16px;
  padding: 48px;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08),
    0 1px 3px rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(226, 232, 240, 0.5);
  text-align: center;
}

@media (max-width: 576px) {
  .tramite-ultralight__card {
    padding: 32px 24px;
    border-radius: 12px;
  }
}

/* ===== BADGE ===== */
.tramite-ultralight__badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(30, 64, 175, 0.08));
  color: #1e40af;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 9999px;
  margin-bottom: 24px;
}

/* ===== TYPOGRAPHY ===== */
.tramite-ultralight__title {
  font-size: clamp(32px, 5vw, 42px);
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 16px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.tramite-ultralight__subtitle {
  font-size: 18px;
  color: #475569;
  margin: 0 0 32px;
  line-height: 1.5;
}

@media (max-width: 576px) {
  .tramite-ultralight__subtitle {
    font-size: 16px;
    margin-bottom: 28px;
  }
}

/* ===== FORM ===== */
.tramite-ultralight__form {
  margin-bottom: 28px;
}

/* Input Group - Mobile First */
.tramite-ultralight__input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

/* Row - Mobile First (stacked) */
.tramite-ultralight__row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* Triple row variant */
.tramite-ultralight__row--triple {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* Columns - Mobile First (full width) */
.tramite-ultralight__col-name,
.tramite-ultralight__col-email,
.tramite-ultralight__col-qty {
  width: 100%;
}

/* Tablet: 768px+ - 3 columns inline */
@media (min-width: 768px) {
  .tramite-ultralight__row--triple {
    flex-direction: row;
    align-items: stretch;
  }

  .tramite-ultralight__col-name {
    flex: 1.4;
    min-width: 140px;
  }

  .tramite-ultralight__col-email {
    flex: 2;
    min-width: 180px;
  }

  .tramite-ultralight__col-qty {
    flex: 1.2;
    min-width: 150px;
  }
}

/* Large desktop: wider proportions */
@media (min-width: 1024px) {
  .tramite-ultralight__col-name {
    flex: 1.5;
  }

  .tramite-ultralight__col-email {
    flex: 2.2;
  }

  .tramite-ultralight__col-qty {
    flex: 1.3;
  }
}

/* Input Field */
.tramite-ultralight__input {
  width: 100%;
  height: 56px;
  padding: 0 20px;
  font-size: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  color: #0f172a;
  transition: all 0.2s ease;
  font-family: 'Roboto', sans-serif;
}

.tramite-ultralight__input:hover {
  border-color: #cbd5e1;
}

.tramite-ultralight__input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.tramite-ultralight__input::placeholder {
  color: #94a3b8;
}

.tramite-ultralight__select {
  width: 100%;
  height: 56px;
  padding: 0 20px;
  font-size: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  color: #0f172a;
  transition: all 0.2s ease;
  font-family: 'Roboto', sans-serif;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
}

.tramite-ultralight__select:hover {
  border-color: #cbd5e1;
}

.tramite-ultralight__select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

@media (max-width: 576px) {
  .tramite-ultralight__select {
    height: 64px;
    font-size: 17px;
  }
}

/* Submit Button */
.tramite-ultralight__submit {
  height: 56px;
  padding: 0 32px;
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Roboto', sans-serif;
}

.tramite-ultralight__submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.tramite-ultralight__submit:active {
  transform: translateY(0);
}

.tramite-ultralight__submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 576px) {
  .tramite-ultralight__submit {
    width: 100%;
  }
}

@media (max-width: 576px) {
  .tramite-ultralight__input {
    width: 100%;
    max-width: 100%;
    flex: none;
    height: 64px !important;
    padding: 0 24px;
    font-size: 17px;
  }
}

/* Captcha container */
.tramite-ultralight__captcha {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

/* ===== TRUST SIGNALS ===== */
.tramite-ultralight__trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0;
  border-top: 1px solid rgba(226, 232, 240, 0.5);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tramite-ultralight__trust-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
}

.tramite-ultralight__trust-item svg {
  color: #3b82f6;
  flex-shrink: 0;
}

.tramite-ultralight__trust-divider {
  color: #cbd5e1;
  font-size: 12px;
}

@media (max-width: 576px) {
  .tramite-ultralight__trust {
    gap: 12px;
  }

  .tramite-ultralight__trust-divider {
    display: none;
  }

  .tramite-ultralight__trust-item {
    font-size: 13px;
  }
}

/* ===== FOOTER LINK ===== */
.tramite-ultralight__footer-link {
  margin: 0;
  font-size: 14px;
  color: #64748b;
}

.tramite-ultralight__footer-link a {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.tramite-ultralight__footer-link a:hover {
  color: #1e40af;
  text-decoration: underline;
}

/* ===== ACCESSIBILITY ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ===== FORM VALIDATION STYLES ===== */
.tramite-ultralight__input.has-error {
  border-color: #ef4444;
  animation: shake 0.3s ease-in-out;
}

/* Si el contenedor del campo recibe has-error/has-success del plugin, reflejar en el input */
.tramite-ultralight__input-group.has-error .tramite-ultralight__input {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.tramite-ultralight__input-group.has-success .tramite-ultralight__input {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-2px);
  }

  20%,
  40%,
  60%,
  80% {
    transform: translateX(2px);
  }
}

.tramite-ultralight__input.has-error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Error container estilizado - completamente oculto cuando está vacío */
.tramite-ultralight__error-container {
  display: none;
  min-height: 0;
  margin: 0;
  padding: 0;
  transition: all 0.3s ease;
  overflow: hidden;
  background: none;
  border: none;
}

.tramite-ultralight__error-container.is-visible {
  display: block;
  min-height: 24px;
  margin-top: 8px;
}

.tramite-ultralight__error-container .help-block {
  display: none !important;
}

small.tramite-ultralight__error-message {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #fecaca;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

small.tramite-ultralight__error-message svg {
  flex-shrink: 0;
  color: #dc2626;
}

/* Success state */
.tramite-ultralight__input.has-success {
  border-color: #10b981;
}

.tramite-ultralight__input.has-success:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* FormValidation overrides */
.form-group.has-error .help-block {
  display: none !important;
  /* Ocultamos el help-block default */
}

/* Asegurar que el contenedor NO tenga background cuando está vacío */
.tramite-ultralight__input-wrapper {
  background: transparent;
}

/* ===== LOADING STATE ===== */
.tramite-ultralight__submit .fa-spinner {
  margin-right: 8px;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (min-width: 1200px) {
  .tramite-ultralight__wrapper {
    max-width: 600px;
  }

  .tramite-ultralight__card {
    padding: 56px;
  }
}

/* ===================================================================
   PHASE 2: WHATSAPP FIELD STYLING
   Modern glassmorphism design with country selector
   =================================================================== */

/* ===== DUAL ROW LAYOUT (Name+Email, WhatsApp+Qty) ===== */
.tramite-ultralight__row--dual {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

@media (min-width: 768px) {
  .tramite-ultralight__row--dual {
    flex-direction: row;
    align-items: stretch;
  }

  /* First row: Name (40%) + Email (60%) */
  .tramite-ultralight__row--dual:first-child .tramite-ultralight__col-name {
    flex: 1.2;
    min-width: 180px;
  }

  .tramite-ultralight__row--dual:first-child .tramite-ultralight__col-email {
    flex: 2;
    min-width: 220px;
  }

  /* Second row: WhatsApp (65%) + Qty (35%) */
  .tramite-ultralight__row--dual:last-child .tramite-ultralight__col-whatsapp {
    flex: 2;
    min-width: 260px;
  }

  .tramite-ultralight__row--dual:last-child .tramite-ultralight__col-qty {
    flex: 1;
    min-width: 160px;
  }
}

/* ===== LABELS ===== */
.tramite-ultralight__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.tramite-ultralight__label-icon {
  color: #3b82f6;
  flex-shrink: 0;
}

/* ===== WHATSAPP FIELD WRAPPER ===== */
.tramite-ultralight__phone-wrapper {
  position: relative;
  display: flex;
  align-items: stretch;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  height: 56px;
}

.tramite-ultralight__phone-wrapper:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.tramite-ultralight__phone-wrapper:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: #fafbfc;
}

/* Error state */
.tramite-ultralight__phone-wrapper.has-error {
  border-color: #ef4444;
  animation: shake 0.3s ease-in-out;
}

.tramite-ultralight__phone-wrapper.has-error:focus-within {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Success state */
.tramite-ultralight__phone-wrapper.has-success {
  border-color: #10b981;
}

.tramite-ultralight__phone-wrapper.has-success:focus-within {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* ===== COUNTRY SELECTOR (LEFT SIDE) ===== */
.tramite-ultralight__phone-selector-container {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 140px;
  width: 140px;
  min-width: 130px;
  border-right: 2px solid #e2e8f0;
  background: linear-gradient(180deg, #fafbfc 0%, #f8fafc 100%);
  transition: background 0.2s ease;
  overflow: visible;
}

.tramite-ultralight__phone-wrapper:focus-within .tramite-ultralight__phone-selector-container {
  background: #ffffff;
  border-right-color: #cbd5e1;
}

.tramite-ultralight__phone-selector {
  width: 100%;
  height: 100%;
  display: block;
  padding: 0 28px 0 12px;
  border: none;
  background: transparent;
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  text-align-last: left;
  direction: ltr;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  outline: none;
  line-height: 1;
}

.tramite-ultralight__phone-selector:focus {
  outline: none;
}

/* Dropdown icon for selector */
.tramite-ultralight__phone-selector-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
  transition: transform 0.2s ease;
}

.tramite-ultralight__phone-selector:focus + .tramite-ultralight__phone-selector-icon {
  transform: translateY(-50%) rotate(180deg);
}

/* ===== PHONE NUMBER INPUT (RIGHT SIDE) ===== */
.tramite-ultralight__phone-input {
  flex: 1;
  padding: 0 16px;
  border: none;
  background: transparent;
  color: #0f172a;
  font-size: 16px;
  font-weight: 500;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  outline: none;
  transition: all 0.2s ease;
}

.tramite-ultralight__phone-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.tramite-ultralight__phone-input:focus::placeholder {
  color: #cbd5e1;
}

/* Dial code prefix (visual hint, optional) */
.tramite-ultralight__phone-prefix {
  position: absolute;
  left: 105px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tramite-ultralight__phone-input:placeholder-shown + .tramite-ultralight__phone-prefix {
  opacity: 1;
}

/* ===== HELPER TEXT ===== */
.tramite-ultralight__helper-text {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #94a3b8;
  font-weight: 400;
  line-height: 1.4;
}

/* ===== SELECT WRAPPER (Quantity field) ===== */
.tramite-ultralight__select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.tramite-ultralight__select-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
  transition: transform 0.2s ease;
}

.tramite-ultralight__select:focus + .tramite-ultralight__select-icon {
  transform: translateY(-50%) rotate(180deg);
}

/* ===== MOBILE OPTIMIZATIONS ===== */
@media (max-width: 576px) {
  .tramite-ultralight__phone-wrapper {
    height: 64px;
  }

  .tramite-ultralight__phone-selector {
    font-size: 15px;
  }

  .tramite-ultralight__phone-input {
    font-size: 17px;
    padding: 0 16px;
  }

  .tramite-ultralight__label {
    font-size: 12px;
  }

  .tramite-ultralight__helper-text {
    font-size: 11px;
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  .tramite-ultralight__phone-wrapper,
  .tramite-ultralight__phone-selector,
  .tramite-ultralight__phone-input {
    transition: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .tramite-ultralight__phone-wrapper {
    border-width: 3px;
  }

  .tramite-ultralight__phone-wrapper:focus-within {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
  }
}

/* ===== GLASSMORPHISM ENHANCEMENT (Optional - Subtle effects) ===== */
/* Subtle gradient overlay on phone wrapper */
.tramite-ultralight__phone-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(59, 130, 246, 0.02) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.tramite-ultralight__phone-wrapper:focus-within::before {
  opacity: 1;
}

/* ===================================================================
   TOGGLE: "Ya soy cliente" - Recuperar gestiones
   =================================================================== */

/* Toggle container - Always horizontal like tabs */
.tramite-toggle {
  display: flex !important;
  flex-direction: row !important;
  gap: 4px;
  margin-bottom: 20px;
  background: #f0f2f5;
  padding: 4px;
  border-radius: 12px;
}

.tramite-toggle__option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
}

.tramite-toggle__option:hover {
  color: #334155;
}

/* Active state - white pill */
.tramite-toggle__option:has(input:checked),
.tramite-toggle__option.active-tab {
  background: #ffffff;
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}

/* Hide radio buttons */
.tramite-toggle__option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Helper text for existing clients */
.tramite-helper {
  background: #ebf8ff;
  border: 1px solid #90cdf4;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #2c5282;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tramite-helper span {
  font-size: 18px;
}

/* Success message after email sent */
.tramite-success {
  text-align: center;
  padding: 40px 20px;
}

.tramite-success__icon {
  font-size: 56px;
  display: block;
  margin-bottom: 16px;
}

.tramite-success__title {
  font-size: 24px;
  font-weight: 700;
  color: #1a365d;
  margin: 0 0 12px 0;
}

.tramite-success__text {
  font-size: 16px;
  color: #475569;
  margin: 0 0 16px 0;
  line-height: 1.5;
}

.tramite-success__hint {
  font-size: 14px;
  color: #64748b;
  margin: 0;
}

.tramite-success__hint a {
  color: #25D366;
  text-decoration: none;
  font-weight: 500;
}

.tramite-success__hint a:hover {
  text-decoration: underline;
}

/* Inline error message */
.tramite-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 12px;
  font-size: 14px;
  color: #dc2626;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.2s ease;
}

.tramite-error span {
  flex-shrink: 0;
}

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

/* Smooth transition for hidden fields */
[data-new-client-only] {
  transition: opacity 0.2s ease, max-height 0.3s ease;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .tramite-toggle {
    flex-direction: column;
    gap: 8px;
  }

  .tramite-toggle__option {
    padding: 14px 16px;
  }

  .tramite-success {
    padding: 30px 16px;
  }

  .tramite-success__icon {
    font-size: 48px;
  }

  .tramite-success__title {
    font-size: 20px;
  }
}
