/**
 * Custom styles for Tom Select to match IMPROVIA's sop-input style.
 */

.ts-wrapper.sop-tom-select {
    width: auto !important;
    min-width: 100px;
    flex: 1;
}

/* For full-width cases like personal tab grid */
.sop-tab-grid-4 .ts-wrapper.sop-tom-select,
.sop-tab-grid-4-sm .ts-wrapper.sop-tom-select,
.sop-tab-panel .ts-wrapper.sop-tom-select {
    width: 87% !important;
}

.ts-control {
    background: rgba(255, 255, 255, 0) !important;
    border: 0px solid #4A90E2 !important;
    border-radius: var(--sop-radius-md) !important;
    padding: 8px 12px !important;
    color: var(--sop-color-white) !important;
    font-size: 0.95rem !important;
    box-shadow: none !important;
    transition: border-color 0.3s ease;
    min-height: 43px !important;
    /* Match sop-input height */
    display: flex !important;
    align-items: center !important;
    width: 90% !important;
}

.ts-control:focus,
.ts-control.focus {
    border-color: rgba(255, 255, 255, 0.3) !important;
    outline: none !important;
}

.ts-control .item {
    color: var(--sop-color-white) !important;
}

.ts-dropdown {
    background: var(--sop-color-sidebar) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: var(--sop-radius-sm) !important;
    color: var(--sop-color-white) !important;
    z-index: 1000;
}

.ts-dropdown .active {
    background: rgba(255, 255, 255, 0.1) !important;
    color: var(--sop-color-white) !important;
}

.ts-dropdown .option {
    padding: 10px 15px;
    cursor: pointer;
}

.ts-dropdown .option:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* Fix for the search input inside the control */
.ts-control input {
    color: var(--sop-color-white) !important;
    font-size: 0.95rem !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.ts-control input::placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}

.ts-wrapper.single .ts-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 15px center !important;
    padding-right: 35px !important;
}

/* ========================================
   LIGHT THEME SUPPORT
   ======================================== */
.sop-provider-theme-light .ts-control {
    background: #fff !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
    color: #333 !important;
}

.sop-provider-theme-light .ts-control .item {
    color: #333 !important;
}

.sop-provider-theme-light .ts-control input {
    color: #333 !important;
}

.sop-provider-theme-light .ts-control input::placeholder {
    color: rgba(0, 0, 0, 0.4) !important;
}

.sop-provider-theme-light .ts-dropdown {
    background: #fff !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    color: #333 !important;
}

.sop-provider-theme-light .ts-dropdown .active {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #092189 !important;
}

.sop-provider-theme-light .ts-dropdown .option:hover {
    background: rgba(0, 0, 0, 0.02) !important;
}

.sop-provider-theme-light .ts-wrapper.single .ts-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23333333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
}