/* =====================================================================
   Phone Number Input System V1.0 - shared stylesheet
   Full Dark/Light theme integration.
 ===================================================================== */
:root {
  --pf-border: var(--border-line, rgba(255, 255, 255, 0.12));
  --pf-border-focus: var(--brand-emerald, #10b981);
  --pf-bg: var(--bg-card, rgba(13, 20, 36, 0.75));
  --pf-chip-bg: rgba(255, 255, 255, 0.05);
  --pf-dropdown-bg: var(--bg-panel, #0f172a);
  --pf-text-main: var(--text-main, #f8fafc);
  --pf-text-muted: var(--text-muted, #94a3b8);
  --ease: cubic-bezier(.4, 0, .2, 1);
}

html[data-theme="light"] {
  --pf-border: rgba(15, 23, 42, 0.15);
  --pf-border-focus: #059669;
  --pf-bg: #ffffff;
  --pf-chip-bg: #f8fafc;
  --pf-dropdown-bg: #ffffff;
  --pf-text-main: #0f172a;
  --pf-text-muted: #475569;
}

/* ---------- Phone field ---------- */
.phone-field {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  background: var(--pf-bg) !important;
  border: 1px solid var(--pf-border) !important;
  border-radius: var(--radius-md, 12px) !important;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}

.phone-field:hover {
  border-color: var(--pf-border-focus) !important;
}

.phone-field:focus-within {
  border-color: var(--pf-border-focus) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .2) !important;
}

.field.invalid .phone-field {
  border-color: #DC2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12) !important;
}

.pf-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px 0 16px;
  border: 0;
  cursor: pointer;
  flex: none;
  background: var(--pf-chip-bg) !important;
  border-right: 1px solid var(--pf-border) !important;
  border-radius: 11px 0 0 11px;
  font: inherit;
  color: var(--pf-text-main) !important;
  transition: background .25s var(--ease);
}

.pf-chip:hover {
  background: rgba(16, 185, 129, .1) !important;
}

.pf-chip:focus-visible {
  outline: 2px solid var(--pf-border-focus);
  outline-offset: -2px;
}

.pf-flag {
  width: 24px;
  height: 18px;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .08);
  flex: none;
}

.pf-code {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--pf-text-main) !important;
}

.pf-arrow {
  width: 14px;
  height: 14px;
  color: var(--pf-text-muted) !important;
  flex: none;
  transition: transform .3s var(--ease);
}

.pf-chip[aria-expanded="true"] .pf-arrow {
  transform: rotate(180deg);
  color: var(--pf-border-focus) !important;
}

.field .phone-field input#f-phone,
.field .phone-field input#f-phone:hover,
.field .phone-field input#f-phone:focus {
  flex: 1;
  min-width: 0;
  width: auto;
  min-height: 50px;
  margin: 0;
  padding: 12px 16px;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  border-radius: 0 11px 11px 0;
  font-size: 15.5px;
  font-weight: 500;
  color: var(--pf-text-main) !important;
}

.pf-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--pf-dropdown-bg) !important;
  border: 1px solid var(--pf-border) !important;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .2), 0 2px 8px rgba(15, 23, 42, .08);
}

.pf-searchwrap {
  border-bottom: 1px solid var(--pf-border);
}

.field .pf-searchwrap input,
.field .pf-searchwrap input:hover,
.field .pf-searchwrap input:focus {
  width: 100%;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none !important;
  outline: none;
  min-height: 50px;
  margin: 0;
  padding: 14px 18px 14px 46px;
  font-size: 14.5px;
  color: var(--pf-text-main) !important;
  background: transparent url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='M21 21l-4.3-4.3'/></svg>") no-repeat 16px 50%/17px 17px !important;
}

.pf-searchwrap input::placeholder {
  color: var(--pf-text-muted) !important;
}

.pf-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 264px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.pf-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14.5px;
}

.pf-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--pf-text-main) !important;
  font-weight: 500;
}

.pf-item-dial {
  color: var(--pf-text-muted) !important;
  font-weight: 600;
  font-size: 13.5px;
}

.pf-item:hover, .pf-item:focus-visible {
  background: rgba(16, 185, 129, .15) !important;
  outline: none;
}

.pf-item.active {
  background: rgba(16, 185, 129, .2) !important;
}
