/**
 * Configurable Dropdown Component Styles
 * Supports both single-select and multi-select modes
 * 
 * @author Consumer Web Console
 * @version 1.0
 */

/* Wrapper */
.configurable-dropdown-wrapper {
    position: relative;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Toggle Button */
.configurable-dropdown-toggle {
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 42px;
    transition: all 0.2s ease;
    outline: none;
}

.configurable-dropdown-toggle:hover {
    border-color: #1CA3DD;
}

.configurable-dropdown-toggle:focus {
    border-color: #1CA3DD;
    box-shadow: 0 0 0 0.2rem rgba(28, 163, 221, 0.25);
}

.configurable-dropdown-toggle.error {
    border-color: #dc3545;
}

.configurable-dropdown-toggle.error:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Placeholder Text */
.configurable-dropdown-placeholder {
    color: #6c757d;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    line-height: 1.5;
}

/* Chevron Icon */
.configurable-dropdown-toggle i {
    color: #6c757d;
    font-size: 12px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

/* Dropdown Menu */
.configurable-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    margin-top: 4px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Dropdown List Container */
.configurable-dropdown-list {
    max-height: 350px;
    overflow-y: auto;
    padding: 0;
}

/* Custom Scrollbar */
.configurable-dropdown-list::-webkit-scrollbar {
    width: 8px;
}

.configurable-dropdown-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.configurable-dropdown-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.configurable-dropdown-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Dropdown Item */
.configurable-dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.configurable-dropdown-item:hover {
    background: #f8f9fa;
}

.configurable-dropdown-item:last-child {
    border-bottom: none;
}

/* Single-select item selected state */
.configurable-dropdown-item.selected {
    background: #e7f5fc;
}

.configurable-dropdown-item.selected .configurable-dropdown-option-text {
    font-weight: 600;
    color: #1CA3DD;
}

/* Option Text */
.configurable-dropdown-option-text {
    color: #495057 !important;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    flex: 1;
    user-select: none;
}

/* Checkbox Label */
.configurable-dropdown-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    width: 100%;
    margin: 0;
    padding: 0;
    user-select: none;
}

/* Hide actual checkbox input */
.configurable-dropdown-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Custom Checkmark */
.configurable-dropdown-checkmark {
    position: relative;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    border: 2px solid #1CA3DD;
    border-radius: 3px;
    background: #fff;
    display: inline-block;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

/* Checked State */
.configurable-dropdown-checkbox:checked ~ .configurable-dropdown-checkmark {
    background: #1CA3DD;
    border-color: #1CA3DD;
}

/* Checkmark Icon */
.configurable-dropdown-checkbox:checked ~ .configurable-dropdown-checkmark::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Select All Section */
.configurable-dropdown-select-all {
    padding: 10px 16px;
    border-bottom: 2px solid #dee2e6;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.configurable-dropdown-select-all:hover {
    background: #e9ecef;
}

/* Select All Label */
.configurable-dropdown-select-all-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    width: 100%;
    margin: 0;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    user-select: none;
}

/* Hide actual select all checkbox input */
.configurable-dropdown-select-all-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Select All Checkmark */
.configurable-dropdown-select-all-checkbox ~ .configurable-dropdown-checkmark {
    position: relative;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    border: 2px solid #1CA3DD;
    border-radius: 3px;
    background: #fff;
    display: inline-block;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

/* Select All Checked State */
.configurable-dropdown-select-all-checkbox:checked ~ .configurable-dropdown-checkmark {
    background: #1CA3DD;
    border-color: #1CA3DD;
}

/* Select All Checkmark Icon */
.configurable-dropdown-select-all-checkbox:checked ~ .configurable-dropdown-checkmark::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Indeterminate State */
.configurable-dropdown-select-all-checkbox:indeterminate ~ .configurable-dropdown-checkmark {
    background: #1CA3DD;
    border-color: #1CA3DD;
}

.configurable-dropdown-select-all-checkbox:indeterminate ~ .configurable-dropdown-checkmark::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 7px;
    width: 10px;
    height: 2px;
    background: #fff;
    border: none;
    transform: none;
}

/* Hidden Input */
.configurable-dropdown-hidden-input {
    display: none;
}

/* Error Label */
.configurable-dropdown-error {
    display: block;
    margin-top: 0.25rem !important;
    font-size: 13px !important;
    color: #dc3545 !important;
    font-weight: 400 !important;
}

/* Disabled State */
.configurable-dropdown-wrapper.disabled .configurable-dropdown-toggle {
    background-color: #e9ecef;
    cursor: not-allowed;
    opacity: 0.6;
}

.configurable-dropdown-wrapper.disabled .configurable-dropdown-toggle:hover {
    border-color: #ced4da;
}

/* Focus Visible for Accessibility */
.configurable-dropdown-item:focus {
    outline: 2px solid #1CA3DD;
    outline-offset: -2px;
}

/* Mobile Responsive */
@media (max-width: 767px) {
    .configurable-dropdown-menu {
        max-height: 300px;
    }
    
    .configurable-dropdown-list {
        max-height: 250px;
    }
    
    .configurable-dropdown-toggle {
        padding: 8px 10px;
        min-height: 38px;
    }
    
    .configurable-dropdown-item {
        padding: 8px 12px;
    }
    
    .configurable-dropdown-select-all {
        padding: 8px 12px;
    }
}

/* Tablet Responsive */
@media (max-width: 991px) and (min-width: 768px) {
    .configurable-dropdown-menu {
        max-height: 350px;
    }
    
    .configurable-dropdown-list {
        max-height: 300px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.configurable-dropdown-menu {
    animation: fadeIn 0.2s ease;
}

/* Print Styles */
@media print {
    .configurable-dropdown-menu {
        display: none !important;
    }
}
