/**
 * Haminjo Smart Routing (دستیار هوشمند سفر شهری همینجو)
 */

/* —— تب‌های انتخاب حالت مسیریابی —— */
.hmj-rt-mode-tabs {
    display: flex;
    gap: 6px;
    background: var(--hmj-rt-soft, #f4f6f8);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 8px;
}

.hmj-rt-mode-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--hmj-rt-muted, #64748b);
    border: none;
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hmj-rt-mode-tab i {
    font-size: 13px;
    transition: transform 0.2s ease;
}

.hmj-rt-mode-tab.active {
    background: #ffffff;
    color: var(--hmj-rt-accent, #0F9F8A);
    box-shadow: 0 2px 8px rgba(15, 26, 20, 0.08);
}

.hmj-rt-mode-tab.active i {
    transform: scale(1.1);
}

/* —— پنل ورودی دستیار هوشمند —— */
.hmj-rt-smart-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
    transition: opacity 0.2s ease;
}

.hmj-rt-smart-panel[hidden] {
    display: none !important;
}

.hmj-rt-smart-input-wrap {
    position: relative;
    display: flex;
    align-items: flex-start;
    background: #ffffff;
    border: 1.5px solid var(--hmj-rt-border, #e2e8f0);
    border-radius: 12px;
    padding: 6px 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.hmj-rt-smart-input-wrap:focus-within {
    border-color: var(--hmj-rt-accent, #0F9F8A);
    box-shadow: 0 0 0 3px rgba(15, 159, 138, 0.15);
}

.hmj-rt-smart-icon {
    font-size: 15px;
    color: var(--hmj-rt-accent, #0F9F8A);
    margin-top: 6px;
    margin-left: 8px;
}

.hmj-rt-smart-prompt {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    font-family: inherit;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--hmj-rt-text, #0f172a);
    padding: 2px 0;
    min-height: 44px;
    max-height: 90px;
}

.hmj-rt-smart-prompt::placeholder {
    color: #94a3b8;
    font-size: 11.5px;
}

.hmj-rt-smart-voice-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--hmj-rt-soft, #f1f5f9);
    color: var(--hmj-rt-muted, #64748b);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    align-self: center;
}

.hmj-rt-smart-voice-btn:hover {
    background: #e2e8f0;
    color: var(--hmj-rt-accent, #0F9F8A);
}

.hmj-rt-smart-voice-btn.is-listening {
    background: #fee2e2 !important;
    color: #ef4444 !important;
    animation: hmjVoicePulse 1.2s infinite;
}

@keyframes hmjVoicePulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* —— چیپ‌های انتخاب سریع نیازها —— */
.hmj-rt-smart-chips {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.hmj-rt-smart-chips::-webkit-scrollbar {
    display: none;
}

.hmj-rt-smart-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 20px;
    border: 1px solid var(--hmj-rt-border, #e2e8f0);
    background: #ffffff;
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.hmj-rt-smart-chip i {
    font-size: 11px;
    color: var(--hmj-rt-accent, #0F9F8A);
}

.hmj-rt-smart-chip:hover {
    background: var(--hmj-rt-soft, #f8fafc);
    border-color: var(--hmj-rt-accent, #0F9F8A);
    color: var(--hmj-rt-accent, #0F9F8A);
}

.hmj-rt-smart-chip.is-added {
    background: #ecfdf5;
    border-color: #10b981;
    color: #065f46;
}

/* —— دکمه ثبت درخواست هوشمند —— */
.hmj-rt-smart-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #0F9F8A 0%, #0d8876 100%);
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(15, 159, 138, 0.28);
    transition: all 0.2s ease;
}

.hmj-rt-smart-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(15, 159, 138, 0.38);
}

.hmj-rt-smart-submit-btn:active {
    transform: translateY(0);
}

.hmj-rt-smart-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.hmj-rt-smart-submit-btn i {
    font-size: 14px;
}

/* —— نمایش وضعیت و مراحل پردازش هوشمند —— */
.hmj-rt-smart-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 12px;
    margin-top: 6px;
}

.hmj-rt-smart-progress__item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #166534;
}

.hmj-rt-smart-progress__item i {
    font-size: 13px;
    color: #0F9F8A;
}

.hmj-rt-smart-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #bbf7d0;
    border-top-color: #0F9F8A;
    border-radius: 50%;
    animation: hmjSpin 0.7s linear infinite;
}

@keyframes hmjSpin {
    to { transform: rotate(360deg); }
}

/* —— مارکرهای اختصاصی توقف‌ها روی نقشه MapLibre (هماهنگ با مبدا و مقصد) —— */
.hmj-smart-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    user-select: none;
    z-index: 10;
}

.hmj-smart-marker__pin {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: var(--hmj-primary, #0F9F8A);
    border: 2px solid #ffffff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hmj-smart-marker:hover .hmj-smart-marker__pin {
    transform: rotate(-45deg) scale(1.15);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.35);
}

.hmj-smart-marker__seq {
    transform: rotate(45deg);
    color: #ffffff;
    font-weight: 800;
    font-size: 12.5px;
    line-height: 1;
}

/* پنهان کردن لیبل‌های تداخلی متنی بزرگ روی نقشه جهت تمیز ماندن دید کاربر */
.hmj-smart-marker__label {
    display: none !important;
}

.hmj-smart-marker.is-origin .hmj-smart-marker__pin {
    background: #10b981;
}

.hmj-smart-marker.is-stop .hmj-smart-marker__pin {
    background: #0F9F8A;
}

.hmj-smart-marker.is-dest .hmj-smart-marker__pin {
    background: #ef4444;
}

/* —— تب‌های انتخاب مسیرهای پیشنهادی چندگانه هوشمند —— */
.hmj-smart-alt-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.hmj-smart-alt-tabs::-webkit-scrollbar {
    display: none;
}

.hmj-smart-alt-tab {
    flex: 1;
    min-width: 105px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 8px;
    background: #ffffff;
    border: 1.5px solid var(--hmj-rt-border, #e2e8f0);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.hmj-smart-alt-tab:hover {
    border-color: #0F9F8A;
    background: #f0fdf4;
}

.hmj-smart-alt-tab.active {
    background: #ecfdf5;
    border-color: #0F9F8A;
    box-shadow: 0 2px 8px rgba(15, 159, 138, 0.18);
}

.hmj-smart-alt-title {
    font-size: 11px;
    font-weight: 800;
    color: var(--hmj-rt-text, #0f172a);
}

.hmj-smart-alt-tab.active .hmj-smart-alt-title {
    color: #065f46;
}

.hmj-smart-alt-time {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
}

.hmj-smart-alt-tab.active .hmj-smart-alt-time {
    color: #047857;
}

/* —— گاه‌شمار و کارت‌های توقف در Bottom Sheet —— */
.hmj-smart-timeline {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 2px 0;
}

.hmj-smart-timeline__item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 7px 10px;
    background: #ffffff;
    border: 1px solid var(--hmj-rt-border, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
    cursor: pointer;
    transition: all 0.2s ease;
}

.hmj-smart-timeline__item:hover {
    border-color: var(--hmj-rt-accent, #0F9F8A);
    background: #f8fafc;
}

.hmj-smart-timeline__badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0F9F8A 0%, #0d8876 100%);
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(15, 159, 138, 0.25);
}

.hmj-smart-timeline__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.hmj-smart-timeline__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.hmj-smart-timeline__title {
    font-size: 12px;
    font-weight: 700;
    color: var(--hmj-rt-text, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hmj-smart-timeline__cat {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    padding: 1.5px 6px;
    border-radius: 5px;
    white-space: nowrap;
}

.hmj-smart-timeline__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    color: #64748b;
    margin-top: 1px;
}

.hmj-smart-timeline__meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.hmj-smart-timeline__meta span i {
    color: #0F9F8A;
}

.hmj-smart-badge-stop {
    background: #fef3c7;
    color: #92400e;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 9.5px;
}

.hmj-smart-summary-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1px solid #a7f3d0;
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 8px;
}

.hmj-smart-summary-time {
    display: flex;
    flex-direction: column;
}

.hmj-smart-summary-time strong {
    font-size: 15px;
    font-weight: 800;
    color: #065f46;
    line-height: 1.25;
}

.hmj-smart-summary-time span {
    font-size: 10.5px;
    color: #047857;
    margin-top: 1px;
}

.hmj-smart-summary-dist {
    font-size: 12px;
    font-weight: 700;
    color: #065f46;
}


/* —— Responsive mobile smart panel (جمع‌وجور و متناسب روی گوشی) —— */
@media (max-width: 768px) {
    .hmj-rt-mode-tabs {
        padding: 2.5px;
        gap: 4px;
        margin-bottom: 5px;
        border-radius: 10px;
    }

    .hmj-rt-mode-tab {
        padding: 5px 8px;
        font-size: 11.5px;
        border-radius: 8px;
    }

    .hmj-rt-smart-panel {
        gap: 5px;
        margin-top: 4px;
    }

    .hmj-rt-smart-input-wrap {
        padding: 4px 8px;
        border-radius: 10px;
    }

    .hmj-rt-smart-prompt {
        min-height: 32px;
        max-height: 56px;
        font-size: 12px;
        line-height: 1.35;
    }

    .hmj-rt-smart-chip {
        padding: 3px 8px;
        font-size: 11px;
    }

    .hmj-rt-smart-chips {
        gap: 4px;
    }

    .hmj-rt-smart-submit {
        min-height: 34px;
        padding: 6px 10px;
        font-size: 12px;
    }
}
