/* MapCafe navigation page – ported from WordPress (mapcafe-nav-template-output) + responsive/mobile hardening. */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: Vazirmatn, Tahoma, sans-serif;
}

#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
}

/* آیکون‌های SVG داخلی */
.mi {
    vertical-align: -3px;
    flex: none;
}

.step-card .step-meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.status-mini,
.toast {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.start-btn,
.location-status,
.mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.start-overlay .location-status {
    display: inline-flex;
}

.close-nav-btn {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    z-index: 10001;
    width: 42px;
    height: 42px;
    background: linear-gradient(165deg, rgba(38, 48, 62, 0.92), rgba(14, 20, 28, 0.92));
    backdrop-filter: blur(10px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: background 0.2s, transform 0.1s;
    text-decoration: none;
    padding: 0;
}

.close-nav-btn:active {
    transform: scale(0.92);
}

.close-nav-btn:hover {
    background: linear-gradient(165deg, rgba(52, 64, 82, 0.95), rgba(20, 28, 38, 0.95));
}

/* بازگشت به صفحهٔ اصلی پلتفرم - گوشهٔ چپ بالا */
.nav-home-btn {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: calc(12px + env(safe-area-inset-left, 0px));
    z-index: 10001;
    width: 42px;
    height: 42px;
    background: linear-gradient(165deg, rgba(38, 48, 62, 0.92), rgba(14, 20, 28, 0.92));
    backdrop-filter: blur(10px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: background 0.2s, transform 0.1s;
    text-decoration: none;
    padding: 0;
}

.nav-home-btn:active {
    transform: scale(0.92);
}

.nav-home-btn:hover {
    background: linear-gradient(165deg, rgba(52, 64, 82, 0.95), rgba(20, 28, 38, 0.95));
}

.start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(120% 90% at 50% 0%, rgba(30, 60, 100, 0.72), rgba(6, 12, 22, 0.88));
    backdrop-filter: blur(10px) saturate(1.2);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

.start-btn {
    background: linear-gradient(160deg, #42a5f5 0%, #1E88E5 45%, #0d47a1 100%);
    color: #fff;
    border: none;
    padding: 16px 32px;
    border-radius: 18px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(13, 71, 161, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    transition: transform 0.12s, box-shadow 0.2s;
    min-height: 54px;
    font-family: inherit;
}

.start-btn:disabled {
    background: linear-gradient(160deg, #b0bec5, #78909c);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.85;
}

.start-btn:active:not(:disabled) {
    transform: scale(0.96);
}

.location-status {
    color: #fff;
    font-size: 14px;
    text-align: center;
    opacity: 0.9;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.mode-selector {
    display: flex;
    gap: 10px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    padding: 8px;
    border-radius: 18px;
    backdrop-filter: blur(12px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
}

.mode-btn {
    background: transparent;
    border: 2px solid transparent;
    color: #fff;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-family: inherit;
    min-height: 44px;
}

.mode-btn.active {
    background: linear-gradient(160deg, rgba(66, 165, 245, 0.9), rgba(21, 101, 192, 0.9));
    border-color: rgba(187, 222, 251, 0.9);
    box-shadow: 0 8px 20px rgba(21, 101, 192, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.mode-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.16);
}

.step-card {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 12px;
    right: 12px;
    z-index: 999;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(240, 246, 253, 0.93));
    backdrop-filter: blur(14px) saturate(1.25);
    padding: 12px 14px;
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(10, 32, 64, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    display: none;
    flex-direction: column;
    border-right: 5px solid #1E88E5;
    pointer-events: none;
    overflow: hidden;
}

/* رگهٔ نور بالای کارت راهنما: عمق شیشه‌ای و حس «پرمیوم» */
.step-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(30, 136, 229, 0), rgba(30, 136, 229, 0.55), rgba(30, 136, 229, 0));
}

.step-card .step-text {
    font-size: 17px;
    font-weight: 700;
    color: #10203a;
    line-height: 1.55;
}

/* نشانگر مانور: نخستین آیکون متن به یک نشان رنگی تبدیل می‌شود تا کاربر در
   یک نگاه «پیچ بعدی» را ببیند. */
.step-card .step-text > .mi:first-child {
    width: 38px;
    height: 38px;
    padding: 8px;
    border-radius: 12px;
    background: linear-gradient(160deg, #3aa0ff 0%, #1E88E5 45%, #1258a8 100%);
    color: #fff;
    box-shadow: 0 6px 14px rgba(21, 101, 192, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    margin-inline-end: 8px;
    vertical-align: middle;
}

.step-card .step-meta {
    font-size: 12px;
    color: #4a5b70;
    margin-top: 5px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.step-card .step-meta span {
    background: rgba(30, 136, 229, 0.1);
    border: 1px solid rgba(30, 136, 229, 0.16);
    padding: 3px 11px;
    border-radius: 20px;
    font-weight: 600;
}

/* وقتی دکمهٔ بستن (پنل بازاریاب) حاضر است، کارت راهنما کمی پایین‌تر بیاید */
body:has(.close-nav-btn) .step-card {
    top: calc(64px + env(safe-area-inset-top, 0px));
}

.info-overlay {
    position: absolute;
    bottom: 180px;
    left: 12px;
    z-index: 999;
    display: none;
    flex-direction: column;
    gap: 4px;
    pointer-events: none;
}

.info-overlay.active {
    display: flex;
}

.info-overlay .speed-box {
    background: linear-gradient(165deg, rgba(28, 36, 48, 0.92), rgba(10, 15, 22, 0.88));
    backdrop-filter: blur(12px) saturate(1.2);
    padding: 9px 16px 10px;
    border-radius: 16px;
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    text-align: center;
    min-width: 78px;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.info-overlay .speed-box .unit {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.72;
    letter-spacing: 0.4px;
}

.info-overlay .speed-box .label {
    font-size: 10px;
    opacity: 0.55;
    font-weight: 500;
    margin-top: 2px;
    letter-spacing: 0.6px;
}

.bottom-bar {
    position: absolute;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    right: 12px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.bottom-bar > * {
    pointer-events: auto;
}

.btn-row {
    display: flex;
    gap: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(240, 246, 253, 0.72));
    backdrop-filter: blur(16px) saturate(1.3);
    padding: 7px 10px;
    border-radius: 24px;
    box-shadow: 0 10px 26px rgba(10, 32, 64, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.85);
    justify-content: space-evenly;
    align-items: center;
    flex-wrap: wrap;
    border: 1px solid rgba(255, 255, 255, 0.55);
}

.btn-row button {
    border: none;
    background: rgba(255, 255, 255, 0.55);
    padding: 6px 8px;
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.2s, transform 0.12s, box-shadow 0.2s;
    color: #24364d;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: inherit;
    font-size: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.btn-row button:active {
    transform: scale(0.94);
}

.btn-row button.danger {
    background: linear-gradient(160deg, #ef5350, #c62828);
    color: #fff;
    box-shadow: 0 4px 12px rgba(198, 40, 40, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-row button.danger:active {
    background: linear-gradient(160deg, #e53935, #b71c1c);
}

.btn-row button.voice-btn {
    background: linear-gradient(160deg, #ffa726, #ef6c00);
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 108, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-row button.voice-btn.speaking {
    background: linear-gradient(160deg, #66bb6a, #2e7d32);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-row button.voice-btn:active {
    background: linear-gradient(160deg, #fb8c00, #e65100);
}

.btn-row button.recenter-btn {
    background: linear-gradient(160deg, #42a5f5, #1565c0);
    color: #fff;
    font-size: 18px;
    display: none;
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-row button.recenter-btn:active {
    background: linear-gradient(160deg, #1e88e5, #0d47a1);
}

.btn-row button.track-btn {
    background: linear-gradient(160deg, #66bb6a, #2e7d32);
    color: #fff;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-row button.track-btn:active {
    background: linear-gradient(160deg, #4caf50, #1b5e20);
}

.btn-row button.track-btn.off {
    background: linear-gradient(160deg, rgba(189, 189, 189, 0.85), rgba(117, 117, 117, 0.8));
    color: #f5f5f5;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.status-mini {
    font-size: 12px;
    color: #33465e;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(6px);
    padding: 5px 13px;
    border-radius: 30px;
    box-shadow: none;
    border: 1px solid rgba(20, 40, 70, 0.1);
    /* چیپ وضعیت یک نمایشگر است نه دکمه؛ نباید کلیک بگیرد یا مثل دکمه به‌نظر برسد. */
    pointer-events: none;
    white-space: nowrap;
    font-weight: 600;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast {
    position: absolute;
    bottom: 190px;
    left: 20px;
    right: 20px;
    z-index: 2000;
    background: linear-gradient(165deg, rgba(28, 36, 48, 0.94), rgba(10, 15, 22, 0.9));
    backdrop-filter: blur(12px) saturate(1.2);
    color: #fff;
    padding: 11px 18px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==== پکِ خودرو/موتور/عابر و نشان مقصد ==== */
/* پک روی جاده می‌نشیند و نباید کلیک بگیرد یا لبه‌هایش بریده شود؛ فقط سایهٔ
   نرم زیر آن عمق می‌دهد (خودِ SVG سایهٔ زمین را دارد). */
.nav-vehicle-marker {
    overflow: visible;
}

.nav-vehicle-marker svg {
    display: block;
    overflow: visible;
}

/* نشان مقصد: سنجاق قرمز با حلقهٔ سفید، نقطهٔ مرکزی روشن و هالهٔ نرم. */
.nav-dest-marker {
    position: relative;
    width: 30px;
    height: 30px;
    pointer-events: none;
    z-index: 9998;
}

.nav-dest-marker .nav-dest-ring {
    position: absolute;
    inset: 0;
    border-radius: 50% 50% 50% 50%;
    background: radial-gradient(circle at 50% 35%, #ff8a80 0%, #e53935 45%, #b71c1c 100%);
    border: 3px solid #fff;
    box-shadow: 0 6px 16px rgba(140, 20, 15, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.nav-dest-marker .nav-dest-halo {
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 2px solid rgba(229, 57, 53, 0.5);
    animation: navDestPulse 2.2s ease-out infinite;
}

@keyframes navDestPulse {
    0% {
        transform: scale(0.82);
        opacity: 0.85;
    }

    70% {
        transform: scale(1.18);
        opacity: 0;
    }

    100% {
        transform: scale(1.18);
        opacity: 0;
    }
}

/* ==== ریسپانسیو موبایل (۳۲۰ تا ۱۰۲۴+) ==== */
@media (max-width: 400px) {
    .step-card .step-text {
        font-size: 15px;
    }

    .step-card .step-text > .mi:first-child {
        width: 34px;
        height: 34px;
        padding: 7px;
    }

    .btn-row {
        gap: 4px;
        padding: 6px;
    }

    .btn-row button {
        min-width: 40px;
        min-height: 40px;
        font-size: 13px;
    }

    .status-mini {
        font-size: 11px;
        padding: 3px 9px;
    }

    .mode-btn {
        padding: 8px 12px;
        font-size: 14px;
    }

    .info-overlay {
        bottom: 150px;
    }

    .toast {
        bottom: 160px;
        left: 12px;
        right: 12px;
    }
}

@media (min-width: 768px) {
    .step-card {
        max-width: 520px;
        margin: 0 auto;
    }

    .bottom-bar {
        max-width: 520px;
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}
