.tracking-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(1, 9, 20, .78);
    backdrop-filter: blur(12px);
    overflow: auto;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    animation: fadeInModal 0.25s ease-out forwards;
    direction: rtl;
}

@keyframes fadeInModal {
    to {
        opacity: 1;
    }
}

.tracking-modal-panel {
    width: min(1240px, 94vw);
    height: min(820px, 92vh);
    background: #071321;
    border-radius: 26px;
    box-shadow: 0 28px 100px rgba(0, 0, 0, .48), 0 0 50px rgba(4, 249, 180, .1);
    border: 1px solid rgba(4, 249, 180, .24);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transform: scale(.98);
    animation: scaleUpPanel .25s ease-out forwards;
}

@keyframes scaleUpPanel {
    to {
        transform: scale(1);
    }
}

.close-tracking-modal {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.close-tracking-modal:hover {
    background: var(--primary-color, #04f9b4);
    color: #000;
    border-color: var(--primary-color, #04f9b4);
}

.close-tracking-modal:focus-visible {
    outline: 3px solid #04f9b4;
    outline-offset: 3px;
}

.tracking-content-wrapper {
    display: grid;
    grid-template-columns: minmax(300px, .84fr) minmax(0, 1.16fr);
    height: 100%;
    width: 100%;
    min-width: 0;
}

.tracking-map-side {
    min-width: 0;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at 45% 45%, rgba(4, 249, 180, .08), transparent 68%);
    padding: clamp(18px, 3vw, 38px);
}

.tracking-map-frame {
    width: 100%;
    height: min(690px, 78vh);
    min-height: 390px;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 13px;
    padding: 18px;
    border: 1px solid rgba(157, 188, 205, .17);
    border-radius: 24px;
    background: linear-gradient(155deg, rgba(12, 31, 48, .98), rgba(5, 16, 30, .98));
    box-shadow: 0 22px 60px rgba(0, 0, 0, .3), inset 0 1px rgba(255, 255, 255, .04);
}

.tracking-map-heading,
.tracking-map-brand,
.tracking-map-live,
.tracking-map-legend,
.tracking-map-legend span {
    display: flex;
    align-items: center;
}

.tracking-map-heading {
    min-height: 48px;
    justify-content: space-between;
    gap: 12px;
    padding-inline: 2px;
}

.tracking-map-brand { gap: 11px; min-width: 0; }

.tracking-map-brand-mark {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(4, 249, 180, .38);
    border-radius: 14px;
    background: rgba(4, 249, 180, .09);
    color: #04f9b4;
    font: 800 13px/1 Inter, Arial, sans-serif;
    letter-spacing: -.5px;
}

.tracking-map-brand>span:last-child { display: grid; gap: 3px; }
.tracking-map-brand strong { color: #f4fbff; font-size: 15px; font-weight: 800; }
.tracking-map-brand small { color: #93a9b7; font-size: 11px; }

.tracking-map-live {
    gap: 7px;
    padding: 8px 10px;
    border: 1px solid rgba(4, 249, 180, .2);
    border-radius: 999px;
    background: rgba(4, 249, 180, .07);
    color: #a7ffdf;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.tracking-map-live i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #04f9b4;
    box-shadow: 0 0 10px rgba(4, 249, 180, .8);
}

.tracking-map-legend { gap: 8px; flex-wrap: wrap; }
.tracking-map-legend span {
    gap: 7px;
    min-height: 30px;
    padding: 5px 9px;
    border: 1px solid rgba(157, 188, 205, .13);
    border-radius: 999px;
    background: rgba(255, 255, 255, .035);
    color: #d7e5ea;
    font-size: 10px;
    font-weight: 600;
}
.tracking-map-legend span:first-child i { color: #04f9b4; }
.tracking-map-legend span:last-child i { color: #4fc8ff; }

.tracking-info-side {
    min-width: 0;
    padding: clamp(26px, 4vw, 52px) clamp(22px, 4vw, 48px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #fff;
    overflow-y: auto;
    border-inline-start: 1px solid rgba(157, 188, 205, .12);
}

.tracking-info-side h2 {
    color: var(--primary-color, #04f9b4);
    font-size: clamp(1.7rem, 2.4vw, 2.3rem);
    margin: 0 0 1.5rem;
    text-shadow: 0 0 20px rgba(4, 249, 180, 0.3);
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.info-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.status-badge {
    display: inline-block;
    margin-top: 2rem;
    padding: 1rem 2rem;
    background: rgba(4, 249, 180, 0.1);
    border: 1px solid var(--primary-color, #04f9b4);
    color: var(--primary-color, #04f9b4);
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 0 15px rgba(4, 249, 180, 0.2);
}

#map {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 1px solid rgba(122, 163, 185, .22);
    border-radius: 18px;
    overflow: hidden;
    background: #081725;
    box-shadow: inset 0 0 24px rgba(4, 249, 180, .08), 0 12px 30px rgba(0, 0, 0, .24);
    z-index: 1;
}

.tracking-map-caption {
    position: absolute;
    z-index: 800;
    right: 12px;
    top: 12px;
    bottom: auto;
    left: 12px;
    max-width: min(520px, calc(100% - 24px));
    margin: 0;
    padding: 10px 13px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 12px;
    background: rgba(4, 16, 29, .9);
    color: #f3fafc;
    font-size: 12px;
    line-height: 1.5;
    text-align: right;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
    pointer-events: none;
}

.tracking-map-footnote {
    margin: 0 2px;
    color: #8299a8;
    font-size: 10px;
    line-height: 1.5;
}

.tracking-map-marker { background: transparent; border: 0; }
.tracking-map-pin {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 2px solid rgba(255, 255, 255, .92);
    border-radius: 50% 50% 50% 16%;
    transform: rotate(-45deg);
    color: #041821;
    font-size: 18px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .42), 0 0 20px rgba(4, 249, 180, .3);
}

.tracking-map-pin i { transform: rotate(45deg); }
.tracking-map-pin.is-driver { background: linear-gradient(145deg, #58ffd0, #04d99f); }
.tracking-map-pin.is-destination { background: linear-gradient(145deg, #a9e8ff, #39aeea); color: #09253a; box-shadow: 0 8px 22px rgba(0, 0, 0, .42), 0 0 18px rgba(79, 200, 255, .28); }

.tracking-map-frame .leaflet-control-zoom a {
    background: rgba(5, 18, 31, .93);
    border-color: rgba(255, 255, 255, .14);
    color: #eaf8fb;
}

.tracking-map-frame .leaflet-control-attribution {
    background: rgba(5, 18, 31, .72);
    color: #b3c6ce;
    font-size: 9px;
}

.tracking-map-frame .leaflet-control-attribution a { color: #8cebd2; }

@media (max-width: 900px) {
    .tracking-modal-overlay { align-items: flex-start; padding: 12px; }
    .tracking-modal-panel { width: min(760px, 100%); height: calc(100dvh - 24px); min-height: 0; border-radius: 22px; }
    .tracking-content-wrapper { display: flex; flex-direction: column; overflow-y: auto; }
    .tracking-map-side { order: -1; flex: 0 0 auto; min-height: 0; padding: 16px; }
    .tracking-map-frame { height: min(48vh, 440px); min-height: 310px; padding: 14px; gap: 10px; }
    .tracking-info-side { flex: 0 0 auto; overflow: visible; padding: 22px 22px 30px; border-inline-start: 0; border-top: 1px solid rgba(157, 188, 205, .12); }
    .tracking-info-side h2 { margin-bottom: 1rem; }
}

@media (max-width: 520px) {
    .tracking-modal-overlay { padding: 0; }
    .tracking-modal-panel { width: 100%; height: 100dvh; border-radius: 0; border-inline: 0; }
    .close-tracking-modal { top: 10px; right: 10px; width: 38px; height: 38px; }
    .tracking-map-side { padding: 12px; }
    .tracking-map-frame { height: 45vh; min-height: 280px; padding: 11px; border-radius: 19px; }
    .tracking-map-heading { padding-inline: 42px 0; }
    .tracking-map-brand-mark { width: 36px; height: 36px; flex-basis: 36px; border-radius: 12px; }
    .tracking-map-live { padding: 7px 8px; font-size: 9px; }
    .tracking-map-caption { right: 8px; top: 8px; bottom: auto; left: 8px; max-width: calc(100% - 16px); font-size: 11px; }
    .info-grid { grid-template-columns: 1fr; gap: 1rem; padding: 1.2rem; }
    .tracking-info-side { padding: 20px 18px 28px; }
    .status-badge { margin-top: 1.1rem; padding: .75rem 1.2rem; font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .tracking-modal-overlay,
    .tracking-modal-panel { animation: none; opacity: 1; transform: none; }
    .close-tracking-modal { transition: none; }
}
