/* =========================================================
   AVGUST ROLE PLAY — GTA SA INTERACTIVE MAP
   ========================================================= */

.map-page-head {
    margin-bottom: 14px;
}

.state-map-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.state-map-sidebar {
    position: sticky;
    top: 103px;
    padding: 15px;
    z-index: 10;
}

.state-map-sidebar__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 13px;
    border-bottom: 1px solid rgba(184, 77, 230, .12);
}

.state-map-sidebar__head h3 {
    margin: 3px 0 0;
}

.map-mini-label {
    display: block;
    color: #8e7a99;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.map-live-dot {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 7px;
    border: 1px solid rgba(74, 221, 145, .22);
    border-radius: 999px;
    background: rgba(74, 221, 145, .05);
    color: #85eaae;
    font-size: 7px;
    font-weight: 900;
    letter-spacing: .8px;
}

.map-live-dot::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #4add91;
    box-shadow: 0 0 7px rgba(74, 221, 145, .75);
}

.map-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.map-stat {
    min-width: 0;
    padding: 10px;
    border: 1px solid rgba(183, 77, 228, .12);
    border-radius: 10px;
    background: rgba(255, 255, 255, .012);
}

.map-stat strong {
    display: block;
    color: #deb6ef;
    font-size: 18px;
}

.map-stat span {
    display: block;
    margin-top: 2px;
    color: #786a81;
    font-size: 7px;
    font-weight: 800;
    letter-spacing: .8px;
    text-transform: uppercase;
}

.map-control-group {
    padding: 13px 0;
    border-bottom: 1px solid rgba(184, 77, 230, .10);
}

.map-control-group:last-of-type {
    border-bottom: 0;
}

.map-control-title {
    margin-bottom: 8px;
    color: #8f7d99;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .8px;
    text-transform: uppercase;
}

.map-switch {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 34px;
    cursor: pointer;
    user-select: none;
}

.map-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.map-switch-ui {
    position: relative;
    width: 31px;
    height: 17px;
    flex: 0 0 31px;
    border: 1px solid rgba(178, 75, 222, .20);
    border-radius: 999px;
    background: #0b0910;
    transition: .18s ease;
}

.map-switch-ui::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #796b80;
    transition: .18s ease;
}

.map-switch input:checked + .map-switch-ui {
    border-color: rgba(205, 99, 245, .42);
    background: rgba(168, 65, 211, .16);
}

.map-switch input:checked + .map-switch-ui::after {
    left: 17px;
    background: #c76bea;
    box-shadow: 0 0 8px rgba(196, 87, 237, .45);
}

.map-switch-text {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: #ad9db6;
    font-size: 9px;
}

.map-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
}

.map-dot--house {
    background: #a642cf;
    border: 1px solid #e0b1f7;
    box-shadow: 0 0 8px rgba(166, 66, 207, .35);
}

.map-dot--biz {
    background: #d58a28;
    border: 1px solid #ffd79c;
    box-shadow: 0 0 8px rgba(213, 138, 40, .28);
}

.map-dot--free {
    background: #55e291;
    border: 1px solid #b2f4ce;
    box-shadow: 0 0 8px rgba(85, 226, 145, .26);
}

.map-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
}

.map-search .input {
    min-width: 0;
    padding: 8px 9px;
    font-size: 9px;
}

.map-search-result {
    min-height: 14px;
    margin-top: 6px;
    color: #8ddcaf;
    font-size: 8px;
}

.map-search-result.is-error {
    color: #ff9ca9;
}

.map-legend {
    display: grid;
    gap: 6px;
    margin-top: 13px;
    color: #76697d;
    font-size: 8px;
}

.map-legend > div {
    display: flex;
    align-items: center;
    gap: 7px;
}

.map-error {
    margin-top: 12px;
    line-height: 1.4;
}

.map-error small {
    display: block;
    margin-top: 5px;
    opacity: .82;
    word-break: break-word;
}


/* =========================================================
   MAP CARD
   ========================================================= */

.state-map-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(184, 77, 230, .18);
    border-radius: 18px;
    background: #09070d;
    box-shadow:
        0 18px 45px rgba(0, 0, 0, .28),
        inset 0 1px 0 rgba(255, 255, 255, .015);
}

.state-map-toolbar,
.state-map-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    background:
        linear-gradient(90deg, rgba(177, 72, 220, .04), transparent 45%),
        #0e0a13;
}

.state-map-toolbar {
    border-bottom: 1px solid rgba(184, 77, 230, .14);
}

.state-map-toolbar strong {
    display: block;
    color: #d8b1e9;
    font-size: 9px;
    letter-spacing: .8px;
}

.state-map-toolbar span,
.state-map-footer {
    color: #73677a;
    font-size: 8px;
}

.state-map-toolbar__right {
    white-space: nowrap;
}

.state-map-footer {
    border-top: 1px solid rgba(184, 77, 230, .12);
}


/* =========================================================
   LEAFLET
   ========================================================= */

#game-map {
    position: relative;
    width: 100%;
    height: min(74vh, 820px);
    min-height: 610px;
    background: #07090b;
    outline: none;
}

#game-map .leaflet-image-layer {
    filter:
        brightness(.72)
        saturate(.74)
        contrast(1.08)
        hue-rotate(7deg);
}

#game-map::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 400;
    pointer-events: none;
    box-shadow:
        inset 0 0 90px rgba(6, 2, 9, .30),
        inset 0 0 0 1px rgba(183, 75, 227, .035);
}

.leaflet-control-zoom {
    overflow: hidden;
    border: 1px solid rgba(187, 79, 231, .23) !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .28) !important;
}

.leaflet-control-zoom a {
    width: 31px !important;
    height: 31px !important;
    line-height: 29px !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(184, 77, 230, .13) !important;
    background: rgba(13, 9, 18, .95) !important;
    color: #d3a9e5 !important;
}

.leaflet-control-zoom a:hover {
    background: #17101f !important;
    color: #fff !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    border: 1px solid rgba(192, 84, 237, .27);
    background: rgba(14, 9, 20, .97) !important;
    color: #eee !important;
    box-shadow: 0 18px 42px rgba(0, 0, 0, .48) !important;
}

.leaflet-popup-content-wrapper {
    border-radius: 13px !important;
}

.leaflet-popup-content {
    margin: 12px !important;
    min-width: 185px;
}

.leaflet-popup-close-button {
    color: #a892b2 !important;
}

.map-popup {
    color: #d9cedf;
    font: 10px/1.5 Inter, system-ui, sans-serif;
}

.map-popup > strong {
    display: block;
    margin: 7px 0 9px;
    color: #f4e9f9;
    font-size: 12px;
}

.map-popup-badge {
    display: inline-flex;
    padding: 3px 6px;
    border-radius: 5px;
    font-size: 7px;
    font-weight: 900;
    text-transform: uppercase;
}

.map-popup-badge--house {
    color: #dfb4f2;
    border: 1px solid rgba(183, 76, 227, .25);
    background: rgba(167, 64, 207, .11);
}

.map-popup-badge--biz {
    color: #ffd598;
    border: 1px solid rgba(222, 151, 57, .25);
    background: rgba(213, 138, 40, .09);
}

.map-popup-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(184, 77, 230, .08);
}

.map-popup-row span {
    color: #817486;
}

.map-popup-row b {
    max-width: 130px;
    text-align: right;
    color: #d8cadd;
    font-weight: 700;
}

.popup-free {
    color: #72e6a2;
}

.popup-owner {
    color: #e3b7f3;
}

.map-popup-coords {
    margin-top: 7px;
    color: #665a6c;
    font-size: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 980px) {
    .state-map-layout {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    #game-map {
        min-height: 570px;
    }
}

@media (max-width: 800px) {
    .state-map-layout {
        display: flex;
        flex-direction: column;
    }

    .state-map-sidebar {
        position: static;
        width: 100%;
        order: 1;
    }

    .state-map-card {
        width: 100%;
        order: 2;
    }

    .map-control-group {
        padding: 10px 0;
    }

    .state-map-sidebar .map-control-group:nth-of-type(1) {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px 12px;
    }

    .state-map-sidebar .map-control-group:nth-of-type(1) .map-control-title {
        grid-column: 1 / -1;
    }

    #game-map {
        height: 68vh;
        min-height: 500px;
    }
}

@media (max-width: 520px) {
    .state-map-sidebar .map-control-group:nth-of-type(1) {
        grid-template-columns: 1fr;
    }

    #game-map {
        height: 62vh;
        min-height: 430px;
    }

    .state-map-toolbar {
        align-items: flex-start;
    }

    .state-map-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }
}


/* =========================================================
   SA-MP PICKUP ICONS
   1272 — blue house
   1273 — green house
   1274 — dollar / business
   ========================================================= */

#game-map {
    --samp-map-icon-scale: .64;
}

.samp-map-icon-wrap {
    width: 16px !important;
    height: 16px !important;
    margin-left: -8px !important;
    margin-top: -8px !important;
    background: transparent !important;
    border: 0 !important;
}

.samp-map-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 25px;
    height: 25px;
    object-fit: contain;
    pointer-events: none;

    transform:
        translate(-50%, -50%)
        scale(var(--samp-map-icon-scale));

    transform-origin: 50% 50%;

    filter:
        drop-shadow(0 2px 2px rgba(0,0,0,.9))
        drop-shadow(0 0 4px rgba(0,0,0,.65));

    transition:
        transform .14s ease,
        filter .14s ease;
}

.samp-map-icon--business {
    width: 23px;
    height: 28px;
}

.samp-map-icon-wrap:hover .samp-map-icon {
    transform:
        translate(-50%, -50%)
        scale(calc(var(--samp-map-icon-scale) * 1.45));

    filter:
        drop-shadow(0 2px 3px rgba(0,0,0,.95))
        drop-shadow(0 0 7px rgba(207,111,244,.45));
}

.map-legend--samp > div {
    min-height: 26px;
}

.map-legend--samp img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex: 0 0 22px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.85));
}

/* На телефоне делаем pickup-иконки чуть компактнее. */
@media (max-width: 800px) {
    .samp-map-icon {
        width: 23px;
        height: 23px;
    }

    .samp-map-icon--business {
        width: 21px;
        height: 25px;
    }
}

.map-popup-buy{
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:34px;
    margin-top:10px;
    border:1px solid rgba(218,137,255,.28);
    border-radius:8px;
    background:linear-gradient(135deg,#74249b,#aa40d0);
    color:#fff!important;
    font-size:9px;
    font-weight:900;
    text-decoration:none!important;
}
.map-popup-buy:hover{filter:brightness(1.08)}


/* AVGUST map performance cluster styling */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: rgba(149, 54, 190, .22) !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background:
        linear-gradient(145deg, rgba(155, 52, 202, .95), rgba(74, 28, 98, .96)) !important;
    color: #fff !important;
    border: 1px solid rgba(236, 184, 255, .38);
    box-shadow: 0 0 13px rgba(180, 70, 225, .28);
    font: 800 10px/30px Inter, sans-serif;
}


/* =========================================================
   GANG ZONES — live from `gangzone`
   ========================================================= */
.map-dot--gang {
    border-radius: 2px;
    background: linear-gradient(135deg, #9b59ff, #42d66b, #ffd23f);
    border: 1px solid rgba(255,255,255,.55);
    box-shadow: 0 0 8px rgba(187, 90, 242, .28);
}

.map-gangzone-legend {
    width: 22px;
    height: 16px;
    flex: 0 0 22px;
    border: 1px solid rgba(225,184,255,.55);
    border-radius: 3px;
    background: linear-gradient(135deg, rgba(155,89,255,.55), rgba(66,214,107,.45), rgba(255,210,63,.48));
    box-shadow: 0 1px 3px rgba(0,0,0,.65);
}

.map-popup-badge--gang {
    color: #fff;
    border: 1px solid color-mix(in srgb, var(--gang-color, #b54ee0) 70%, white 30%);
    background: color-mix(in srgb, var(--gang-color, #b54ee0) 24%, transparent);
}

.gangzone-tooltip {
    border: 1px solid rgba(205,99,245,.28) !important;
    border-radius: 7px !important;
    background: rgba(14,9,20,.94) !important;
    color: #f2e9f6 !important;
    box-shadow: 0 8px 22px rgba(0,0,0,.38) !important;
    font: 800 9px/1.25 Inter, system-ui, sans-serif !important;
}
.gangzone-tooltip::before { display: none !important; }

@media (max-width: 520px) {
    .map-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .map-stat { padding: 8px 6px; }
    .map-stat strong { font-size: 16px; }
}
