/* ==========================================================================
   Карта месторождений — стили
   Перенесены из дизайн-прототипа (Claude Design) пиксель-в-пиксель.
   Акцентный цвет управляется CSS-переменной --ac на .app.
   ========================================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Golos Text', system-ui, sans-serif;
  background: #f5f5f4;
  color: #1c1917;
  -webkit-font-smoothing: antialiased;
}
.ymaps-2-1-79-balloon,
[class*="-balloon__content"] { font-family: 'Golos Text', sans-serif !important; }

/* Скроллбары */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d6d3d1; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #c4c0bd; }

/* Анимации */
@keyframes slidein { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes pulse   { 0% { transform: translate(-50%,-100%) scale(.5); opacity: .7; } 100% { transform: translate(-50%,-100%) scale(1.4); opacity: 0; } }
@keyframes fadeup  { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ----- Каркас ----- */
.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  --ac: #cc1543;
  background: #f5f5f4;
  position: relative;
}

/* ----- Шапка ----- */
.header {
  height: 72px; flex: none;
  display: flex; align-items: center; gap: 18px;
  padding: 0 26px;
  background: #fff; color: #1c1917;
  border-bottom: 1px solid #e7e5e4;
}
.header__logo { height: 38px; width: auto; display: block; }
.header__sep { width: 1px; height: 34px; background: #e7e5e4; }
.header__titles { line-height: 1.25; }
.header__title { font-weight: 700; font-size: 14.5px; letter-spacing: .2px; color: #3f4448; }
.header__subtitle { font-size: 11.5px; color: #677279; font-weight: 500; }
.header__spacer { flex: 1; }
.header__count { display: flex; align-items: center; gap: 7px; font-size: 13px; color: #677279; }
.header__dot { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; }
.btn-add {
  margin-left: 6px; height: 40px; padding: 0 18px;
  border: none; border-radius: 9px;
  background: var(--ac, #cc1543); color: #fff;
  font-family: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer; display: flex; align-items: center; gap: 7px;
}
.btn-add:hover { filter: brightness(1.08); }
.btn-add__plus { font-size: 17px; line-height: 1; }

/* ----- Строка контента ----- */
.row { flex: 1; display: flex; min-height: 0; }
.row--right { flex-direction: row-reverse; }

/* ----- Боковая панель ----- */
.aside {
  width: 392px; flex: none;
  background: #fff; border-right: 1px solid #e7e5e4;
  display: flex; flex-direction: column; min-height: 0;
  box-shadow: 2px 0 18px rgba(0,0,0,.03);
  z-index: 500;
}
.filters { padding: 18px 20px 16px; border-bottom: 1px solid #f0eeec; flex: none; }

.search { position: relative; }
.search__icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #a8a29e; font-size: 15px; }
.search__input {
  width: 100%; height: 42px; padding: 0 14px 0 34px;
  border: 1px solid #e7e5e4; border-radius: 10px;
  font-family: inherit; font-size: 14px; background: #fafaf9; outline: none; color: #1c1917;
}
.search__input:focus { border-color: var(--ac, #c2410c); background: #fff; }

.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: .6px;
  text-transform: uppercase; color: #a8a29e;
}
.mat-filters { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.mat-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  padding: 6px 11px; border-radius: 9px; cursor: pointer;
  transition: all .12s; border: 1.5px solid #e7e5e4; background: #fff; color: #57534e;
}
.mat-chip:hover { border-color: #d6d3d1; }
.mat-chip__dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }

.region-row { margin-top: 16px; display: flex; gap: 10px; align-items: flex-end; }
.region-row > div { flex: 1; }
.region-label { margin-bottom: 7px; }
.region-select {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid #e7e5e4; border-radius: 10px;
  font-family: inherit; font-size: 13.5px; background: #fafaf9; color: #1c1917;
  outline: none; cursor: pointer;
}
.region-select:focus { border-color: var(--ac, #c2410c); }

.result-bar {
  padding: 13px 20px 10px; display: flex; align-items: center; justify-content: space-between; flex: none;
}
.result-bar__count { font-size: 13.5px; color: #57534e; }
.result-bar__count b { color: #1c1917; font-weight: 700; }
.clear-btn {
  border: none; background: none; font-family: inherit; font-size: 12.5px;
  color: #a8a29e; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.clear-btn:hover { color: var(--ac, #c2410c); }

/* ----- Список карточек ----- */
.list { flex: 1; overflow-y: auto; padding: 0 14px 20px; min-height: 0; }
.empty { padding: 48px 20px; text-align: center; color: #a8a29e; }
.empty__icon { font-size: 30px; margin-bottom: 10px; }
.empty__text { font-size: 14px; line-height: 1.5; }

.card {
  margin-top: 8px; padding: 13px 14px; border-radius: 13px; cursor: pointer;
  border: 1.5px solid #f0eeec; background: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
  transition: border-color .15s, box-shadow .15s;
  animation: fadeup .2s ease both;
}
.card--selected { border-color: var(--ac, #c2410c); box-shadow: 0 6px 22px rgba(0,0,0,.09); }
.card__head { display: flex; align-items: flex-start; gap: 10px; }
.card__pin {
  width: 11px; height: 11px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); flex: none; margin-top: 5px;
}
.card__main { flex: 1; min-width: 0; }
.card__name { font-weight: 600; font-size: 14.5px; line-height: 1.3; color: #1c1917; }
.card__place { font-size: 12.5px; color: #78716c; margin-top: 2px; }
.card__chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; padding-left: 21px; }
.card__price-row { display: flex; align-items: baseline; justify-content: space-between; margin-top: 9px; padding-left: 21px; }
.card__price { font-size: 13px; color: #57534e; }
.card__price b { color: #1c1917; font-weight: 700; font-size: 14px; }
.card__coords { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #a8a29e; }
.card__open {
  margin-top: 10px; padding-left: 21px; display: flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 600; color: var(--ac, #c2410c);
}
.card__open span { font-size: 15px; line-height: 1; }

/* Бейджи статуса и чипы материалов (общие) */
.status-badge {
  flex: none; font-weight: 600; border-radius: 20px; white-space: nowrap;
}
.status-badge--card { font-size: 10.5px; padding: 3px 8px; }
.status-badge--detail { font-size: 11px; padding: 3px 10px; }
.mat-tag { font-weight: 500; border-radius: 7px; }
.mat-tag--card { font-size: 11.5px; padding: 3px 9px; }
.mat-tag--detail { font-size: 12px; padding: 4px 11px; border-radius: 8px; }

/* ----- Карта ----- */
.map-wrap { flex: 1; position: relative; min-height: 0; }
.map { position: absolute; inset: 0; background: #e7e5e4; }
.legend {
  position: absolute; left: 16px; bottom: 16px; z-index: 600;
  background: rgba(255,255,255,.94); backdrop-filter: blur(6px);
  border: 1px solid #e7e5e4; border-radius: 12px; padding: 12px 14px;
  box-shadow: 0 6px 22px rgba(0,0,0,.1);
}
.legend__title { margin-bottom: 8px; }
.legend__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.legend__item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #44403c; }
.legend__dot {
  width: 10px; height: 10px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); flex: none;
}

/* ----- Маркер на карте ----- */
.quarry-pin { will-change: transform; position: relative; }
.quarry-pin__drop {
  background: currentColor; border: 2px solid #fff;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.quarry-pin__ring {
  position: absolute; border-radius: 50%; background: currentColor;
  transform: translate(-50%,-100%) scale(.5); animation: pulse 1.5s ease-out infinite;
}

/* ----- Детальная панель ----- */
.detail-overlay { position: absolute; inset: 0; z-index: 1000; display: flex; justify-content: flex-end; }
.detail-backdrop { position: absolute; inset: 0; background: rgba(28,25,23,.45); }
.detail {
  position: relative; width: 540px; max-width: 94vw; height: 100%;
  background: #fff; box-shadow: -14px 0 48px rgba(0,0,0,.22);
  display: flex; flex-direction: column;
  animation: slidein .28s cubic-bezier(.2,.8,.2,1);
}
.detail__header {
  flex: none; padding: 20px 24px 16px; border-bottom: 1px solid #f0eeec;
  display: flex; align-items: flex-start; gap: 14px;
}
.detail__header-main { flex: 1; min-width: 0; }
.detail__title-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.detail__title { margin: 0; font-family: 'PT Serif', Georgia, serif; font-size: 24px; font-weight: 700; line-height: 1.15; color: #1c1917; }
.detail__place { margin-top: 5px; font-size: 13px; color: #78716c; }
.detail__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.detail__close {
  flex: none; width: 34px; height: 34px; border: 1px solid #e7e5e4; border-radius: 9px;
  background: #fafaf9; color: #78716c; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.detail__close:hover { background: #f0eeec; color: #1c1917; }
.detail__body { flex: 1; overflow-y: auto; min-height: 0; }
.detail__photo {
  width: 100%; height: 204px; display: flex; align-items: center; justify-content: center;
  background: #f5f5f4; color: #a8a29e; font-size: 14px; background-size: cover; background-position: center;
}
.detail__section { padding: 14px 24px 8px; }
.detail__section--first { padding: 20px 24px 8px; }
.detail__desc { margin: 0 0 14px; font-size: 14px; line-height: 1.6; color: #44403c; }

.specs { display: grid; grid-template-columns: 140px 1fr; gap: 0; font-size: 13.5px; border: 1px solid #f0eeec; border-radius: 12px; overflow: hidden; }
.specs__key { padding: 10px 14px; background: #fafaf9; color: #78716c; border-bottom: 1px solid #f0eeec; }
.specs__val { padding: 10px 14px; border-bottom: 1px solid #f0eeec; }
.specs__val--mono { font-family: 'JetBrains Mono', monospace; }
.specs > .specs__key:last-of-type, .specs > .specs__val:last-child { border-bottom: none; }

.geo {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 15px; border: 1px solid #f0eeec; border-radius: 12px; background: #fafaf9;
}
.geo__label { font-size: 11px; color: #a8a29e; margin-bottom: 3px; }
.geo__coords { font-family: 'JetBrains Mono', monospace; font-size: 13.5px; color: #1c1917; }
.geo__nav {
  flex: none; text-decoration: none; height: 40px; padding: 0 16px; border-radius: 9px;
  background: var(--ac, #c2410c); color: #fff; font-weight: 600; font-size: 13px;
  display: flex; align-items: center; gap: 7px;
}
.geo__nav:hover { filter: brightness(1.08); }

.price { border: 1px solid #f0eeec; border-radius: 12px; overflow: hidden; }
.price__head {
  display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 0; background: #fafaf9;
  font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: #a8a29e;
}
.price__head > div:nth-child(1) { padding: 9px 14px; }
.price__head > div:nth-child(2) { padding: 9px 10px; }
.price__head > div:nth-child(3) { padding: 9px 14px; text-align: right; }
.price__row { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 0; font-size: 13px; border-top: 1px solid #f0eeec; }
.price__product { padding: 11px 14px; }
.price__product-name { font-weight: 600; color: #1c1917; }
.price__product-comment { font-size: 11.5px; color: #a8a29e; margin-top: 2px; }
.price__spec { padding: 11px 10px; color: #57534e; align-self: center; }
.price__value { padding: 11px 14px; text-align: right; font-weight: 700; color: #1c1917; align-self: center; white-space: nowrap; }

/* ----- Форма заявки ----- */
.req-section { padding: 16px 24px 26px; }
.req-sent {
  padding: 18px; border: 1px solid #bbf7d0; background: #f0fdf4; border-radius: 12px;
  font-size: 14px; color: #15803d; line-height: 1.5;
}
.req-form { display: flex; flex-direction: column; gap: 9px; }
.req-form input {
  height: 44px; padding: 0 14px; border: 1px solid #e7e5e4; border-radius: 10px;
  font-family: inherit; font-size: 14px; background: #fafaf9; outline: none;
}
.req-form input:focus { border-color: var(--ac, #c2410c); background: #fff; }
.req-form__submit {
  margin-top: 3px; height: 46px; border: none; border-radius: 10px;
  background: var(--ac, #c2410c); color: #fff; font-family: inherit;
  font-weight: 600; font-size: 14.5px; cursor: pointer;
}
.req-form__submit:hover { filter: brightness(1.08); }
.req-form__call { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 4px; font-size: 13px; color: #78716c; }
.req-form__call a { color: var(--ac, #c2410c); font-weight: 600; font-family: 'JetBrains Mono', monospace; text-decoration: none; }

/* ==========================================================================
   Форма «Добавить объект» (админ)
   ========================================================================== */
.add-form { display: flex; flex-direction: column; gap: 13px; padding-bottom: 12px; }
.af-field { display: flex; flex-direction: column; gap: 5px; }
.af-label { font-size: 12px; font-weight: 600; color: #57534e; }
.af-input {
  height: 42px; padding: 0 12px; border: 1px solid #e7e5e4; border-radius: 10px;
  font-family: inherit; font-size: 14px; background: #fafaf9; outline: none; color: #1c1917; width: 100%;
}
textarea.af-input { height: auto; padding: 10px 12px; resize: vertical; }
.af-input:focus { border-color: var(--ac, #c2410c); background: #fff; }
.af-row { display: flex; gap: 10px; }
.af-row .af-field { flex: 1; min-width: 0; }
.af-checks { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.af-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #44403c; cursor: pointer; }
.af-mapbtn {
  margin-top: 7px; align-self: flex-start; border: 1px solid #e7e5e4; background: #fff;
  border-radius: 9px; padding: 8px 13px; font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--ac, #c2410c); cursor: pointer;
}
.af-mapbtn:hover { background: #fafaf9; }
.af-msg { font-size: 13px; margin-top: 2px; }
.af-msg--err { color: #b91c1c; }
.af-msg--ok { color: #15803d; }

/* ==========================================================================
   Мобильный переключатель «Карта / Список» (по умолчанию скрыт на десктопе)
   ========================================================================== */
.mobile-toggle { display: none; }

/* ----- Планшеты: сужаем боковую панель ----- */
@media (max-width: 1024px) {
  .aside { width: 320px; }
}

/* ==========================================================================
   Телефоны (≤ 768px)
   ========================================================================== */
@media (max-width: 768px) {
  /* Шапка компактная: прячем подзаголовок/счётчик, кнопка — только «+» */
  .header { height: 56px; padding: 0 12px; gap: 10px; }
  .header__logo { height: 28px; }
  .header__sep, .header__subtitle, .header__count { display: none; }
  .header__title { font-size: 14px; }
  .btn-add { height: 38px; width: 38px; padding: 0; justify-content: center; gap: 0; border-radius: 10px; }
  .btn-add { font-size: 0; }                 /* прячем текст */
  .btn-add__plus { font-size: 22px; }

  /* Боковая панель -> выезжающая снизу «шторка» поверх карты */
  .row { position: relative; }
  .aside {
    position: absolute; inset: 0; width: 100%;
    border-right: none; box-shadow: none;
    transform: translateY(100%);
    transition: transform .25s ease;
    z-index: 700;
  }
  .app.show-list .aside { transform: none; }
  .list { padding-bottom: 88px; }            /* чтобы пилюля не перекрывала карточки */

  /* Карта на весь экран (панель выезжает поверх) */
  .map-wrap { position: absolute; inset: 0; }
  .legend { display: none; }                 /* экономим место на телефоне */

  /* Детальная карточка — на всю ширину */
  .detail { width: 100%; max-width: 100%; }

  /* Плавающий переключатель «Карта / Список» */
  .mobile-toggle {
    display: flex; position: fixed; bottom: 16px; left: 50%;
    transform: translateX(-50%); z-index: 900;
    background: #fff; border: 1px solid #e7e5e4; border-radius: 12px;
    box-shadow: 0 6px 22px rgba(0,0,0,.18); padding: 4px; gap: 4px;
  }
  .mobile-toggle__btn {
    border: none; background: none; font-family: inherit; font-size: 14px;
    font-weight: 600; color: #57534e; padding: 8px 20px; border-radius: 9px;
    cursor: pointer; white-space: nowrap;
  }
  .mobile-toggle__btn.is-active { background: var(--ac, #cc1543); color: #fff; }

  /* Когда открыта детальная карточка — переключатель не нужен */
  .app.detail-open .mobile-toggle { display: none; }
}

/* ----- Узкие телефоны (≤ 380px) ----- */
@media (max-width: 380px) {
  .filters { padding: 14px 14px 12px; }
  .list { padding-left: 10px; padding-right: 10px; }
  .detail__header, .detail__section, .detail__section--first, .req-section { padding-left: 16px; padding-right: 16px; }
  .detail__title { font-size: 21px; }
}
