/* International Phone Input Component Styles */

.phone-input-wrapper {
  display: flex;
  gap: 8px;
  width: 100%;
}

.country-selector {
  position: relative;
  min-width: 120px;
  flex-shrink: 0;
}

.country-selector-button {
  width: 100%;
  padding: 0.75rem 0.75rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  text-align: left;
}

.country-selector-button:hover {
  border-color: var(--primary-color, #1779a1);
}

.country-selector-button:focus {
  outline: none;
  border-color: var(--primary-color, #1779a1);
  box-shadow: 0 0 0 3px rgba(23, 121, 161, 0.1);
}

.country-selector-display {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

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

.country-dial-code {
  font-weight: 500;
  color: #2a3f52;
  white-space: nowrap;
}

.country-selector-arrow {
  font-size: 0.75rem;
  color: #666;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.country-selector.open .country-selector-arrow {
  transform: rotate(180deg);
}

.country-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 280px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.country-selector.open .country-dropdown {
  display: block;
}

.country-search {
  position: sticky;
  top: 0;
  background: white;
  padding: 8px;
  border-bottom: 1px solid var(--border-color, #ddd);
  z-index: 1;
}

.country-search input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 4px;
  font-size: 0.9rem;
}

.country-search input:focus {
  outline: none;
  border-color: var(--primary-color, #1779a1);
}

.country-list {
  list-style: none;
  margin: 0;
  padding: 4px;
}

.country-option {
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

.country-option:hover {
  background-color: #f8f9fa;
}

.country-option.selected {
  background-color: rgba(23, 121, 161, 0.1);
}

.country-option .country-flag {
  font-size: 1.25rem;
}

.country-option-content {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.country-name {
  flex: 1;
  font-size: 0.9rem;
  color: #2a3f52;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.country-option .country-dial-code {
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
}

.phone-number-input {
  flex: 1;
  min-width: 0;
}

.phone-number-input input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.phone-number-input input:focus {
  outline: none;
  border-color: var(--primary-color, #1779a1);
  box-shadow: 0 0 0 3px rgba(23, 121, 161, 0.1);
}

.phone-number-input input.error {
  border-color: var(--error-color, #ef4444);
}

.phone-number-input input.valid {
  border-color: var(--success-color, #10b981);
}

/* Dark theme support */
body.dark-theme .country-selector-button,
body.dark-theme .country-dropdown,
body.dark-theme .country-search,
body.dark-theme .phone-number-input input {
  background: var(--bg-tertiary, #1a2d3f);
  border-color: var(--border, #2a3f52);
  color: var(--text-primary, #e0e0e0);
}

body.dark-theme .country-dial-code,
body.dark-theme .country-name {
  color: var(--text-primary, #e0e0e0);
}

body.dark-theme .country-option:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

body.dark-theme .country-option.selected {
  background-color: rgba(23, 121, 161, 0.2);
}

/* Loading state */
.phone-input-wrapper.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  .phone-input-wrapper {
    flex-direction: column;
  }

  .country-selector {
    width: 100%;
    min-width: unset;
  }

  .country-dropdown {
    max-height: 240px;
  }
}

/* Accessibility */
.country-selector-button:focus-visible,
.phone-number-input input:focus-visible {
  outline: 2px solid var(--primary-color, #1779a1);
  outline-offset: 2px;
}

/* No results message */
.country-list-empty {
  padding: 20px;
  text-align: center;
  color: #999;
  font-size: 0.9rem;
}
