/* Multiselect CF7 Styles */
.multiselect-cf7-container {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 0;
}

/* Główny przycisk select */
.multiselect-cf7-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1px solid #000;
    border-radius: 0;
    padding: 10px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
    min-height: 42px;
    max-height: 44px;
}

.multiselect-cf7-selected:hover {
    border-color: #999;
}

.multiselect-cf7-selected:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Tekst w głównym przycisku */
.multiselect-cf7-text {
    flex: 1;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multiselect-cf7-text.placeholder {
    color: #999;
}

/* Strzałka dropdown */
.multiselect-cf7-arrow {
    margin-left: 8px;
    color: #666;
    transition: transform 0.2s ease;
    font-size: 12px;
}

.multiselect-cf7-container.open .multiselect-cf7-arrow {
    transform: rotate(180deg);
}

/* Lista rozwijana */
.multiselect-cf7-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #000;
    border-top: none;
    border-radius: 0;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.multiselect-cf7-container.open .multiselect-cf7-dropdown {
    visibility: visible !important;
    opacity: 1 !important;
    max-height: 300px !important;
    overflow-y: auto !important;
}

/* Opcje w liście */
.multiselect-cf7-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
    margin: 0;
}

.multiselect-cf7-option:last-child {
    border-bottom: none;
}

.multiselect-cf7-option:hover {
    background-color: #f5f5f5;
}

/* Checkbox w opcjach */
.multiselect-cf7-option input[type="checkbox"] {
    margin: 0 8px 0 0;
    cursor: pointer;
}

/* Tekst opcji */
.multiselect-cf7-option-text {
    flex: 1;
    cursor: pointer;
}

/* Opcja "Inne" z inputem */
.multiselect-cf7-option-other {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid #eee;
    background-color: #f9f9f9;
}

.multiselect-cf7-option-other input[type="checkbox"] {
    margin: 0 8px 0 0;
    cursor: pointer;
}

.multiselect-cf7-option-label {
    margin: 0 8px 0 0;
    cursor: pointer;
    white-space: nowrap;
}

.multiselect-cf7-other-input {
    flex: 1;
    padding: 10px !important;
    margin: 0 !important;
    border: 1px solid #ccc;
    border-radius: 0;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.multiselect-cf7-other-input:focus {
    outline: none;
    border-color: #0073aa;
}

.multiselect-cf7-other-input:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* Stan error/invalid */
.multiselect-cf7-container.wpcf7-not-valid .multiselect-cf7-selected {
    border-color: #d9534f;
}

.multiselect-cf7-container.wpcf7-not-valid .multiselect-cf7-selected:focus {
    border-color: #d9534f;
    box-shadow: 0 0 0 1px #d9534f;
}

/* Responsywność */
@media (max-width: 768px) {
    .multiselect-cf7-container {
        max-width: 100%;
    }
    
    .multiselect-cf7-dropdown {
        max-height: 150px;
    }
}

/* Dodatkowe style dla lepszego UX */
.multiselect-cf7-container.disabled .multiselect-cf7-selected {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.multiselect-cf7-container.disabled .multiselect-cf7-arrow {
    color: #999;
}

/* Scrollbar dla dropdown */
.multiselect-cf7-dropdown::-webkit-scrollbar {
    width: 6px;
}

.multiselect-cf7-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.multiselect-cf7-dropdown::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.multiselect-cf7-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Style dla gdy są wybrane opcje */
.multiselect-cf7-container .multiselect-cf7-text.has-selection {
    color: #333;
    font-weight: 500;
}

/* Overlay dla zamykania na klik poza elementem */
.multiselect-cf7-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    display: none;
}

.multiselect-cf7-container.open + .multiselect-cf7-overlay {
    display: block;
}