/* 港口选择器样式 */
.port-selector {
    position: relative;
    width: 100%;
    min-width: 250px;
    flex-shrink: 0;
}

/* 验证错误状态样式 */
.is-invalid .port-selector .selector-input {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.is-invalid .port-selector .selector-input:hover,
.is-invalid .port-selector .selector-input:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* 在表单中的特殊样式 */
.col-md-4 .port-selector,
.col-md-6 .port-selector {
    min-width: 200px;
}

/* 选择器输入框 */
.selector-input {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid #e0e6ed;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.selector-input:hover {
    border-color: #2196f3;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.1);
}

.selector-input:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.selector-input.open {
    border-color: #2196f3;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

/* 选中显示区域 */
.selected-display {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.selected-text {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.selected-text.selected {
    color: #495057;
    font-weight: 500;
}

/* 箭头图标 */
.selector-arrow {
    color: #6c757d;
    font-size: 0.8rem;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

/* 下拉框 */
.selector-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    background: #fff;
    border: 1px solid #2196f3;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.selector-dropdown.dropup {
    top: auto;
    bottom: 100%;
    border-top: 1px solid #2196f3;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
}

/* 搜索区域 */
.dropdown-search {
    padding: 8px;
    border-bottom: 1px solid #e0e6ed;
    background: #f8f9fa;
    flex-shrink: 0;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 10px;
    color: #6c757d;
    font-size: 0.9rem;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    border: 1px solid #e0e6ed;
    border-radius: 4px;
    font-size: 0.9rem;
    background: #fff;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 2px;
    transition: background-color 0.2s ease;
}

.search-clear:hover {
    background: #e9ecef;
    color: #495057;
}

/* 下拉列表 */
.dropdown-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    min-height: 0;
}

/* 港口项 */
.port-item {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
    min-height: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    border-bottom: 1px solid #f8f9fa;
}

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

.port-item:hover {
    background: #f8f9fa;
}

.port-item.selected {
    background: #e3f2fd;
    color: #1976d2;
    font-weight: 500;
}

.port-main-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.port-name {
    color: #495057;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.port-code {
    color: #2196f3;
    font-weight: 600;
    font-size: 0.85rem;
    background: #e3f2fd;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
    flex-shrink: 0;
}

.port-item.selected .port-code {
    background: #1976d2;
    color: #fff;
}

.port-name-en {
    color: #6c757d;
    font-size: 0.8rem;
    line-height: 1.2;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.port-item.selected .port-name-en {
    color: #1565c0;
}

/* 分页区域 */
.dropdown-pagination {
    border-top: 1px solid #e0e6ed;
    background: #f8f9fa;
    padding: 8px 12px;
    flex-shrink: 0;
}

.pagination-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 8px;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.pagination-controls .btn {
    font-size: 0.8rem;
    padding: 4px 8px;
    min-width: 70px;
}

/* 状态消息 */
.loading-placeholder,
.error-message,
.empty-message {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #6c757d;
    font-size: 0.9rem;
    text-align: center;
}

.error-message {
    color: #dc3545;
}

.loading-placeholder {
    color: #2196f3;
}

/* 滚动条样式 */
.dropdown-list::-webkit-scrollbar {
    width: 6px;
}

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

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

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

/* 响应式设计 */
@media (max-width: 768px) {
    .port-selector {
        min-width: 200px;
    }

    .selector-input {
        padding: 12px;
        min-height: 48px;
    }

    .selected-text {
        font-size: 0.9rem;
    }

    .port-item {
        padding: 12px;
        min-height: 52px;
    }

    .port-name {
        font-size: 0.9rem;
    }

    .port-code {
        font-size: 0.8rem;
        padding: 3px 6px;
    }

    .port-name-en {
        font-size: 0.75rem;
    }

    .search-input {
        padding: 10px 12px 10px 34px;
        font-size: 0.9rem;
    }

    .dropdown-list {
        max-height: 250px;
    }

    .dropdown-list::-webkit-scrollbar {
        width: 8px;
    }

    .dropdown-list {
        scrollbar-width: thin;
    }
}

@media (max-width: 480px) {
    .port-selector {
        min-width: 180px;
    }

    .selector-input {
        padding: 10px;
        min-height: 44px;
    }

    .selected-text {
        font-size: 0.85rem;
    }

    .port-item {
        padding: 10px;
        min-height: 48px;
    }

    .port-name {
        font-size: 0.85rem;
    }

    .port-code {
        font-size: 0.75rem;
        padding: 2px 5px;
    }

    .port-name-en {
        font-size: 0.7rem;
    }

    .search-input {
        padding: 8px 10px 8px 30px;
        font-size: 0.85rem;
    }

    .search-icon {
        left: 8px;
        font-size: 0.8rem;
    }

    .search-clear {
        right: 6px;
        padding: 3px;
    }

    .pagination-info {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }

    .pagination-controls .btn {
        font-size: 0.75rem;
        padding: 3px 6px;
        min-width: 60px;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .selector-input {
        border-color: #000;
    }

    .selector-input:focus,
    .selector-input.open {
        border-color: #000;
        box-shadow: 0 0 0 2px #000;
    }

    .port-item.selected {
        background: #000;
        color: #fff;
    }

    .port-item.selected .port-code {
        background: #fff;
        color: #000;
    }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    .selector-input,
    .selector-arrow,
    .port-item,
    .search-input,
    .search-clear {
        transition: none;
    }
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
    .port-selector {
        color: #e9ecef;
    }

    .selector-input {
        background: #343a40;
        border-color: #495057;
        color: #e9ecef;
    }

    .selector-input:hover {
        border-color: #007bff;
        box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
    }

    .selector-input:focus,
    .selector-input.open {
        border-color: #007bff;
        box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.4);
    }

    .selected-text {
        color: #ced4da;
    }

    .selected-text.selected {
        color: #e9ecef;
    }

    .selector-arrow {
        color: #ced4da;
    }

    .selector-dropdown {
        background: #343a40;
        border-color: #007bff;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .dropdown-search {
        background: #495057;
        border-color: #6c757d;
    }

    .search-input {
        background: #343a40;
        border-color: #6c757d;
        color: #e9ecef;
    }

    .search-input:focus {
        border-color: #007bff;
        box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.4);
    }

    .search-icon {
        color: #ced4da;
    }

    .search-clear {
        color: #ced4da;
    }

    .search-clear:hover {
        background: #495057;
        color: #e9ecef;
    }

    .port-item {
        border-color: #495057;
    }

    .port-item:hover {
        background: #495057;
    }

    .port-item.selected {
        background: #1c5985;
        color: #e3f2fd;
    }

    .port-name {
        color: #e9ecef;
    }

    .port-code {
        background: #1c5985;
        color: #e3f2fd;
    }

    .port-item.selected .port-code {
        background: #007bff;
        color: #fff;
    }

    .port-name-en {
        color: #ced4da;
    }

    .dropdown-pagination {
        background: #495057;
        border-color: #6c757d;
    }

    .loading-placeholder,
    .error-message,
    .empty-message {
        color: #ced4da;
    }

    .error-message {
        color: #f8d7da;
    }

    .loading-placeholder {
        color: #b3d7ff;
    }

    .dropdown-list::-webkit-scrollbar-track {
        background: #495057;
    }

    .dropdown-list::-webkit-scrollbar-thumb {
        background: #6c757d;
    }

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