/*
 * Витрина ЭПЛ X: база, сетка и компоненты UI-kit (Figma «ЭПЛ Х. web-site» → UI-kit).
 * Шапка и подвал — styles/layout.css.
 */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body.eplx {
    background: var(--eplx-bg);
    color: var(--eplx-white);
    font: 400 var(--eplx-body-s) var(--eplx-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.eplx.is-locked { overflow: hidden; }

/* сброс через :where() — нулевая специфичность, не перебивает классы компонентов */
:where(.eplx) a { color: inherit; text-decoration: none; }
:where(.eplx) img { max-width: 100%; display: block; }
:where(.eplx) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:where(.eplx) ul { list-style: none; margin: 0; padding: 0; }
:where(.eplx) :is(h1, h2, h3, h4, h5, p) { margin: 0; }

.eplx-container {
    width: 100%;
    max-width: calc(var(--eplx-container) + var(--eplx-gutter) * 2);
    margin: 0 auto;
    padding: 0 var(--eplx-gutter);
}

.eplx-main { min-height: 50vh; }

.eplx-visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- типографика ---------- */
.eplx-h1 { font: 400 var(--eplx-h1) var(--eplx-font); }
.eplx-h2 { font: 400 var(--eplx-h2) var(--eplx-font); }
.eplx-h3 { font: 400 var(--eplx-h3) var(--eplx-font); }
.eplx-h4 { font: 400 var(--eplx-h4) var(--eplx-font); }
.eplx-h5 { font: 600 var(--eplx-h5) var(--eplx-font); }
.eplx-body-m { font: 400 var(--eplx-body-m) var(--eplx-font); }
.eplx-body-s { font: 400 var(--eplx-body-s) var(--eplx-font); }
.eplx-body-xs { font: 400 var(--eplx-body-xs) var(--eplx-font); }
.eplx-caption { font: 400 var(--eplx-caption) var(--eplx-font); }
.eplx-h1 b, .eplx-h2 b, .eplx-h3 b, .eplx-h4 b, .eplx-body-m b, .eplx-body-s b { font-weight: 600; }
.eplx-muted { color: var(--eplx-gray-2); }

@media (max-width: 767px) {
    .eplx-h4 { font: 400 var(--eplx-body-m) var(--eplx-font); }
    .eplx-h5 { font: 600 var(--eplx-body-m) var(--eplx-font); }
}

/* ---------- иконки (спрайт images/icons.svg) ---------- */
.eplx-icon {
    display: inline-block;
    flex: none;
    width: 24px;
    height: 24px;
    fill: currentColor;
    vertical-align: middle;
}
.eplx-icon--16 { width: 16px; height: 16px; }
.eplx-icon--12 { width: 12px; height: 12px; }
.eplx-icon--20 { width: 20px; height: 20px; }

/* ---------- кнопки ---------- */
.eplx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 24px;
    border-radius: var(--eplx-radius);
    font: 600 var(--eplx-body-s) var(--eplx-font);
    text-align: center;
    cursor: pointer;
    transition: opacity .2s, background-color .2s, border-color .2s;
}
.eplx-btn--primary { background: var(--eplx-white); color: #000; }
.eplx-btn--primary:hover { opacity: .8; }
.eplx-btn--outline { border: 1px solid var(--eplx-white); color: var(--eplx-white); }
.eplx-btn--outline:hover { background: rgba(254, 254, 252, .08); }
.eplx-btn--dark { background: var(--eplx-card); color: var(--eplx-white); }
.eplx-btn--dark:hover { background: #1c1c1c; }
.eplx-btn--xs {
    min-height: 36px;
    padding: 8px 24px;
    border-radius: var(--eplx-radius-s);
    font: 600 var(--eplx-body-xs) var(--eplx-font);
}
.eplx-btn--block { display: flex; width: 100%; }
.eplx-btn:disabled { opacity: .4; cursor: default; }

/* «Перейти в раздел ↗» */
.eplx-link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: 400 var(--eplx-body-m) var(--eplx-font);
    transition: opacity .2s;
}
.eplx-link-arrow .eplx-icon { width: 12px; height: 12px; }
.eplx-link-arrow:hover { opacity: .7; }
@media (max-width: 767px) {
    .eplx-link-arrow { font: 400 var(--eplx-body-s) var(--eplx-font); }
}

/* ---------- поля ---------- */
.eplx-field {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 24px;
    border: 1px solid var(--eplx-line-2);
    border-radius: var(--eplx-radius);
    transition: border-color .2s;
}
.eplx-field:focus-within { border-color: #6e6e6e; }
.eplx-field.is-error { border-color: #500000; }
.eplx-field .eplx-icon { opacity: .4; }
.eplx-field__input {
    flex: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--eplx-white);
    font: 400 var(--eplx-body-s) var(--eplx-font);
}
.eplx-field__input::placeholder { color: var(--eplx-white); opacity: .4; }
.eplx-field__error { margin-top: 4px; color: var(--eplx-red); font: var(--eplx-caption) var(--eplx-font); }

/* select в стиле поля */
.eplx-select { position: relative; }
.eplx-select select {
    width: 100%;
    min-height: 48px;
    padding: 12px 48px 12px 24px;
    border: 1.3px solid #282828;
    border-radius: var(--eplx-radius);
    background: transparent;
    color: rgba(254, 254, 252, .4);
    font: 400 var(--eplx-body-s) var(--eplx-font);
    appearance: none;
    cursor: pointer;
}
.eplx-select select option { background: var(--eplx-card); color: var(--eplx-white); }
.eplx-select .eplx-icon {
    position: absolute;
    right: 24px;
    top: 50%;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    opacity: .4;
    pointer-events: none;
}

/* ---------- чекбокс ---------- */
.eplx-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font: 400 var(--eplx-caption) var(--eplx-font);
}
.eplx-check__text { opacity: .5; }
.eplx-check__text a { text-decoration: underline; }
.eplx-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.eplx-check__box {
    position: relative;
    flex: none;
    width: 14px;
    height: 14px;
    border: 1px solid var(--eplx-line-2);
    border-radius: var(--eplx-radius-xs);
}
.eplx-check input:checked + .eplx-check__box { background: var(--eplx-white); border-color: var(--eplx-white); }
.eplx-check input:checked + .eplx-check__box::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 1px;
    width: 4px;
    height: 7px;
    border: solid #000;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.eplx-check input:focus-visible + .eplx-check__box { outline: 1px solid var(--eplx-gray); outline-offset: 2px; }
.eplx-check input:disabled + .eplx-check__box { opacity: .6; }

/* ---------- метка ---------- */
.eplx-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 3px 12px 2px;
    border-radius: 44px;
    background: #212121;
    font: 400 var(--eplx-caption) var(--eplx-font);
}

/* ---------- счётчик на иконке ---------- */
.eplx-badge {
    position: absolute;
    top: -4px;
    left: 16px;
    min-width: 14px;
    height: 12px;
    padding: 0 4px;
    border-radius: 6px;
    background: var(--eplx-white);
    color: var(--eplx-card);
    font: 600 10px/12px var(--eplx-font);
    text-align: center;
}
.eplx-badge:empty, .eplx-badge[data-count="0"] { display: none; }
@media (max-width: 767px) {
    /* в мобильной шапке счётчик — точка 6×6 */
    .eplx-badge { top: 2px; left: 19px; min-width: 6px; width: 6px; height: 6px; padding: 0; font-size: 0; }
}

/* ---------- попап ---------- */
.eplx-popup {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, .7);
}
.eplx-popup.is-open { display: flex; }
.eplx-popup__dialog {
    position: relative;
    width: 100%;
    max-width: 775px;
    max-height: calc(100vh - 32px);
    overflow: auto;
    padding: 40px 120px;
    border-radius: var(--eplx-radius);
    background: var(--eplx-card);
}
.eplx-popup__close {
    position: absolute;
    top: 20px;
    right: 20px;
    opacity: .4;
    transition: opacity .2s;
}
.eplx-popup__close:hover { opacity: 1; }
.eplx-popup__title { margin-bottom: 12px; text-align: center; font: 600 var(--eplx-h5) var(--eplx-font); }
@media (max-width: 767px) {
    .eplx-popup { align-items: flex-end; padding: 0; }
    .eplx-popup__dialog { max-height: 100vh; padding: 40px 16px 24px; border-radius: var(--eplx-radius) var(--eplx-radius) 0 0; }
    .eplx-popup__title { font: 600 var(--eplx-body-m) var(--eplx-font); }
}

/* ---------- 404 ---------- */
.eplx-404 { padding: var(--eplx-section-gap) var(--eplx-gutter); }
.eplx-404 .eplx-h4 { margin-bottom: 16px; }

/* ---------- уведомление ---------- */
.eplx-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 1100;
    max-width: calc(100% - 32px);
    padding: 12px 24px;
    border-radius: var(--eplx-radius);
    background: var(--eplx-white);
    color: #000;
    font: 600 var(--eplx-body-xs) var(--eplx-font);
    opacity: 0;
    transform: translate(-50%, 20px);
    transition: opacity .2s, transform .2s;
    pointer-events: none;
}
.eplx-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- строки «название ....... значение» и таблица (код ЭПЛ, характеристики товара) ---------- */
.eplx-code-res__rows { display: flex; flex-direction: column; gap: 4px; font: 400 var(--eplx-body-s) var(--eplx-font); }
.eplx-code-res__row { display: flex; align-items: baseline; gap: 8px; }
.eplx-code-res__row span:first-child { font-weight: 600; white-space: nowrap; }
.eplx-code-res__row i { flex: 1; border-bottom: 1px dotted var(--eplx-line-2); }
.eplx-code-res__row span:last-child { text-align: right; }
.eplx-code-res__table-wrap { margin-top: 32px; overflow-x: auto; }
.eplx-code-res__table { width: 100%; border-collapse: collapse; font: 400 var(--eplx-body-s) var(--eplx-font); }
.eplx-code-res__table th, .eplx-code-res__table td { padding: 12px 18px; border: 1px solid var(--eplx-line-2); text-align: left; }
.eplx-code-res__table th { font-weight: 600; }

/* ---------- попап входа по телефону (footer.php, js/app.js) ---------- */
.eplx-auth { max-width: 532px; padding: 40px 80px; }
.eplx-auth__step { display: flex; flex-direction: column; gap: 12px; }
.eplx-auth__step[hidden] { display: none; }
.eplx-auth__field .eplx-field__input { text-align: center; }
.eplx-auth__agree { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.eplx-auth__text { color: var(--eplx-gray); text-align: center; font: 400 var(--eplx-body-xs) var(--eplx-font); }
.eplx-auth__error { color: var(--eplx-red); text-align: center; font: 400 var(--eplx-body-xs) var(--eplx-font); }
.eplx-auth__error:empty { display: none; }
.eplx-auth__code { display: flex; justify-content: center; gap: 8px; margin: 8px 0; }
.eplx-auth__digit {
    width: 48px;
    height: 56px;
    border: 1px solid var(--eplx-line-2);
    border-radius: var(--eplx-radius);
    background: transparent;
    color: var(--eplx-white);
    font: 400 var(--eplx-body-m) var(--eplx-font);
    text-align: center;
    outline: 0;
}
.eplx-auth__digit:focus { border-color: #6e6e6e; }
.eplx-auth__socials { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.eplx-auth__social {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 72px;
    border: 1px solid var(--eplx-line-2);
    border-radius: 16px;
    font: 600 var(--eplx-body-xs) var(--eplx-font);
    transition: border-color .2s;
}
button.eplx-auth__social { width: 100%; color: var(--eplx-white); cursor: pointer; }
.eplx-auth__social:hover { border-color: var(--eplx-white); }
.eplx-auth__social b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--eplx-white);
    color: #000;
    font: 600 14px/1 var(--eplx-font);
}
.eplx-auth__social .eplx-icon { width: 24px; height: 24px; padding: 3px; border-radius: 50%; background: var(--eplx-white); fill: #000; color: #000; }
.eplx-auth__note { color: var(--eplx-gray-2); text-align: center; font: 400 var(--eplx-caption) var(--eplx-font); }
.eplx-auth__captcha:empty { display: none; }
@media (max-width: 767px) {
    .eplx-auth { padding: 40px 16px 24px; }
}

/* ---------- попап салонов и ПВЗ (footer.php, js/salons.js) ---------- */
.eplx-salons { max-width: 1077px; padding: 32px; }
.eplx-salons__title { padding-right: 32px; font: 600 var(--eplx-h5) var(--eplx-font); }
.eplx-salons__city { margin-top: 8px; color: var(--eplx-gray); font: 400 var(--eplx-body-xs) var(--eplx-font); }
.eplx-salons__city button { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; color: var(--eplx-gray-2); }
.eplx-salons__city button:hover { color: var(--eplx-white); }
.eplx-salons__body { display: grid; grid-template-columns: 277px minmax(0, 1fr); gap: 12px; margin-top: 24px; height: 560px; }
.eplx-salons__aside { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.eplx-salons__aside .eplx-field { min-height: 44px; padding: 10px 16px; border-radius: var(--eplx-radius-s); }
.eplx-salons__tabs { display: none; }
.eplx-salons__list { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; padding-right: 4px; }
.eplx-salons__list::-webkit-scrollbar { width: 3px; }
.eplx-salons__list::-webkit-scrollbar-thumb { background: #4f4f4f; }
.eplx-salons__map { min-height: 0; border-radius: var(--eplx-radius); background: #1c1c1c; overflow: hidden; }
.eplx-salons__empty { padding: 20px; color: var(--eplx-gray); text-align: center; font: 400 var(--eplx-body-xs) var(--eplx-font); }

.eplx-switch { display: flex; align-items: center; gap: 8px; cursor: pointer; font: 400 var(--eplx-caption) var(--eplx-font); }
.eplx-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.eplx-switch i { position: relative; flex: none; width: 28px; height: 16px; border-radius: 8px; background: #3a3a3a; transition: background-color .2s; }
.eplx-switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--eplx-white); transition: transform .2s; }
.eplx-switch input:checked + i { background: #8a8a8a; }
.eplx-switch input:checked + i::after { transform: translateX(12px); }

.eplx-salon {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 16px 20px;
    border: 1px solid var(--eplx-line-3);
    border-radius: var(--eplx-radius);
    cursor: pointer;
    transition: border-color .2s;
}
.eplx-salon:hover, .eplx-salon.is-active { border-color: var(--eplx-line-2); }
.eplx-salon__stock.is-in-stock { background: var(--eplx-green); }
.eplx-salon__name { font: 600 var(--eplx-body-xs) var(--eplx-font); }
.eplx-salon__address, .eplx-salon__time { color: var(--eplx-gray); font: 400 var(--eplx-caption) var(--eplx-font); white-space: pre-line; }
.eplx-salon__phone { font: 600 var(--eplx-body-xs) var(--eplx-font); }
.eplx-salon .eplx-btn { margin-top: 8px; }
.eplx-salon__route { margin-top: 4px; font: 400 var(--eplx-body-xs) var(--eplx-font); }
@media (max-width: 1023px) {
    .eplx-salons__body { grid-template-columns: minmax(0, 1fr); height: auto; }
    .eplx-salons__tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: var(--eplx-radius); background: #1c1c1c; }
    .eplx-salons__tabs button { min-height: 36px; border-radius: var(--eplx-radius-s); color: var(--eplx-gray); font: 600 var(--eplx-body-xs) var(--eplx-font); }
    .eplx-salons__tabs button.is-active { background: #000; color: var(--eplx-white); }
    .eplx-salons__list { max-height: 55vh; }
    .eplx-salons__map { display: none; height: 55vh; }
    #eplx-popup-salons[data-tab="map"] .eplx-salons__list { display: none; }
    #eplx-popup-salons[data-tab="map"] .eplx-salons__map { display: block; }
}
@media (max-width: 767px) {
    .eplx-salons { padding: 32px 16px 16px; }
    .eplx-salons__title { font: 600 var(--eplx-body-m) var(--eplx-font); }
}
