/* ============================================================
   Dubuz "Search2" country-code picker (.cc2)
   Trigger shows ONLY the dial code ("+971"); the opened panel is a
   searchable list (flag + code + full country name).

   Surfaces are deliberately NEUTRAL (white / light-gray, dark-gray in
   night mode) — no brand/theme fills anywhere. Hover + selected rows
   use the neutral gray ramp so the widget reads as a plain form
   control on the auth pages and in the account dashboard alike.

   Tokens fall back through the hd-theme-system neutral family
   (--surface*, --border*, --text*) then the al-auth token family,
   then hard-coded neutrals.
   ============================================================ */
.cc2 {
  --cc2-border: var(--border, var(--al-border, #E5E7EB));
  --cc2-bg: var(--surface, var(--al-card, #FFFFFF));
  --cc2-text: var(--text-main, var(--al-text, #111827));
  --cc2-muted: var(--text-muted, var(--al-text-muted, #6B7280));
  /* Neutral interactive ramp (never theme/brand colored). */
  --cc2-bg-input: var(--surface-subtle, var(--al-bg-soft, #F4F5F7));
  --cc2-hover: var(--surface-hover, var(--al-hover, #F1F3F5));
  --cc2-active: var(--surface-active, var(--al-active, #E7EAEE));
  --cc2-focus-border: var(--border-hover, var(--al-border-strong, #9CA3AF));
  --cc2-focus-ring: rgba(100, 116, 139, 0.16);
  --cc2-h: 44px;
  --cc2-radius: 10px;

  position: relative;
  display: flex;
  align-items: stretch;
  box-sizing: border-box;
  width: 100%;
  height: var(--cc2-h);
  border: 1px solid var(--cc2-border);
  border-radius: var(--cc2-radius);
  background: var(--cc2-bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cc2:focus-within {
  border-color: var(--cc2-focus-border);
  box-shadow: 0 0 0 3px var(--cc2-focus-ring);
}

/* ---- Trigger: compact code-only cell ---- */
.cc2__trigger {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
  height: 100%;
  max-width: 96px;
  min-width: 52px;
  padding: 0 8px 0 12px;
  border: none;
  border-right: 1px solid var(--cc2-border);
  border-radius: var(--cc2-radius) 0 0 var(--cc2-radius);
  background: transparent;
  color: var(--cc2-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.cc2__trigger:hover,
.cc2--open .cc2__trigger {
  background: var(--cc2-hover);
}

.cc2__code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cc2__trigger.cc2__trigger--empty .cc2__code {
  color: var(--cc2-muted);
  font-weight: 500;
}

.cc2__chev {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  color: var(--cc2-muted);
  transition: transform 0.18s ease;
}

.cc2__chev svg {
  display: block;
  width: 10px;
  height: 10px;
}

.cc2--open .cc2__chev {
  transform: rotate(180deg);
}

/* ---- Phone input cell ---- */
.cc2__phone {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--cc2-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 0 14px;
  border-radius: 0 var(--cc2-radius) var(--cc2-radius) 0;
}

.cc2__phone::placeholder {
  color: var(--cc2-muted);
  font-weight: 400;
}

.cc2__phone:disabled,
.cc2__trigger:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* ---- Open panel ----
   Closed by default (display:none). The JS toggles the `hidden`
   attribute AND the .cc2--open class; both are honoured here so the
   panel can never leak open over the form (a fixed, always-on list
   previously covered the trigger chip + phone field on mobile and
   blocked the fields below on desktop). When open it is position:fixed
   (set by JS) so no card/table overflow can clip it. */
.cc2__panel {
  position: fixed;
  z-index: 999;
  display: none;
  flex-direction: column;
  box-sizing: border-box;
  margin-top: 6px;
  background: var(--cc2-bg);
  border: 1px solid var(--cc2-border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg, 0 16px 40px rgba(16, 24, 40, 0.14));
  overflow: hidden;
}

.cc2--open .cc2__panel {
  display: flex;
}

.cc2__panel[hidden] {
  display: none;
}

.cc2__search {
  position: relative;
  padding: 8px 8px 6px;
  border-bottom: 1px solid var(--cc2-border);
  background: var(--cc2-bg);
}

.cc2__search-icon {
  position: absolute;
  inset-inline-start: 19px;
  top: 50%;
  transform: translateY(calc(-50% + 1px));
  width: 13px;
  height: 13px;
  color: var(--cc2-muted);
  pointer-events: none;
}

.cc2__search-input {
  width: 100%;
  box-sizing: border-box;
  height: 34px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--cc2-border);
  border-radius: 9px;
  background: var(--cc2-bg-input);
  color: var(--cc2-text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cc2__search-input:focus {
  border-color: var(--cc2-focus-border);
  box-shadow: 0 0 0 3px var(--cc2-focus-ring);
}

.cc2__search-input::placeholder {
  color: var(--cc2-muted);
  font-weight: 400;
}

.cc2__list {
  max-height: 232px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.cc2__option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--cc2-text);
  text-align: start;
  transition: background 0.15s ease, color 0.15s ease;
}

.cc2__option:hover,
.cc2__option.is-active {
  background: var(--cc2-hover);
  color: var(--cc2-text);
}

.cc2__option[aria-selected="true"] {
  background: var(--cc2-active);
  color: var(--cc2-text);
}

.cc2__option[hidden] {
  display: none;
}

.cc2__flag {
  flex: 0 0 auto;
  width: 20px;
  font-size: 17px;
  line-height: 1;
  text-align: center;
}

.cc2__opt-code {
  flex: 0 0 auto;
  min-width: 46px;
  color: var(--cc2-muted);
  font-weight: 600;
}

.cc2__opt-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cc2__empty-state {
  padding: 12px;
  font-size: 12px;
  color: var(--cc2-muted);
  text-align: center;
}
