/* ONLINE PARK — компоненты: кнопки, поля, карточки, бейджи, модалки.
   Размеры и цвета взяты из макета (радиус 8, высота контролов 50/48/47). */

/* ── Кнопки ──────────────────────────────────────────────── */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: var(--ctrl-h); padding: 0 24px;
    border: 0; border-radius: var(--r-8);
    background: var(--bg-grey); color: var(--ink);
    font-size: 14px; font-weight: 500; white-space: nowrap;
    transition: background .15s, color .15s, opacity .15s;
}
.btn:hover { color: var(--blue); background: var(--bg-grey); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

.btn-blue   { background: var(--blue); color: var(--white); }
.btn-blue:hover { background: var(--blue-h); color: var(--white); }
.btn-orange { background: var(--orange); color: var(--white); }
.btn-orange:hover { background: #e05a1d; color: var(--white); }
.btn-dark   { background: var(--ink); color: var(--white); }
.btn-dark:hover { background: #262626; color: var(--white); }
.btn-green  { background: var(--green); color: var(--ink); }
.btn-green:hover { background: var(--green-t); color: var(--ink); }
.btn-white  { background: var(--white); color: var(--ink); }
.btn-white:hover { background: var(--bg); color: var(--ink); }
.btn-line   { background: transparent; border: 1px solid var(--ink-10); }
.btn-outline { background: var(--white); border: 1px solid var(--blue); color: var(--ink); }
.btn-outline:hover { background: var(--blue); border-color: var(--blue); color: var(--white); }
.btn-line:hover { background: var(--white); }

.btn-sm  { height: 40px; padding: 0 16px; font-size: 13px; }
.btn-lg  { height: 56px; padding: 0 32px; font-size: 16px; font-weight: 600; }
.btn-ico { width: var(--ctrl-h); padding: 0; }
.btn-ico.btn-sm { width: 40px; }
.btn-full { width: 100%; }

/* ── Поля ────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 500; }
.field .hint { font-size: 11px; opacity: .4; }

.input, .select, .textarea {
    width: 100%; height: var(--ctrl-h); padding: 0 16px;
    background: var(--white); color: var(--ink);
    border: 1px solid var(--ink-10); border-radius: var(--r-8);
    font-size: 14px; outline: none;
    transition: border-color .15s;
}
.textarea { height: auto; min-height: 110px; padding: 14px 16px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue); }
.input::placeholder, .textarea::placeholder { color: var(--ink); opacity: .3; }

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23060606' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 16px center;
    padding-right: 38px;
}

/* Ошибка поля: показывается и клиентским скриптом, и серверным ответом.
   :not(:empty) обязателен — иначе серверная валидация невидима. */
.field-error { display: none; color: var(--red); font-size: 12px; }
.field-error:not(:empty) { display: block; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--red); }
.field:has(.field-error:not(:empty)) .input,
.field:has(.field-error:not(:empty)) .select,
.field:has(.field-error:not(:empty)) .textarea { border-color: var(--red); }

.check { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--blue); }

/* ── Бейджи и чипы ───────────────────────────────────────── */

.badge {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 4px 8px; border-radius: var(--r-8);
    font-size: 12px; font-weight: 700; letter-spacing: 1.2px; white-space: nowrap;
}
.badge-sale  { background: var(--orange); color: var(--bg); }
.badge-new   { background: var(--green); color: var(--ink); }
.badge-hit   { background: var(--blue); color: var(--white); }
.badge-soon  { background: var(--green); color: var(--ink); padding: 2px 8px; border-radius: var(--r-16); font-size: 11px; font-weight: 400; letter-spacing: 0; }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 8px; border-radius: var(--r-12);
    background: var(--ink-3); font-size: 12px; font-weight: 500; white-space: nowrap;
}
.chip-btn { border: 0; }
.chip-btn:hover { background: rgba(6, 6, 6, .07); }
.chip-on { background: var(--blue); color: var(--white); }
.chip-on:hover { background: var(--blue-h); }

.count {
    position: absolute; top: 6px; right: 6px;
    min-width: 12px; height: 12px; padding: 0 3px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--r-24);
    background: var(--green); color: var(--ink);
    font-size: 7px; font-weight: 600; line-height: 1;
}
.count-orange { background: var(--orange); color: var(--white); }

/* ── Карточка товара ─────────────────────────────────────── */

.card {
    display: flex; flex-direction: column; gap: 12px;
    padding: 12px; border-radius: var(--r-8);
    background: var(--white);
    transition: box-shadow .15s;
}
.card:hover { box-shadow: 0 4px 20px rgba(6, 6, 6, .08); }

.card-media { position: relative; }
.card-media > a { display: block; }
.card-img {
    display: flex; align-items: center; justify-content: center;
    height: 196px; padding: 8px; border-radius: var(--r-8); background: var(--white);
}
.card-img img { max-height: 100%; width: 100%; object-fit: contain; border-radius: var(--r-4); }
.card-img .noimg { display: block; width: 100%; height: 100%; border-radius: var(--r-4); background: var(--bg-grey); }

.card-fav {
    position: absolute; top: 0; right: 0;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border: 0; border-radius: var(--r-64);
    background: var(--ink-3); color: var(--ink);
}
.card-fav:hover { background: rgba(6, 6, 6, .07); }
.card-fav.is-on { background: var(--orange); color: var(--white); }

.card-flags { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; }

.card-body { display: flex; flex-direction: column; gap: 12px; }
.card-info { display: flex; flex-direction: column; gap: 4px; }
.card-rate { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; }
.card-rate .icon { color: var(--orange); }
.card-name {
    font-size: 15px; font-weight: 500; color: var(--ink);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 2.4em;
}
.card-specs { display: flex; gap: 4px; flex-wrap: wrap; overflow: hidden; max-height: 24px; }
.card-buy { display: flex; flex-direction: column; gap: 4px; }
/* Перенос: в узкой карточке списка старая цена не помещается рядом с новой и вылезала за экран */
.card-price { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 16px; }
.card-price b { font-size: 24px; font-weight: 700; }
.card-price s { font-size: 14px; }
.card-deliv { font-size: 11px; font-weight: 500; color: var(--blue); }
.card-actions { display: flex; gap: 8px; min-width: 0; }
.card-actions .btn { height: 47px; min-width: 0; }
.card-actions .btn-ico { width: 47px; flex: none; }
.card-actions .grow { font-size: 16px; font-weight: 600; }
/* Подпись кнопки обязана ужиматься, иначе на узком экране карточка распирает сетку. */
.card-actions .btn span { overflow: hidden; text-overflow: ellipsis; }
.card-actions form { min-width: 0; }

@media (max-width: 479px) {
    .card { padding: 8px; }
    .card-img { height: 140px; }
    .card-actions .btn { height: 42px; padding: 0 10px; }
    .card-actions .grow { font-size: 14px; }
    .card-actions .btn-ico { width: 42px; }
    .card-price b { font-size: 20px; }
    .card-name { font-size: 14px; }
}

/* Горизонтальная карточка (списком в каталоге) */
.card-row { flex-direction: row; gap: 20px; padding: 16px; }
.card-row .card-media { width: 200px; flex: none; }
.card-row .card-img { height: 160px; }
.card-row .card-body { flex: 1 0 0; min-width: 0; }
.card-row .card-name { -webkit-line-clamp: 3; }

/* ── Заголовок секции ────────────────────────────────────── */

.sec { margin-bottom: 40px; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.sec-kicker { font-size: 11px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--blue); margin-bottom: 4px; }
.sec-title { font-size: 28px; font-weight: 700; }
.sec-sub { font-size: 13px; opacity: .4; margin-top: 4px; }
.sec-more { font-size: 13px; font-weight: 500; color: var(--blue); white-space: nowrap; }

/* Горизонтальная лента с прокруткой на узких экранах */
.rail { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.rail > * { min-width: 0; }
@media (max-width: 991px) {
    .rail {
        display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
        margin: 0 -16px; padding: 0 16px 8px; gap: 12px;
    }
    .rail > * { flex: 0 0 240px; scroll-snap-align: start; }
}

/* ── Панели и таблицы ────────────────────────────────────── */

.panel { background: var(--white); border-radius: var(--r-8); padding: 24px; }
.panel + .panel { margin-top: 16px; }
.panel-grey { background: var(--bg-grey); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }

.tbl th, .tbl td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--ink-10); vertical-align: top; }
.tbl th { font-size: 12px; font-weight: 500; opacity: .4; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-scroll { overflow-x: auto; }

.empty { padding: 48px 24px; text-align: center; }
.empty-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.empty p { opacity: .5; margin-bottom: 20px; }

/* ── Сообщения ───────────────────────────────────────────── */

.alert { padding: 14px 18px; border-radius: var(--r-8); font-size: 13px; margin-bottom: 16px; }
.alert-ok  { background: var(--green); color: var(--ink); }
.alert-err { background: #fde8e8; color: #a32424; }
.alert-info{ background: var(--bg-grey); }

/* ── Модалка ─────────────────────────────────────────────── */

.modal[hidden] { display: none; }
.modal {
    position: fixed; inset: 0; z-index: 90;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    background: rgba(6, 6, 6, .5);
}
.modal-box {
    width: 100%; max-width: 452px; max-height: 90vh; overflow: auto;
    background: var(--white); border-radius: var(--r-16); padding: 32px;
}
.modal-box-wide { max-width: 720px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.modal-title { font-size: 20px; font-weight: 700; }
.modal-close {
    width: 24px; height: 24px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--red); border-radius: var(--r-4);
    background: 0; color: var(--red); font-size: 14px; line-height: 1;
}

.modal-close:hover { background: var(--red); color: var(--white); }
.modal-actions { display: flex; gap: 8px; margin-top: 24px; }
.modal-actions .btn { flex: 1 0 0; }

/* ── Хлебные крошки, пагинация, вкладки ──────────────────── */

.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; opacity: .5; margin-bottom: 16px; }
.crumbs a:hover { opacity: 1; color: var(--blue); }

.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 32px; }
.pager a, .pager span {
    min-width: 40px; height: 40px; padding: 0 12px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--r-8); background: var(--white); font-size: 13px;
}
.pager .on { background: var(--blue); color: var(--white); }
.pager .off { opacity: .35; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.tabs a, .tabs button {
    padding: 8px 16px; border: 0; border-radius: var(--r-24);
    background: var(--white); font-size: 13px; font-weight: 500;
}
.tabs .on { background: var(--ink); color: var(--white); }

/* ── Прочее ──────────────────────────────────────────────── */

.stars { display: inline-flex; gap: 2px; color: var(--orange); }
.stars .off { opacity: .2; }

.rating-big { display: flex; align-items: baseline; gap: 8px; }
.rating-big b { font-size: 40px; font-weight: 700; }

.bar { height: 6px; border-radius: 3px; background: var(--ink-10); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--orange); }

/* Модалка звонка: телефон и кнопка в одной рамке, ниже — номера отделов */
.callme { width: 452px; max-width: 100%; }
.callme-form { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 4px 0 16px; border: 1px solid var(--blue); border-radius: var(--r-12); }
.callme-ico { color: var(--blue); flex: none; display: inline-flex; }
.callme-form input { flex: 1 0 0; min-width: 0; border: 0; background: 0; outline: 0; font-size: 14px; }
.callme-form input::placeholder { color: var(--ink); opacity: .4; }
.callme-btn { height: 48px; padding: 0 24px; border-radius: var(--r-8); font-size: 15px; }
.callme-phones { margin-top: 20px; }
.callme-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--bg-grey); }
.callme-row:last-child { border-bottom: 0; }
.callme-row a { font-size: 18px; font-weight: 700; }
.callme-row span { font-size: 13px; opacity: .4; }

@media (max-width: 479px) {
    .callme-form { height: auto; flex-wrap: wrap; padding: 12px; }
    .callme-form input { flex-basis: 60%; }
    .callme-btn { width: 100%; }
}
