/* Custom styles for TomSelect to match the existing UI */
.ts-wrapper {
    width: 100%;
}

.ts-control {
    border-radius: 0.5rem;
    border-color: #e7eaf3;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #1e2022;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.ts-control:focus {
    border-color: rgba(219, 97, 47, 0.19);
    box-shadow: 0 0 0 0.25rem rgba(219, 97, 47, 0.19);
}

.ts-dropdown {
    border-radius: 0.5rem;
    border-color: #e7eaf3;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

.ts-dropdown .option {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.ts-dropdown .active {
    background-color: rgba(55, 125, 255, 0.1);
    color: #DB612F;
}

.ts-dropdown .option:hover {
    background-color: rgba(55, 125, 255, 0.05);
}

.country-code {
    font-weight: 600;
    margin-right: 0.5rem;
    color: #db612f;
}

.country-name {
    color: #677788;
}

/* Dark mode support */
[data-hs-theme="dark"] .ts-wrapper {
    color: #fff;
}

[data-hs-theme="dark"] .ts-control {
    background-color: #1e2022;
    border-color: #323334;
    color: #fff;
}

[data-hs-theme="dark"] .ts-dropdown {
    background-color: #1e2022;
    border-color: #323334;
    color: #fff;
}

[data-hs-theme="dark"] .ts-dropdown .option {
    color: #fff;
}

[data-hs-theme="dark"] .ts-dropdown .option:hover {
    background-color: rgba(55, 125, 255, 0.1);
}

[data-hs-theme="dark"] .ts-dropdown .active {
    background-color: rgba(219, 97, 47, 0.19);
}

[data-hs-theme="dark"] .country-code {
    color: #DB612F;
}

[data-hs-theme="dark"] .country-name {
    color: #e7eaf3;
}

/* Fix for input placeholder in dark mode */
[data-hs-theme="dark"] .ts-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Fix for dropdown menu in dark mode */
[data-hs-theme="dark"] .ts-dropdown .create {
    color: rgba(255, 255, 255, 0.7);
}

/* Fix for focus state in dark mode */
[data-hs-theme="dark"] .ts-control:focus {
    border-color: rgba(219, 97, 47, 0.19);
    box-shadow: 0 0 0 0.25rem rgba(219, 97, 47, 0.19);
}

/* Fix for dropdown content in dark mode */
[data-hs-theme="dark"] .ts-dropdown-content {
    background-color: #1e2022;
    color: #fff;
}

/* Fix for input field in dark mode */
[data-hs-theme="dark"] .ts-wrapper.multi .ts-control > div {
    background-color: #323334;
    color: #fff;
}

/* Fix for input field hover in dark mode */
[data-hs-theme="dark"] .ts-wrapper.multi .ts-control > div:hover {
    background-color: #424344;
}

/* Fix for input field in dark mode */
[data-hs-theme="dark"] .ts-wrapper .ts-control > input {
    color: #fff;
}

/* Fix for dropdown header in dark mode */
[data-hs-theme="dark"] .ts-dropdown .optgroup-header {
    background-color: #1e2022;
    color: #e7eaf3;
}

/* Fix for dropdown divider in dark mode */
[data-hs-theme="dark"] .ts-dropdown .optgroup:before {
    border-color: #323334;
}

/* Fix for no results in dark mode */
[data-hs-theme="dark"] .ts-dropdown .no-results {
    background-color: #1e2022;
    color: #e7eaf3;
}
