/* ==========================================================================
   FARBALAND 30.09 - попап выбора цвета v2 (карточка товара), css v2: фикс фото на телефоне
   Все классы с префиксом cpm, старый megashop.color-picker.min.css не трогается
   (он нужен для селектора цвета на карточке).
   ========================================================================== */
.cpm-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.45);z-index:2147483600;display:none;align-items:center;justify-content:center}
.cpm-overlay.is-open{display:flex}
.cpm{--cpm-accent:#2D9CDB;--cpm-accent-dark:#1f86c2;--cpm-ink:#1c1c1c;--cpm-muted:#8a8a8a;--cpm-line:#e6e6e6;
  position:relative;width:980px;max-width:95vw;max-height:92vh;background:#fff;border-radius:8px;overflow-x:hidden;overflow-y:auto;
  display:grid;grid-template-columns:360px minmax(0,1fr);grid-template-rows:auto 1fr auto;
  grid-template-areas:"media head" "media body" "media foot";
  box-sizing:border-box;color:var(--cpm-ink);font-size:14px;line-height:1.35;box-shadow:0 8px 40px rgba(0,0,0,.18);text-align:left}
.cpm *,.cpm *::before,.cpm *::after{box-sizing:border-box}
.cpm [role="button"]{cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}
.cpm [role="button"]:focus-visible,.cpm select:focus-visible,.cpm input:focus-visible{outline:2px solid var(--cpm-accent);outline-offset:2px}
.cpm svg{display:block}

/* ---- шапка ---- */
.cpm__head{grid-area:head;padding:22px 24px 0}
.cpm__head-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}
.cpm__label{font-size:13px;color:var(--cpm-muted)}
.cpm__close{width:34px;height:34px;border-radius:50%;border:1px solid var(--cpm-line);background:#fff;color:#777;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.cpm__close:hover{color:var(--cpm-ink);border-color:#ccc}
.cpm__close svg{width:16px;height:16px;stroke:currentColor;stroke-width:2;fill:none;stroke-linecap:round}
.cpm__head-row{display:flex;gap:10px;align-items:center}
.cpm__select-wrap{position:relative;flex:1;min-width:0}
.cpm__select-wrap::after{content:"";position:absolute;right:16px;top:50%;width:8px;height:8px;margin-top:-6px;border-right:2px solid var(--cpm-accent);border-bottom:2px solid var(--cpm-accent);transform:rotate(45deg);pointer-events:none}
.cpm .cpm__select{width:100% !important;height:44px !important;margin:0 !important;padding:0 40px 0 14px !important;border:0 !important;border-radius:8px !important;background:#eef7fc !important;
  color:#1a6f9f !important;font-size:19px !important;font-family:inherit !important;-webkit-appearance:none !important;appearance:none !important;cursor:pointer;box-shadow:none !important;text-overflow:ellipsis}
.cpm__search-btn{width:44px;height:44px;border-radius:50%;border:1px solid var(--cpm-line);background:#fff;color:#555;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.cpm__search-btn:hover{border-color:#ccc;color:var(--cpm-ink)}
.cpm__search-btn svg{width:19px;height:19px;stroke:currentColor;stroke-width:2;fill:none;stroke-linecap:round}
.cpm__search-row{display:none;margin-top:10px}
.cpm__search-row.is-open{display:block}
.cpm .cpm__search-input{width:100% !important;height:40px !important;margin:0 !important;padding:0 12px !important;border:1px solid #cfcfcf !important;border-radius:8px !important;background:#fff !important;
  color:var(--cpm-ink) !important;font-size:15px !important;font-family:inherit !important;box-shadow:none !important}
.cpm .cpm__search-input:focus{border-color:var(--cpm-accent) !important}
.cpm__search-err{font-size:12px;color:#c0392b;min-height:0;margin-top:4px}
.cpm__search-err:empty{display:none}
.cpm__favs-btn{display:inline-flex;align-items:center;gap:6px;margin-top:10px;color:#777;font-size:14px}
.cpm__favs-btn svg{width:17px;height:17px;stroke:currentColor;stroke-width:1.8;fill:none}
.cpm__favs-btn span:first-of-type{border-bottom:1px dashed #b5b5b5}
.cpm__favs-btn:hover{color:var(--cpm-ink)}
.cpm__favs-list{display:none;flex-wrap:wrap;gap:6px;margin-top:8px}
.cpm__favs-list.is-open{display:flex}
.cpm__favs-empty{font-size:12px;color:var(--cpm-muted)}
.cpm__chip{display:inline-flex;align-items:center;gap:6px;padding:3px 10px 3px 3px;border-radius:14px;background:#f2f2f2;font-size:12px;color:#333;white-space:nowrap}
.cpm__chip span{width:20px;height:20px;border-radius:50%;box-shadow:inset 0 0 0 1px rgba(0,0,0,.08)}
.cpm__chip:hover{background:#e8e8e8}

/* ---- фото интерьера и плашка ---- */
.cpm__media{grid-area:media;display:flex;flex-direction:column;min-height:0}
.cpm__room{position:relative;width:100%;aspect-ratio:3/4;background:#eee;overflow:hidden;transition:background-color .25s ease}
.cpm__room-img{position:absolute;top:0;left:0;width:100% !important;height:100% !important;max-width:none !important;object-fit:cover;object-position:center center;display:block}
.cpm__room-prev,.cpm__room-next{position:absolute;top:50%;width:38px;height:38px;margin-top:-19px;border-radius:50%;background:rgba(255,255,255,.8);color:#555;display:flex;align-items:center;justify-content:center;box-shadow:0 1px 4px rgba(0,0,0,.12)}
.cpm__room-prev{left:10px}
.cpm__room-next{right:10px}
.cpm__room-prev:hover,.cpm__room-next:hover{background:#fff;color:var(--cpm-ink)}
.cpm__room-prev svg,.cpm__room-next svg{width:18px;height:18px;stroke:currentColor;stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round}
.cpm__dots{position:absolute;left:0;right:0;bottom:12px;display:flex;justify-content:center;gap:7px}
.cpm__dot{width:10px;height:10px;border-radius:50%;border:1.5px solid var(--cpm-accent);background:rgba(255,255,255,.85);cursor:pointer}
.cpm__dot.is-on{background:var(--cpm-accent)}
.cpm__plate{position:relative;flex:1;min-height:112px;padding:26px 14px 14px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;background:#eee;color:var(--cpm-ink);transition:background-color .25s ease}
.cpm__plate.is-dark{color:#fff}
.cpm__plate-cat{font-size:17px}
.cpm__plate-code{font-size:26px;font-weight:700;margin-top:2px;white-space:nowrap;max-width:100%}
.cpm__msg{font-size:12px;min-height:15px;margin-top:4px}
.cpm__actions{position:absolute;right:12px;top:-22px;display:flex;gap:8px}
.cpm__share,.cpm__fav{width:44px;height:44px;border-radius:50%;background:#fff;border:1.5px solid var(--cpm-accent);color:var(--cpm-accent);display:flex;align-items:center;justify-content:center;box-shadow:0 1px 4px rgba(0,0,0,.12)}
.cpm__share svg,.cpm__fav svg{width:20px;height:20px;stroke:currentColor;stroke-width:1.8;fill:none;stroke-linecap:round;stroke-linejoin:round}
.cpm__fav.is-on{color:#e0457b;border-color:#e0457b;background:#fdecf2}
.cpm__fav.is-on svg{fill:currentColor}

/* ---- веер ---- */
.cpm__body{grid-area:body;padding:18px 24px 6px;min-width:0}
.cpm__fan{display:flex;align-items:center;gap:6px}
.cpm__fan-prev,.cpm__fan-next{width:26px;height:64px;flex-shrink:0;border-radius:4px;color:#fff;display:flex;align-items:center;justify-content:center;margin-bottom:14px}
.cpm__fan-prev{background:#a9a9a9}
.cpm__fan-next{background:var(--cpm-accent)}
.cpm__fan-prev:hover{background:#999}
.cpm__fan-next:hover{background:var(--cpm-accent-dark)}
.cpm__fan-prev.is-disabled,.cpm__fan-next.is-disabled{opacity:.3;pointer-events:none}
.cpm__fan-prev svg,.cpm__fan-next svg{width:16px;height:16px;stroke:currentColor;stroke-width:2.4;fill:none;stroke-linecap:round;stroke-linejoin:round}
.cpm__fan-grid{flex:1;min-width:0;display:flex;justify-content:center;padding-bottom:14px}
.cpm__pair{position:relative;display:flex;gap:2px;padding:3px;cursor:pointer;flex-shrink:0}
.cpm__pair.is-on{background:#e6eaee}
.cpm__col{display:flex;flex-direction:column;gap:2px}
.cpm .cpm__cell{width:var(--cpm-cell,28px) !important;height:var(--cpm-cell,28px) !important;min-width:0 !important;margin:0 !important;padding:0 !important;border:0 !important;border-radius:0 !important;cursor:pointer}
.cpm .cpm__cell.is-sel{box-shadow:inset 0 0 0 2px var(--cpm-ink),inset 0 0 0 3px #fff}
.cpm .cpm__cell.is-empty{background:#f4f4f4;cursor:default}
.cpm__mark{position:absolute;left:0;right:0;bottom:-12px;height:10px;background:var(--cpm-accent);clip-path:polygon(0 100%,8% 0,42% 0,50% -60%,58% 0,92% 0,100% 100%)}
.cpm__fan-status{font-size:13px;color:var(--cpm-muted);text-align:center;padding:24px 0}

/* ---- коды выбранной пары ---- */
.cpm__codes{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;margin-top:6px}
.cpm__code{height:40px;border-radius:6px;display:flex;align-items:center;justify-content:center;overflow:hidden;padding:0 4px;color:var(--cpm-ink);min-width:0;position:relative}
.cpm__code.is-dark{color:#fff}
.cpm__code.is-sel{box-shadow:inset 0 0 0 2px var(--cpm-accent)}
.cpm__code-txt{white-space:nowrap;font-size:13px}
.cpm__check{width:24px;height:24px}
.cpm__check circle{fill:#fff;stroke:var(--cpm-accent);stroke-width:1.6}
.cpm__check path{fill:none;stroke:var(--cpm-accent);stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.cpm__vh{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* ---- кнопка выбора ---- */
.cpm__foot{grid-area:foot;padding:12px 24px 20px;background:#fff}
.cpm__choose{height:50px;border-radius:25px;background:var(--cpm-accent);color:#fff;font-size:16px;font-weight:600;display:flex;align-items:center;justify-content:center;text-align:center;transition:background-color .15s ease}
.cpm__choose:hover{background:var(--cpm-accent-dark)}
.cpm__choose.is-disabled{opacity:.5;pointer-events:none}
.cpm__note{font-size:12px;color:var(--cpm-muted);text-align:center;margin-top:8px}

/* ---- телефон ---- */
@media (max-width:768px){
  .cpm-overlay{align-items:stretch;justify-content:stretch}
  .cpm{width:100%;max-width:100%;height:100vh;height:100dvh;max-height:none;border-radius:0;box-shadow:none;display:flex;flex-direction:column}
  /* блоки не сжимаются: попап длиннее экрана и прокручивается (иначе фото сжималось до нуля) */
  .cpm>*{flex-shrink:0}
  .cpm__head{order:1;padding:14px 14px 10px}
  .cpm__media{order:2;min-height:auto}
  .cpm__room{flex-shrink:0;width:100%;min-height:200px}
  .cpm__body{order:3;padding:16px 10px 6px}
  .cpm__foot{order:4;position:sticky;bottom:0;margin-top:auto;padding:10px 14px calc(12px + env(safe-area-inset-bottom,0px));box-shadow:0 -4px 12px rgba(0,0,0,.06);z-index:2}
  .cpm .cpm__select{font-size:17px !important;height:42px !important}
  .cpm__search-btn{width:42px;height:42px}
  .cpm__room{aspect-ratio:1/1}
  .cpm__room-img[data-crop="bottom"]{object-position:center bottom}
  .cpm__room-img[data-crop="center"]{object-position:center center}
  .cpm__room-img[data-crop="top"]{object-position:center top}
  .cpm__plate{flex:none;min-height:96px;padding:24px 12px 10px}
  .cpm__plate-cat{font-size:15px}
  .cpm__share,.cpm__fav{width:40px;height:40px}
  .cpm__actions{top:-20px}
  .cpm__fan{gap:4px}
  .cpm__fan-prev,.cpm__fan-next{width:22px;height:56px}
  .cpm__codes{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
  .cpm__code{height:38px}
}
@media (prefers-reduced-motion:reduce){
  .cpm__room,.cpm__plate,.cpm__choose{transition:none}
}
