/* Reusable country picker component - use with js/country-picker.js */
/* Ensure flag icons are available on any page that uses the picker */
@import url('https://cdn.jsdelivr.net/npm/flag-icons@7.2.3/css/flag-icons.min.css');

.phone-input-wrapper {
  display: flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
}

.country-selector {
  position: relative;
  flex-shrink: 0;
  z-index: 1001;
}

.country-selector-btn {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-right: none;
  border-radius: 8px 0 0 8px;
  padding: 12px 14px;
  color: var(--color-white, #fff);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  font-size: 14px;
  min-width: 100px;
}

.country-selector-btn:hover {
  background: rgba(0, 0, 0, 0.5);
  border-color: var(--color-gold, #d4af37);
}

.country-selector-btn.active {
  background: rgba(0, 0, 0, 0.5);
  border-color: var(--color-gold, #d4af37);
}

.country-flag {
  flex-shrink: 0;
  border-radius: 2px;
}

.country-flag.fi {
  display: inline-block;
  width: 22px;
  min-width: 22px;
  height: 16px;
  background-size: contain;
  background-position: 50%;
  background-repeat: no-repeat;
  vertical-align: middle;
}

.country-flag-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  line-height: 1;
  width: auto;
  min-width: 22px;
  height: auto;
}

.country-code {
  font-weight: 500;
  color: var(--color-gold, #d4af37);
}

.dropdown-arrow {
  margin-left: auto;
  transition: transform 0.3s ease;
}

.country-selector-btn.active .dropdown-arrow {
  transform: rotate(180deg);
}

.country-dropdown {
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  max-height: 300px;
  min-width: 280px;
  width: max-content;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}

.country-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.country-search-wrapper {
  position: relative;
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.country-search {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 8px 12px 8px 48px;
  color: var(--color-white, #fff);
  font-size: 14px;
  transition: all 0.3s ease;
}

.country-search:focus {
  outline: none;
  border-color: var(--color-gold, #d4af37);
  background: rgba(255, 255, 255, 0.1);
}

.country-search::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.country-search-wrapper .search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.country-list {
  overflow-y: auto;
  max-height: 240px;
  min-height: 100px;
  display: block;
  width: 100%;
  flex: 1;
}

.country-list::-webkit-scrollbar {
  width: 6px;
}

.country-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.country-list::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.3);
  border-radius: 3px;
}

.country-list::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.5);
}

.country-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.country-item:hover {
  background: rgba(212, 175, 55, 0.1);
}

.country-item.selected {
  background: rgba(212, 175, 55, 0.2);
}

/* Flag cell: use inline-block and explicit size so flag-icons background shows */
.country-item-flag {
  flex-shrink: 0;
  border-radius: 2px;
  min-width: 28px;
}

.country-item-flag.fi {
  display: inline-block;
  width: 28px;
  height: 21px;
  min-width: 28px;
  background-size: contain;
  background-position: 50%;
  background-repeat: no-repeat;
  vertical-align: middle;
}

.country-item-flag.country-flag-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 28px;
  height: 20px;
  font-size: 1.35em;
  line-height: 1;
}

.country-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.country-item-name {
  color: var(--color-white, #fff);
  font-size: 14px;
  font-weight: 500;
}

.country-item-code {
  color: var(--color-light-gray, rgba(255,255,255,0.7));
  font-size: 12px;
}

/* Phone input next to country selector */
.phone-input-wrapper .phone-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-left: none;
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  color: var(--color-white, #fff);
  font-size: 16px;
  font-family: inherit;
}

.phone-input-wrapper .phone-input:focus {
  outline: none;
  border-color: var(--color-gold, #d4af37);
  background: rgba(0, 0, 0, 0.5);
}

.phone-input-wrapper .phone-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 768px) {
  .country-dropdown {
    min-width: 100%;
    right: 0;
  }

  .country-selector-btn {
    min-width: 90px;
    padding: 12px 10px;
  }

  .country-code {
    font-size: 12px;
  }
}
