/* ═══════════════════════════════════════════════════════════════════════════
   FSA Map — Фэншуй Карта 24 Горы  v2.0
   ═══════════════════════════════════════════════════════════════════════════ */

.fsamap {
    --gold      : #C9A96E;
    --gold-d    : #9A7840;
    --gold-p    : #FAF6F0;
    --pur       : #6B4FA0;
    --pur-d     : #4A3270;
    --pur-p     : #F2EDF9;
    --ink       : #1A1008;
    --ink-m     : #4A3828;
    --ink-l     : #8C7060;
    --white     : #FFFFFF;
    --border    : #E8DDD5;
    --cream     : #F4EDE4;
    --red       : #C9320A;

    font-family : 'Nunito', -apple-system, sans-serif;
    width       : 100%;
    margin      : 0;
    color       : var(--ink);
}

.fsamap * { box-sizing: border-box; }
.fsamap p, .fsamap h3 { margin: 0; }


/* ── Инструкция ───────────────────────────────────────────────────────────── */

.fsamap-hint {
    background    : var(--pur-p);
    border        : 1px solid rgba(107,79,160,0.2);
    border-radius : 12px;
    padding       : 16px 20px;
    margin-bottom : 14px;
}

.fsamap-hint__title { font-size: 14px !important; color: var(--ink) !important; margin-bottom: 8px !important; }

.fsamap-hint__steps { margin: 0; padding-left: 20px; }
.fsamap-hint__steps li {
    font-size    : 14px !important;
    color        : var(--ink-m) !important;
    line-height  : 1.65 !important;
    margin-bottom: 4px !important;
}
.fsamap-hint__steps li strong { color: var(--ink) !important; }


/* ── Топбар: поиск + провайдеры ───────────────────────────────────────────── */

.fsamap-topbar {
    display       : flex;
    align-items   : flex-start;
    gap           : 12px;
    margin-bottom : 12px;
    flex-wrap     : wrap;
}

.fsamap-search { flex: 1; min-width: 240px; }
.fsamap-search__row { display: flex; gap: 8px; }
.fsamap-search__wrap { flex: 1; position: relative; }

.fsamap-search__input {
    width        : 100% !important;
    padding      : 12px 16px !important;
    font-size    : 15px !important;
    font-family  : inherit !important;
    border       : 1px solid var(--border) !important;
    border-radius: 10px !important;
    outline      : none !important;
    background   : var(--white) !important;
    color        : var(--ink) !important;
    box-shadow   : none !important;
    transition   : border-color 0.2s !important;
}
.fsamap-search__input:focus { border-color: var(--gold) !important; }

.fsamap-search__btn {
    padding       : 12px 24px !important;
    background    : var(--pur) !important;
    color         : #fff !important;
    border        : none !important;
    border-radius : 10px !important;
    font-size     : 15px !important;
    font-weight   : 600 !important;
    font-family   : inherit !important;
    cursor        : pointer !important;
    transition    : background 0.2s !important;
    white-space   : nowrap !important;
    flex-shrink   : 0 !important;
}
.fsamap-search__btn:hover { background: var(--pur-d) !important; }


/* ── Автодополнение ───────────────────────────────────────────────────────── */

.fsamap-autocomplete {
    position      : absolute;
    top           : calc(100% + 4px);
    left          : 0;
    right         : 0;
    background    : var(--white);
    border        : 1px solid var(--border);
    border-radius : 10px;
    box-shadow    : 0 6px 20px rgba(0,0,0,0.1);
    z-index       : 9999;
    overflow      : hidden;
    display       : none;
}
.fsamap-autocomplete.fsamap-autocomplete--open { display: block; }

.fsamap-autocomplete__item {
    padding      : 10px 16px;
    font-size    : 14px;
    color        : var(--ink);
    cursor       : pointer;
    transition   : background 0.15s;
    line-height  : 1.4;
    border-bottom: 1px solid var(--border);
}
.fsamap-autocomplete__item:last-child { border-bottom: none; }
.fsamap-autocomplete__item:hover,
.fsamap-autocomplete__item--active { background: var(--pur-p); color: var(--pur); }


/* ── Контейнер карты ──────────────────────────────────────────────────────── */

.fsamap-container {
    position      : relative;
    width         : 100%;
    height        : 540px;
    border-radius : 14px;
    overflow      : hidden;
    border        : 1px solid var(--border);
    margin-bottom : 16px;
    background    : #e8e0d8;
}

.fsamap-map {
    position   : absolute;
    inset      : 0;
    width      : 100%;
    height     : 100%;
    transition : opacity 0.2s;
}

.fsamap-overlay {
    position        : absolute;
    inset           : 0;
    display         : flex;
    align-items     : center;
    justify-content : center;
    pointer-events  : none;
    z-index         : 10;
}

/* Шаблон — не крутится */
.fsamap-template {
    position         : absolute;
    width            : 500px;
    height           : 500px;
    max-width        : 90%;
    max-height       : 90%;
    object-fit       : contain;
    pointer-events   : none;
    user-select      : none;
    -webkit-user-drag: none;
    transition       : opacity 0.2s;
}

/* Стрелка фасада */
.fsamap-arrow {
    position         : relative;
    cursor           : grab;
    pointer-events   : auto;
    user-select      : none;
    -webkit-user-drag: none;
    transform-origin : 50% 50%;
    filter           : drop-shadow(0 2px 6px rgba(0,0,0,0.35));
    transition       : filter 0.15s;
    z-index          : 20;
    flex-shrink      : 0;
}
.fsamap-arrow:active { cursor: grabbing; filter: drop-shadow(0 3px 10px rgba(201,50,10,0.5)); }


/* ── Панель управления ────────────────────────────────────────────────────── */

.fsamap-controls {
    background    : var(--white);
    border        : 1px solid var(--border);
    border-radius : 14px;
    padding       : 16px 20px;
    display       : grid;
    grid-template-columns: 1fr 1fr;
    gap           : 12px 24px;
    align-items   : start;
}

/* Тогл и кнопка сброса — на всю ширину */
.fsamap-controls > .fsamap-control-group--toggle,
.fsamap-controls > .fsamap-control-group--size,
.fsamap-controls > .fsamap-info,
.fsamap-controls > .fsamap-reset-btn {
    grid-column: 1 / -1;
}

.fsamap-control-group { display: flex; flex-direction: column; gap: 5px; }
.fsamap-control-label {
    font-size   : 11px;
    font-weight : 700;
    color       : var(--ink-l);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.fsamap-rotation-row  { display: flex; align-items: center; gap: 6px; }

.fsamap-slider-hint {
    flex-shrink : 0;
    min-width   : 30px;
    text-align  : right;
    font-size   : 12px;
    color       : var(--ink-l);
}

.fsamap-slider {
    flex              : 1 !important;
    -webkit-appearance: none !important;
    appearance        : none !important;
    height            : 4px !important;
    background        : var(--border) !important;
    border-radius     : 2px !important;
    outline           : none !important;
    cursor            : pointer !important;
    border            : none !important;
    box-shadow        : none !important;
    padding           : 0 !important;
}
.fsamap-slider::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    width: 20px !important; height: 20px !important;
    border-radius: 50% !important;
    background: var(--pur) !important;
    cursor: pointer !important;
    border: 3px solid #fff !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2) !important;
}
.fsamap-slider::-moz-range-thumb {
    width: 20px !important; height: 20px !important;
    border-radius: 50% !important;
    background: var(--pur) !important;
    cursor: pointer !important;
    border: 3px solid #fff !important;
}

.fsamap-rot-btn {
    width: 32px !important; height: 32px !important;
    border-radius: 8px !important;
    border: 1px solid var(--border) !important;
    background: var(--cream) !important;
    color: var(--ink) !important;
    font-size: 13px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: background 0.15s !important;
    padding: 0 !important;
    line-height: 1 !important;
}
.fsamap-rot-btn:hover { background: var(--gold-p) !important; border-color: var(--gold) !important; }


/* ── Тогл ─────────────────────────────────────────────────────────────────── */

.fsamap-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.fsamap-toggle input { display: none; }

.fsamap-toggle__slider {
    width: 44px; height: 24px;
    background: var(--border);
    border-radius: 12px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.fsamap-toggle__slider::after {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    top: 3px; left: 3px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.fsamap-toggle input:checked + .fsamap-toggle__slider { background: var(--pur); }
.fsamap-toggle input:checked + .fsamap-toggle__slider::after { transform: translateX(20px); }

.fsamap-toggle__label { font-size: 13px; font-weight: 600; color: var(--ink); user-select: none; }


/* ── Результаты ───────────────────────────────────────────────────────────── */

.fsamap-info {
    background    : var(--gold-p);
    border        : 1px solid #E8D5B0;
    border-radius : 10px;
    padding       : 10px 16px;
    display       : flex;
    flex-wrap     : wrap;
    gap           : 6px 24px;
    align-items   : center;
}

.fsamap-info__item { display: flex; align-items: center; gap: 6px; }
.fsamap-info__label { font-size: 11px; color: var(--ink-l); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.fsamap-info__value { font-size: 14px; font-weight: 600; color: var(--ink); }
.fsamap-info__value--gold { color: var(--gold-d); font-size: 18px; }


/* ── Кнопка сброса ────────────────────────────────────────────────────────── */

.fsamap-reset-btn {
    align-self: flex-start !important;
    padding: 8px 20px !important;
    background: none !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    color: var(--ink-m) !important;
    cursor: pointer !important;
    font-family: inherit !important;
    transition: all 0.2s !important;
}
.fsamap-reset-btn:hover { border-color: var(--gold) !important; color: var(--ink) !important; }


/* ── Адаптив ──────────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
    .fsamap-container { height: 380px; }
    .fsamap-template  { width: 340px; height: 340px; }
    .fsamap-controls  { padding: 12px 14px; grid-template-columns: 1fr; }
    .fsamap-controls > .fsamap-control-group--toggle,
    .fsamap-controls > .fsamap-control-group--size,
    .fsamap-controls > .fsamap-info,
    .fsamap-controls > .fsamap-reset-btn { grid-column: 1; }
    .fsamap-topbar    { flex-direction: column; }
}