/**
 * MKShop Shared Address Selection & Mode Toggle CSS
 * Unified styles for 2-level (GSO 2025) & 3-level (Legacy) address selectors across all surfaces.
 */

/* 2/3-Level Toggle Widget Container */
.mkshop-address-mode-toggle-wrap,
.mkshop-address-type-toggle {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.mkshop-address-mode-toggle-wrap .mkshop-toggle-label,
.mkshop-address-type-toggle .mk-toggle-label {
    font-weight: 600;
    font-size: 13px;
    color: #1e293b;
    margin-right: 4px;
}

/* Segmented Control / Pill Group */
.mkshop-segmented-control,
.mk-toggle-pills {
    display: inline-flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    gap: 2px;
}

.mkshop-seg-btn,
.mkshop-mode-btn,
.mk-toggle-pill {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}

.mkshop-seg-btn:hover,
.mkshop-mode-btn:hover,
.mk-toggle-pill:hover {
    color: #1e293b;
    background: rgba(255, 255, 255, 0.6);
}

.mkshop-seg-btn.active,
.mkshop-mode-btn.active,
.mk-toggle-pill.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mkshop-badge,
.mk-pill-indicator {
    font-size: 10px;
    font-weight: 700;
    background: #2563eb;
    color: #ffffff;
    padding: 1px 5px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.mkshop-seg-btn:not(.active) .mkshop-badge,
.mkshop-mode-btn:not(.active) .mkshop-badge {
    background: #94a3b8;
}

/* Scope 100% fluid width exclusively to field-side SelectWoo controls (adjacent sibling) */
select.select2-hidden-accessible + .select2-container,
input.select2-hidden-accessible + .select2-container {
    width: 100% !important;
    max-width: 100%;
}

/* Modal floating dropdown container z-index stacking guard */
#mk-quick-edit-modal > .select2-container--open,
#mkshop-add-customer-modal > .select2-container--open {
    z-index: 100100;
}

.select2-container .select2-selection--single {
    height: 38px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    display: flex !important;
    align-items: center !important;
}

.select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 28px !important;
    color: #1e293b !important;
    font-size: 13px !important;
    padding-left: 0 !important;
}

.select2-container .select2-selection--single .select2-selection__arrow {
    height: 36px !important;
    right: 8px !important;
}

/* High Contrast Dropdown Match Highlight */
.select2-dropdown {
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
    z-index: 999999 !important;
}

.select2-results__option--highlighted[aria-selected] {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

.select2-results__option[aria-selected="true"] {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
    font-weight: 600 !important;
}

/* Visibility helpers */
.mkshop-address-field-hidden {
    display: none !important;
}

/* Enforce SelectWoo hidden accessible element containment across all themes/screens */
select.select2-hidden-accessible,
input.select2-hidden-accessible {
    border: 0 !important;
    clip: rect(0 0 0 0) !important;
    -webkit-clip-path: inset(50%) !important;
    clip-path: inset(50%) !important;
    height: 1px !important;
    overflow: hidden !important;
    padding: 0 !important;
    position: absolute !important;
    width: 1px !important;
    white-space: nowrap !important;
    margin: -1px !important;
}

/* Dedicated Modal Dropdown Root for SelectWoo anchoring */
.mkshop-address-dropdown-root,
.mkshop-address-select-dropdown-root {
    position: relative !important;
    width: 100% !important;
    z-index: 100050 !important;
}

/* Mobile Touch & Fast Selection Enhancements */
.select2-results__option {
    touch-action: manipulation !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

.select2-container .select2-selection {
    touch-action: manipulation !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
}

.mkshop-touch-mode .select2-results__option {
    transition: none !important;
}

@media (hover: none) and (pointer: coarse) {
    .select2-results__option--highlighted[aria-selected]:not(:active) {
        background-color: transparent;
        color: inherit;
    }
    .select2-results__option:active {
        background-color: #f1f5f9 !important;
        color: #0f172a !important;
    }
}

