/* ============================================
   Smart Phone Input with Auto-Normalization
   ============================================ */

.phone-input-container {
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: .5rem;
  overflow: hidden;
  background: var(--bg-field, #ffffff);
  transition: border-color .15s, box-shadow .15s;
}

.phone-input-container:focus-within {
  border-color: var(--brand-500, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

.phone-input-container .country-code {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 .75rem;
  font-weight: 700;
  font-size: .95rem;
  color: var(--text, #0f172a);
  background: var(--bg-2, #f1f5f9);
  border-right: 1px solid var(--border, #e2e8f0);
  white-space: nowrap;
  user-select: none;
  min-width: 3rem;
  justify-content: center;
}

[dir="rtl"] .phone-input-container .country-code {
  border-right: none;
  border-left: 1px solid var(--border, #e2e8f0);
}

.phone-input-container input {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 0;
  padding: .65rem .75rem;
  font-size: 1rem;
  background: transparent;
  color: var(--text, #0f172a);
  outline: none;
  letter-spacing: .5px;
  font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
}

.phone-input-container input::placeholder {
  color: #94a3b8;
  letter-spacing: 0;
  font-family: inherit;
}

.phone-input-container input:focus { box-shadow: none; }

.phone-status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  padding: 0 .5rem;
  font-size: 1rem;
}
.phone-status.valid { color: #22c55e; }
.phone-status.invalid { color: #dc2626; }
.phone-status.pending { color: #f59e0b; }

.auth-hint {
  font-size: .8rem;
  color: var(--text-3, #64748b);
  margin-top: .35rem;
  transition: color .2s;
}
.auth-hint.error { color: #dc2626; }
.auth-hint.success { color: #22c55e; }

.phone-preview {
  margin-top: .5rem;
  padding: .5rem .75rem;
  background: var(--bg-2, #f1f5f9);
  border-radius: .5rem;
  font-size: .8rem;
  color: var(--text-2, #334155);
  display: none;
}
.phone-preview.show { display: block; }
.phone-preview strong {
  color: var(--brand-600, #4f46e5);
  font-family: "Vazirmatn", monospace, monospace;
  font-size: .9rem;
}

/* Dark theme support */
[data-theme="dark"] .phone-input-container {
  background: var(--bg-field, #1a1a2e);
  border-color: var(--border, #2a2a3e);
}
[data-theme="dark"] .phone-input-container .country-code {
  background: var(--bg-2, #1e1e2e);
  border-right-color: var(--border, #2a2a3e);
}
[data-theme="dark"] .phone-input-container input { color: #e2e8f0; }
[data-theme="dark"] .phone-preview { background: var(--bg-2, #1e1e2e); }

/* Mobile responsive */
@media (max-width: 480px) {
  .phone-input-container input { font-size: .95rem; padding: .55rem .6rem; }
  .phone-input-container .country-code { padding: 0 .5rem; font-size: .85rem; min-width: 2.5rem; }
  .phone-status { padding: 0 .35rem; min-width: 1.25rem; }
}
