/* home-autocomplete.css - тип груза, адреса и промежуточные адреса */

/* ==================== 9. АВТОДОПОЛНЕНИЕ ТИПА ГРУЗА ==================== */
.calculator-col.cargo-autocomplete-parent {
    position: relative;
}

.cargo-suggestions-container {
    position: absolute;
    z-index: 1000;
    background: var(--white);
    border: 2px solid var(--primary-blue);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-large);
    max-height: 400px;
    overflow-y: auto;
    width: 100%;
    scroll-behavior: smooth;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.cargo-suggestions-container.visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.suggestions-count {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--gray-600);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.cargo-suggestion-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    border-bottom: 1px solid var(--gray-100);
    outline: none;
    background: var(--white);
    font-family: 'Inter', sans-serif;
    text-align: left;
    line-height: 1.4;
    position: relative;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
}

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

.cargo-suggestion-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-blue);
}

.cargo-suggestion-item.selected {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-blue);
    font-weight: 500;
}

.cargo-suggestion-item.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-blue);
}

.suggestion-highlight {
    font-weight: 700;
    color: var(--primary-blue);
    background: rgba(59, 130, 246, 0.15);
    padding: 0 2px;
    border-radius: 3px;
}

.cargo-suggestions-container::-webkit-scrollbar {
    width: 8px;
}

.cargo-suggestions-container::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
    margin: 4px 0;
}

.cargo-suggestions-container::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
    border: 2px solid var(--white);
}

.cargo-suggestions-container::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

.cargo-suggestions-container {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-400) var(--gray-100);
}

/* ==================== 10. АВТОДОПОЛНЕНИЕ АДРЕСОВ ==================== */
.address-input-wrapper {
    position: relative;
    z-index: 10;
    margin-bottom: 1rem;
    width: 100%;
}

.address-suggestions-container {
    position: absolute;
    z-index: 1000;
    background: var(--white);
    border: 2px solid var(--primary-blue);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-large);
    max-height: 220px;
    overflow-y: auto;
    width: 100%;
    top: 100%;
    left: 0;
    margin-top: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    box-sizing: border-box;
}

.address-suggestions-container.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.address-suggestions-count {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    color: var(--gray-600);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 1;
    backdrop-filter: blur(10px);
    margin: 0;
    line-height: 1.2;
}

.address-suggestion-item {
    padding: 1rem;
    font-size: 0.9rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--gray-100);
    background: var(--white);
    font-family: 'Inter', sans-serif;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
    box-sizing: border-box;
    min-height: 80px;
}

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

.address-suggestion-item:hover {
    background: rgba(59, 130, 246, 0.08);
}

.address-suggestion-item.selected {
    background: rgba(59, 130, 246, 0.12);
}

.address-suggestion-item.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-blue);
}

.address-suggestion-main {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
    color: var(--text-dark);
    width: 100%;
    white-space: normal;
    word-break: break-word;
}

.address-suggestion-item.selected .address-suggestion-main,
.address-suggestion-item:hover .address-suggestion-main {
    color: var(--primary-blue);
}

.address-suggestion-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

.address-detail-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--gray-600);
    line-height: 1.2;
}

.address-detail-icon {
    width: 14px;
    text-align: center;
    color: var(--gray-500);
    flex-shrink: 0;
}

.address-detail-text {
    flex: 1;
    white-space: normal;
    word-break: break-word;
}

.address-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.5rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.1) 100%);
    color: var(--primary-blue);
    font-weight: 600;
    font-size: 0.75rem;
    border-radius: 4px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    margin-right: 0.5rem;
}

.address-coordinates {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(22, 163, 74, 0.1) 100%);
    color: #22c55e;
    font-weight: 600;
    font-size: 0.75rem;
    border-radius: 4px;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.coordinates-icon {
    font-size: 0.7rem;
}

.address-highlight {
    font-weight: 700;
    color: var(--primary-blue);
    background: rgba(59, 130, 246, 0.15);
    padding: 0 2px;
    border-radius: 3px;
}

.address-loading {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--gray-600);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    height: 140px;
    flex-direction: column;
}

.address-loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--gray-300);
    border-top: 2px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.address-loading-text {
    font-size: 0.9rem;
    color: var(--gray-600);
}

.address-error {
    padding: 2rem 1rem;
    text-align: center;
    color: #ef4444;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(239, 68, 68, 0.05);
    height: 140px;
    flex-direction: column;
}

.address-error-icon {
    color: #ef4444;
    font-size: 1.25rem;
}

.address-error-text {
    font-size: 0.9rem;
    color: #ef4444;
    max-width: 200px;
    line-height: 1.4;
}

.address-no-results {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.9rem;
    background: var(--gray-50);
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
}

.address-suggestions-container::-webkit-scrollbar {
    width: 6px;
}

.address-suggestions-container::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
    margin: 2px 0;
}

.address-suggestions-container::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.address-suggestions-container::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.address-suggestions-container {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) var(--gray-100);
}

.address-suggestions-container:not(.visible) {
    display: none;
}

.address-input-field:-webkit-autofill,
.address-input-field:-webkit-autofill:hover,
.address-input-field:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px white inset;
    -webkit-text-fill-color: var(--text-dark);
    transition: background-color 5000s ease-in-out 0s;
}

.address-cursor-end {
    cursor: text;
}

/* ==================== 11. ПРОМЕЖУТОЧНЫЕ АДРЕСА ==================== */
.intermediate-addresses-row {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.intermediate-address-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    position: relative;
    animation: fadeIn 0.3s ease-out;
    transition: all 0.3s ease;
}

.intermediate-address-item:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-soft);
}

.intermediate-address-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.125rem;
    min-height: 28px;
}

.intermediate-address-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    gap: 0.375rem;
    line-height: 1;
}

.intermediate-address-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--gradient-primary);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
}

.intermediate-address-delete {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    color: var(--gray-600);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
}

.intermediate-address-delete:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: var(--white);
    transform: rotate(90deg);
}

.intermediate-address-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.intermediate-address-row {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
    width: 100%;
}

.intermediate-address-input {
    flex: 1;
    min-width: 0;
}

.intermediate-address-box {
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 0.625rem 1rem;
    width: 100%;
    cursor: text;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 48px;
    max-height: 48px;
    overflow: hidden;
    position: relative;
}

.intermediate-address-box:hover,
.intermediate-address-box:focus-within {
    border-color: #8b5cf6;
    box-shadow: var(--shadow-medium);
    transform: translateY(-1px);
}

.intermediate-address-box .input-box-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(124, 58, 237, 0.1) 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.2);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.intermediate-address-box:hover .input-box-icon,
.intermediate-address-box:focus-within .input-box-icon {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: var(--white);
    transform: scale(1.05);
}

.intermediate-address-box .input-box-field {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dark);
    background: transparent;
    font-family: 'Inter', sans-serif;
    min-width: 0;
    width: 100%;
    padding: 0;
    line-height: 1.2;
}

.intermediate-address-box .input-box-field::placeholder {
    color: var(--gray-400);
    font-weight: 400;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Строка со способом загрузки для промежуточных адресов */
.intermediate-loading-methods-row {
    margin-top: 0.25rem;
}

.intermediate-loading-methods-box {
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    width: 100%;
    cursor: default;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-soft);
    min-height: 52px;
    max-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    overflow: hidden;
}

.intermediate-loading-methods-box:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-medium);
}

.intermediate-loading-methods-content {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    width: 100%;
    min-width: 0;
}

.loading-methods-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
}

.intermediate-loading-methods-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1;
}

.intermediate-loading-checkboxes {
    display: flex;
    flex-direction: row;
    gap: 0.875rem;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
    padding: 0.125rem 0;
}

.intermediate-loading-checkbox {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    flex-shrink: 0;
    min-width: fit-content;
}

.intermediate-loading-checkbox:hover {
    background: var(--gray-50);
}

.intermediate-loading-checkbox-input {
    display: none;
}

.intermediate-loading-checkbox-custom {
    width: 16px;
    height: 16px;
    min-width: 16px;
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    flex-shrink: 0;
    order: 1;
}

.intermediate-loading-checkbox-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-dark);
    white-space: nowrap;
    order: 2;
}

.intermediate-loading-checkbox-input:checked + .intermediate-loading-checkbox-custom {
    background: var(--gradient-primary);
    border-color: var(--primary-blue);
    transform: scale(1.05);
}

.intermediate-loading-checkbox-input:checked + .intermediate-loading-checkbox-custom::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
}

.intermediate-loading-checkbox-input:checked ~ .intermediate-loading-checkbox-text {
    color: var(--primary-blue);
    font-weight: 600;
}

/* Выпадающие подсказки для промежуточных адресов */
.intermediate-address-box .address-suggestions-container {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--white);
    border: 2px solid var(--primary-blue);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-large);
    max-height: 180px;
    overflow-y: auto;
    margin-top: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.intermediate-address-box .address-suggestions-container.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Стили для скроллбара в подсказках */
.intermediate-address-box .address-suggestions-container::-webkit-scrollbar {
    width: 4px;
}

.intermediate-address-box .address-suggestions-container::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 2px;
}

.intermediate-address-box .address-suggestions-container::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 2px;
}

.intermediate-address-box .address-suggestions-container::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.intermediate-address-box .address-suggestions-container {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) var(--gray-100);
}

/* Скролл для чекбоксов способов загрузки */
.intermediate-loading-checkboxes::-webkit-scrollbar {
    height: 3px;
}

.intermediate-loading-checkboxes::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 2px;
}

.intermediate-loading-checkboxes::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 2px;
}

.intermediate-loading-checkboxes::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.intermediate-loading-checkboxes {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) var(--gray-100);
}

/* Уведомление о лимите адресов */
.intermediate-addresses-limit {
    text-align: center;
    padding: 0.625rem;
    font-size: 0.85rem;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: var(--border-radius);
    margin-top: 0.375rem;
    animation: fadeIn 0.3s ease;
    display: none;
}

.intermediate-addresses-limit i {
    margin-right: 0.375rem;
    font-size: 0.8rem;
}

.intermediate-addresses-limit.visible {
    display: block;
}

/* Анимация для удаления адреса */
.intermediate-address-item.removing {
    opacity: 0;
    transform: translateX(-20px);
    max-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Стили для спецтехники (без способа загрузки) */
.intermediate-address-item.special-equipment .intermediate-loading-methods-row {
    display: none;
}

/* Эффект фокуса */
.intermediate-address-item:focus-within {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Стили для пустого адреса (ошибка валидации) */
.intermediate-address-box.invalid {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
    animation: shake 0.5s ease-in-out;
}

.intermediate-address-box.invalid .input-box-icon {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
}

/* Плавные переходы высоты контейнера */
.calculator-container.dynamic-height {
    transition: min-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.map-container.dynamic-height {
    transition: min-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
