/**
 * WebSpot DDI Selector Component
 * Seletor de código de país (DDI) com bandeira
 *
 * USO:
 * <div class="ws-ddi-selector" data-name="phone_ddi" data-default="BR"></div>
 */

.ws-ddi-selector {
    position: relative;
    display: inline-block;
}

.ws-ddi-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
    min-width: 90px;
}

.ws-ddi-btn:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

.ws-ddi-btn:focus {
    outline: none;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.ws-ddi-flag {
    font-size: 18px;
    line-height: 1;
}

.ws-ddi-code {
    font-weight: 500;
    color: #212529;
}

.ws-ddi-arrow {
    margin-left: auto;
    font-size: 10px;
    color: #6c757d;
    transition: transform 0.2s;
}

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

/* Dropdown */
.ws-ddi-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1050;
    min-width: 280px;
    max-height: 300px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
}

.ws-ddi-selector.open .ws-ddi-dropdown {
    display: flex;
}

/* Search */
.ws-ddi-search {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.ws-ddi-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.ws-ddi-search input:focus {
    border-color: #86b7fe;
}

.ws-ddi-search input::placeholder {
    color: #adb5bd;
}

/* List */
.ws-ddi-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.ws-ddi-option {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.1s;
}

.ws-ddi-option:hover {
    background: #f8f9fa;
}

.ws-ddi-option.selected {
    background: #e8f5e9;
}

.ws-ddi-option-flag {
    font-size: 20px;
    margin-right: 12px;
    line-height: 1;
}

.ws-ddi-option-info {
    flex: 1;
    min-width: 0;
}

.ws-ddi-option-name {
    font-size: 14px;
    font-weight: 500;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ws-ddi-option-ddi {
    font-size: 13px;
    color: #6c757d;
}

.ws-ddi-option-check {
    width: 18px;
    height: 18px;
    border: 2px solid #dee2e6;
    border-radius: 50%;
    margin-left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ws-ddi-option.selected .ws-ddi-option-check {
    background: #198754;
    border-color: #198754;
}

.ws-ddi-option.selected .ws-ddi-option-check::after {
    content: '';
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
}

/* Size variants */
.ws-ddi-selector-sm .ws-ddi-btn {
    padding: 4px 8px;
    font-size: 13px;
    min-width: 80px;
}

.ws-ddi-selector-sm .ws-ddi-flag {
    font-size: 16px;
}

/* No results */
.ws-ddi-no-results {
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
}
