.hayllo-phone-input-container {
  font-family: 'Lato', sans-serif;
  max-width: 400px;
  position: relative;
}

.hayllo-phone-input-wrapper {
  display: flex;
  align-items: center;
  border: 1px solid var(--hayllo-light-grey);
  border-radius: 8px;
  padding: 0;
  position: relative;
  background: #fff;
  transition: border-color 0.3s ease;
}

.hayllo-phone-input-wrapper:focus-within {
  border-color: var(--hayllo-violet);
  box-shadow: 0 0 0 2px rgba(140, 115, 177, 0.2);
}

/* Country Selector */
.hayllo-country-selector {
  position: relative;
  border-right: 0;
  padding: 0 8px 0 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  height: 42px;
}

.hayllo-selected-country {
  display: flex;
  align-items: center;
  gap: 6px;
  outline: none;
}

.hayllo-flag-icon {
  font-size: 20px;
  line-height: 1;
}

.hayllo-dropdown-arrow {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid #666;
  display: inline-block;
  margin-left: 4px;
}

/* Input Group */
.hayllo-input-group {
  flex-grow: 1;
  position: relative;
  height: 42px;

  input[type="tel"],
  input[type="tel"]:focus {
    border: none !important;
  }
}

.hayllo-phone-input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  padding: 20px 12px 6px 12px; /* Top padding for floating label */
  font-size: 14px;
  background: transparent;
  color: var(--hayllo-dark-grey);
  box-sizing: border-box;
}

.hayllo-floating-label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #999;
  pointer-events: none;
  transition: 0.2s ease all;
}

/* Floating Label Logic */
.hayllo-phone-input:focus ~ .hayllo-floating-label,
.hayllo-phone-input:not(:placeholder-shown) ~ .hayllo-floating-label {
  top: 8px;
  font-size: 12px;
  color: #999;
}

/* Hide placeholder when not focused to prevent overlap with label */
.hayllo-phone-input:not(:focus)::placeholder {
  color: transparent;
}

/* Dropdown */
.hayllo-country-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 300px;
  background: #fff;
  border: 1px solid var(--hayllo-light-grey);
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 1000;
  display: none;
  margin-top: 4px;
  overflow: hidden;
}

.hayllo-country-dropdown.active {
  display: block;
}

.hayllo-search-container {
  padding: 8px;
  border-bottom: 1px solid #f3f4f6;
}

.hayllo-country-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--hayllo-light-grey);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

.hayllo-country-search:focus {
  border-color: var(--hayllo-violet);
  box-shadow: 0 0 0 2px rgba(140, 115, 177, 0.2);
}

.hayllo-country-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
}

.hayllo-country-list li {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--hayllo-dark-grey);
  transition: background 0.2s;
}

.hayllo-country-list li:hover {
  background: #f9fafb;
}

.hayllo-country-list li.selected {
  background: #f3f4f6;
}

.hayllo-country-dial-code {
  color: #9ca3af;
  margin-left: auto;
}

/* Validation Styles */
.hayllo-phone-input-wrapper.error {
  border-color: var(--hayllo-neon-red);
}

.hayllo-phone-input-wrapper.error:focus-within {
  box-shadow: 0 0 0 2px rgba(230, 75, 100, 0.2);
}

.hayllo-validation-msg {
  color: var(--hayllo-neon-red);
  font-size: 12px;
  margin-top: 4px;
  display: none;
}

.hayllo-phone-input-wrapper.valid {
  border-color: #22c55e;
}
