/**
 * Tramite WhatsApp Field - Phase 2 CSS
 * Modern glassmorphism design with country selector
 * Separated file to avoid parsing issues
 */

/* ===== 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;
  /* Specific transitions to avoid animating width/layout properties */
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  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 110px;
  width: 110px;
  min-width: 100px;
  border-right: 2px solid #e2e8f0;
  background: linear-gradient(180deg, #fafbfc 0%, #f8fafc 100%);
  transition: background 0.2s ease;
  box-sizing: border-box;
}

.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;
  line-height: 56px;
  cursor: pointer;
  text-align: left;
  text-align-last: left;
  direction: ltr;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  outline: none;
  box-sizing: border-box;
  margin: 0;
}

.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;
}

/* Rotate icon only when the select itself has focus */
.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 1 auto;
  min-width: 0; /* Allow flex item to shrink below content size */
  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;
  /* Specific transition - avoid layout properties */
  transition: color 0.2s ease;
}

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

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

/* Dial code prefix (DISABLED - already shown in selector) */
.tramite-ultralight__phone-prefix {
  display: none;
}

/* ===== 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 (Subtle effects) ===== */
.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;
}
