/* ============================================================
   Phone Prefix Picker for CF7
   Structural-only styles — wygląd kontrolujesz przez własną klasę.
   ============================================================ */

/* ── Wrapper ── */
.ppcf7-wrapper {
  position: relative;
  display: block;
  width: 100%;
}

/* ── Row: trigger + input obok siebie ── */
.ppcf7-field-row {
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

/* ── Trigger button: resetujemy wszystko co przeglądarka dokłada ── */
.ppcf7-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  cursor: pointer;
  white-space: nowrap;
  background: none;
  border: none;
  padding: 0 12px;
  -webkit-tap-highlight-color: transparent;
  font: inherit;
  color: inherit;
}

.ppcf7-flag {
  font-size: 1.25em;
  line-height: 1;
  flex-shrink: 0;
}

.ppcf7-chevron {
  width: 10px;
  height: 6px;
  flex-shrink: 0;
  transition: transform .18s ease;
}

.ppcf7-trigger[aria-expanded="true"] .ppcf7-chevron {
  transform: rotate(180deg);
}

/* ── Number input: odseparowane, żadnych własnych styli ── */
.ppcf7-number-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  font: inherit;
  color: inherit;
  padding: 0 12px;
}

/* ── Dropdown: pozycjonowanie i scroll — reszta przez klasę ── */
.ppcf7-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 9999;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  overflow: hidden;
  animation: ppcf7-in .15s ease;
}

@keyframes ppcf7-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Search row ── */
.ppcf7-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
}

.ppcf7-search-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: .45;
}

.ppcf7-search {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  color: inherit;
  min-width: 0;
}

.ppcf7-search-clear {
  border: none;
  background: none;
  cursor: pointer;
  padding: 2px 4px;
  font: inherit;
  opacity: .5;
}

/* ── Lista ── */
.ppcf7-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.ppcf7-list::-webkit-scrollbar       { width: 4px; }
.ppcf7-list::-webkit-scrollbar-track { background: transparent; }
.ppcf7-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* ── Item ── */
.ppcf7-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ppcf7-item:hover {
  background: rgba(0,0,0,.04);
}

.ppcf7-item--selected {
  background: rgba(0,0,0,.06);
}

.ppcf7-item-flag {
  font-size: 1.25em;
  line-height: 1;
  flex-shrink: 0;
  width: 26px;
  text-align: center;
}

.ppcf7-item-name {
  flex: 1;
  font-size: .875em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ppcf7-item-dial {
  font-size: .8em;
  opacity: .55;
  flex-shrink: 0;
}

/* ── Brak wyników ── */
.ppcf7-no-results {
  padding: 14px;
  margin: 0;
  font-size: .875em;
  opacity: .5;
  text-align: center;
}

/* ── Backdrop: tylko na mobile ── */
.ppcf7-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 9998;
}

/* ============================================================
   MOBILE – bottom sheet
   ============================================================ */
@media (max-width: 600px) {
  .ppcf7-backdrop { display: block; }

  .ppcf7-dropdown {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: 80vh;
    border-radius: 16px 16px 0 0 !important;
    border-bottom: none;
    animation: ppcf7-sheet .22s ease;
    display: flex;
    flex-direction: column;
  }

  @keyframes ppcf7-sheet {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  .ppcf7-dropdown::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: #ccc;
    border-radius: 2px;
    margin: 10px auto 4px;
    flex-shrink: 0;
  }

  .ppcf7-search-wrap { flex-shrink: 0; }

  .ppcf7-list {
    max-height: none;
    flex: 1;
    padding-bottom: env(safe-area-inset-bottom, 12px);
  }

  .ppcf7-item { padding: 13px 16px; }
}

/* ── hidden state ── */
.ppcf7-dropdown[hidden],
.ppcf7-backdrop[hidden] {
  display: none !important;
}
