.dropdown-container {
    position: relative;
    display: inline-block;
}

.dropdown-trigger:not(.split-button) {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-primary);
    color: var(--color-text-white);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-base);
    min-width: 140px;
    justify-content: space-between;
}

.dropdown-trigger:not(.split-button):hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.text-input-component .dropdown-trigger:not(.split-button),
.form-group .dropdown-trigger:not(.split-button) {
    background: linear-gradient(to bottom,
        var(--color-bg-primary) 0%,
        var(--color-gray-50) 100%);
    color: var(--color-text-primary);
    border: 2px solid var(--color-border-medium);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 16px;
    font-weight: 400;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06),
                inset 0 1px 2px rgba(0, 0, 0, 0.08);
    transition: all var(--transition-cubic);
}

.text-input-component .dropdown-trigger:not(.split-button):hover,
.form-group .dropdown-trigger:not(.split-button):hover {
    border-color: var(--color-border-dark);
    background: var(--color-bg-primary);
    transform: none;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.text-input-component .dropdown-trigger:not(.split-button):focus,
.form-group .dropdown-trigger:not(.split-button):focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-bg-primary);
    box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), 0.12),
                0 2px 8px rgba(var(--color-primary-rgb), 0.15),
                inset 0 1px 2px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.text-input-component .dropdown-text,
.form-group .dropdown-text {
    color: var(--color-text-primary);
    font-weight: 400;
}

.text-input-component .dropdown-trigger:not(.split-button):not(.has-selection) .dropdown-text,
.form-group .dropdown-trigger:not(.split-button):not(.has-selection) .dropdown-text {
    color: var(--color-text-tertiary);
    opacity: 0.7;
}

.text-input-component .dropdown-arrow,
.form-group .dropdown-arrow {
    color: var(--color-text-tertiary);
    font-size: 12px;
}

.text-input-component .dropdown-trigger:not(.split-button):focus .dropdown-arrow,
.form-group .dropdown-trigger:not(.split-button):focus .dropdown-arrow {
    color: var(--color-primary);
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform var(--transition-base);
}

.dropdown-open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 160px;
    z-index: 9999;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.text-input-component .dropdown-menu,
.form-group .dropdown-menu {
    border: 2px solid var(--color-border-medium);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
                0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 8px;
    left: 0;
    right: auto;
    min-width: 100%;
    max-height: 300px;
    overflow-y: auto;
}

.dropdown-item {
    padding: 10px var(--spacing-md);
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid var(--color-gray-100);
    transition: background-color var(--transition-base);
}

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

.dropdown-item:hover {
    background: var(--color-bg-tertiary);
}

.dropdown-item.selected {
    background: var(--gradient-info);
    color: var(--color-info);
    font-weight: 500;
}

.text-input-component .dropdown-item,
.form-group .dropdown-item {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 16px;
    border-bottom: 1px solid var(--color-border-light);
    transition: all var(--transition-base);
}

.text-input-component .dropdown-item:hover,
.form-group .dropdown-item:hover {
    background: linear-gradient(to right,
        var(--color-bg-tertiary) 0%,
        var(--color-gray-50) 100%);
    border-left: 3px solid var(--color-primary);
    padding-left: calc(var(--spacing-lg) - 3px);
}

.text-input-component .dropdown-item.selected,
.form-group .dropdown-item.selected {
    background: linear-gradient(135deg,
        var(--color-primary-light) 0%,
        var(--color-bg-primary) 100%);
    color: var(--color-primary);
    font-weight: 500;
    border-left: 3px solid var(--color-primary);
    padding-left: calc(var(--spacing-lg) - 3px);
}

.text-input-component .dropdown-trigger.error:not(.split-button),
.form-group .dropdown-trigger.error:not(.split-button) {
    border-color: var(--color-error);
    background: linear-gradient(to bottom,
        rgba(var(--color-error-rgb), 0.05) 0%,
        rgba(var(--color-error-rgb), 0.02) 100%);
}

.text-input-component .dropdown-trigger.error:not(.split-button):focus,
.form-group .dropdown-trigger.error:not(.split-button):focus {
    border-color: var(--color-error);
    box-shadow: 0 0 0 4px rgba(var(--color-error-rgb), 0.12),
                0 2px 8px rgba(var(--color-error-rgb), 0.15),
                inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dropdown-error {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(var(--color-error-rgb), 0.1);
    border: 1px solid rgba(var(--color-error-rgb), 0.2);
    border-radius: var(--radius-md);
    color: var(--color-error);
    font-size: 14px;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.address-component .dropdown-error {

    box-shadow: 0 2px 8px rgba(var(--color-error-rgb), 0.15);
}

.dropdown-trigger.unlocked:not(.split-button) {
    background: var(--gradient-success-solid);
    box-shadow: var(--shadow-md);
}

.dropdown-trigger.unlocked:not(.split-button):hover {
    background: var(--color-success-dark);
    box-shadow: var(--shadow-lg);
}

.dropdown-trigger.unlocked:not(.split-button)::before {
    content: '🔓';
    margin-right: 4px;
    font-size: 12px;
}

.dropdown-trigger.split-button {
    display: flex;
    padding: 0;
    background: none;
    border: none;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.dropdown-main-button {
    flex: 1;
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-primary);
    color: var(--color-text-white);
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;

    transition: background-color var(--transition-base),
                box-shadow var(--transition-base),
                filter var(--transition-base);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.dropdown-arrow-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) 10px;
    background: var(--color-primary-dark);
    color: var(--color-text-white);
    border: none;
    border-left: 1px solid rgba(255, 255, 255, var(--opacity-20));
    cursor: pointer;

    transition: background-color var(--transition-base),
                box-shadow var(--transition-base),
                filter var(--transition-base);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    min-width: 32px;
}

.dropdown-main-button:hover {

    filter: brightness(1.1);
}

.dropdown-arrow-button:hover {

    filter: brightness(1.1);
}

.dropdown-trigger.split-button.unlocked .dropdown-main-button {
    background: var(--gradient-success-solid);
}

.dropdown-trigger.split-button.unlocked .dropdown-arrow-button {
    background: var(--color-success-dark);
    border-left-color: rgba(255, 255, 255, var(--opacity-30));
}

.dropdown-trigger.split-button.unlocked .dropdown-main-button:hover {

    filter: brightness(1.1);
}

.dropdown-trigger.split-button.unlocked .dropdown-arrow-button:hover {

    filter: brightness(1.1);
}

.dropdown-trigger.split-button.unlocked .dropdown-main-button::before {
    content: '🔓';
    margin-right: 4px;
    font-size: 12px;
}

.dropdown-trigger:focus,
.dropdown-main-button:focus,
.dropdown-arrow-button:focus {
    outline: 2px solid var(--color-info);
    outline-offset: 2px;
}

.dropdown-item:focus {
    background: var(--gradient-info);
    outline: none;
}

@media (max-width: 768px) {
    .dropdown-trigger:not(.split-button) {
        min-width: auto;
        padding: 8px 10px;
    }

    .text-input-component .dropdown-trigger:not(.split-button),
    .form-group .dropdown-trigger:not(.split-button) {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 16px;
    }

    .text-input-component .dropdown-menu,
    .form-group .dropdown-menu {
        margin-top: 4px;
    }

    .text-input-component .dropdown-item,
    .form-group .dropdown-item {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 16px;
    }

    .dropdown-main-button {
        padding: 8px 10px;
        font-size: 13px;
    }

    .dropdown-arrow-button {
        padding: 8px 8px;
        min-width: 28px;
    }

    .dropdown-menu {
        right: -10px;
        min-width: 140px;
    }
}

.dark-mode .text-input-component .dropdown-trigger:not(.split-button),
.dark-mode .form-group .dropdown-trigger:not(.split-button) {
    background: linear-gradient(to bottom,
        var(--color-bg-primary) 0%,
        var(--color-gray-800) 100%);
    border-color: var(--color-border-medium);
    color: var(--color-text-primary);
}

.dark-mode .text-input-component .dropdown-trigger:not(.split-button):hover,
.dark-mode .form-group .dropdown-trigger:not(.split-button):hover {
    border-color: var(--color-border-dark);
    background: var(--color-bg-primary);
}

.dark-mode .text-input-component .dropdown-trigger:not(.split-button):focus,
.dark-mode .form-group .dropdown-trigger:not(.split-button):focus {
    border-color: var(--color-primary);
    background: var(--color-bg-primary);
}

.dark-mode .text-input-component .dropdown-menu,
.dark-mode .form-group .dropdown-menu {
    background: var(--color-bg-primary);
    border-color: var(--color-border-medium);
}

.dark-mode .text-input-component .dropdown-item,
.dark-mode .form-group .dropdown-item {
    border-bottom-color: var(--color-border-light);
}

.dark-mode .text-input-component .dropdown-item:hover,
.dark-mode .form-group .dropdown-item:hover {
    background: linear-gradient(to right,
        var(--color-bg-tertiary) 0%,
        var(--color-gray-800) 100%);
}

@media (prefers-contrast: high) {
    .dropdown-trigger:not(.split-button),
    .dropdown-main-button,
    .dropdown-arrow-button {
        border: 2px solid white;
    }

    .dropdown-menu {
        border: 2px solid black;
    }

    .dropdown-item:hover,
    .dropdown-item.selected {
        border: 1px solid black;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dropdown-trigger,
    .dropdown-main-button,
    .dropdown-arrow-button,
    .dropdown-item,
    .dropdown-arrow {
        transition: none;
    }

    .dropdown-trigger:hover,
    .dropdown-main-button:hover,
    .dropdown-arrow-button:hover {
        transform: none;
    }
}

@media print {
    .dropdown-menu {
        display: none !important;
    }
}