/* ============================================================
   ПСК «Апекс» — стили фиксов: корзина, тосты, поиск, reveal.
   Подключается после redesign.css.
   ============================================================ */

:root {
    --apx-red: #e4002b;
    --apx-red-dark: #b80022;
    --apx-navy: #182849;
    --apx-ink: #1c2333;
    --apx-muted: #6b7280;
    --apx-line: #e6e8ee;
    --apx-ok: #1a7f37;
    --apx-err: #c0392b;
}

/* ---------- Корзина ---------- */
.apex-cart-card {
    background: #fff;
    border: 1px solid var(--apx-line);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(16, 28, 54, 0.08);
    padding: 28px;
    margin-bottom: 28px;
}

.apex-cart-card .table { margin-bottom: 12px; }
.apex-cart-card .table th {
    font-family: "Montserrat", sans-serif;
    font-size: 12.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--apx-muted);
    border-top: none;
}
.apex-cart-card .table td { vertical-align: middle; }
.apex-cart-card .input_num {
    width: 74px;
    text-align: center;
    border: 1px solid var(--apx-line);
    border-radius: 8px;
    padding: 6px 4px;
}
.apex-cart-card .minus, .apex-cart-card .plus { cursor: pointer; padding: 0 8px; user-select: none; }
.apex-cart-card .remove_item .fa-cart-plus { cursor: pointer; }

.apex-cart-card .total_sum_product {
    font-family: "Montserrat", sans-serif;
    font-weight: 800;
    font-size: 20px;
    color: var(--apx-navy);
    text-align: right;
    padding: 14px 4px 4px;
    border-top: 2px solid var(--apx-line);
    margin-top: 8px;
}

.empty_cart {
    text-align: center;
    padding: 48px 0 40px;
    color: var(--apx-muted);
    font-size: 17px;
}

/* Позиция с нулевым количеством: гаснет, но не удаляется */
.apex-cart-card tr.apex-row-zero { opacity: 0.45; }
.apex-cart-card tr.apex-row-zero .input_num { border-color: var(--apx-err); }

.apex-order-note {
    background: #fff8e6;
    border: 1px solid #f0e2bb;
    border-radius: 10px;
    color: #7a5c14;
    font-size: 13.5px;
    line-height: 1.55;
    padding: 12px 16px;
    margin: 14px 0 22px;
}

/* ---------- Форма заказа ---------- */
.apex-order-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
}
.apex-field-full { grid-column: 1 / -1; }
.apex-field label {
    display: block;
    font-family: "Montserrat", sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--apx-navy);
    margin-bottom: 6px;
}
.apex-field .req { color: var(--apx-red); }
.apex-field .form-control {
    border: 1px solid var(--apx-line);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 15px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.apex-field .form-control:focus {
    border-color: var(--apx-red);
    box-shadow: 0 0 0 3px rgba(228, 0, 43, 0.12);
    outline: none;
}
.apex-checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; color: var(--apx-ink); cursor: pointer; }
.apex-checkbox input { margin-top: 4px; }
.apex-hp { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; }

.apex-order-actions { display: flex; align-items: center; gap: 18px; margin-top: 22px; flex-wrap: wrap; }
.apex-order-actions .btn {
    background: var(--apx-red);
    border: 2px solid var(--apx-red);
    border-radius: 10px;
    font-family: "Montserrat", sans-serif;
    font-weight: 800;
    font-size: 13.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 13px 34px;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.apex-order-actions .btn:hover {
    background: var(--apx-red-dark);
    border-color: var(--apx-red-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(228, 0, 43, 0.3);
}
#callback-status { font-size: 14.5px; min-height: 22px; }
#callback-status.is-ok { color: var(--apx-ok); }
#callback-status.is-err { color: var(--apx-err); }

.invalid_description { display: none; color: var(--apx-err); font-size: 12.5px; margin-top: 4px; }

@media (max-width: 700px) {
    .apex-order-grid { grid-template-columns: 1fr; }
    .apex-cart-card { padding: 18px; }
    .apex-cart-card .table thead { display: none; }
    .apex-cart-card .table tr { display: block; border-bottom: 1px solid var(--apx-line); padding: 10px 0; }
    .apex-cart-card .table td { display: block; border: none; padding: 4px 0; }
}

/* ---------- Тосты ---------- */
.apex-toast-host {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.apex-toast {
    pointer-events: auto;
    background: var(--apx-navy);
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(8, 18, 38, 0.35);
    padding: 14px 18px;
    min-width: 280px;
    max-width: 360px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.apex-toast.is-in { opacity: 1; transform: translateY(0); }
.apex-toast-title { font-family: "Montserrat", sans-serif; font-weight: 700; font-size: 14.5px; margin-bottom: 2px; }
.apex-toast-text { font-size: 13.5px; color: #cdd6e6; }
.apex-toast-link {
    display: inline-block;
    margin-top: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.apex-toast-link:hover { color: #ffd7dd; }

/* ---------- Возврат корзины (шаблон v13 прячет её правилами
   «Корзина отключена» в redesign.css) ---------- */
#desktop-menu .col-sm-2 { display: block !important; }
#desktop-menu .cart a { display: inline-flex !important; align-items: center; }
#mobile-menu .cart-mobile,
.cart-mobile { display: block !important; }
.cart-mobile a { position: relative; display: inline-block !important; }
a[href="/cart"] { display: inline-block !important; }

/* ---------- Бейдж корзины ---------- */
.cart .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    background: var(--apx-red);
    color: #fff;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 22px;
    padding: 0 6px;
    font-family: "Montserrat", sans-serif;
}
.cart .count:empty { display: none; }
.cart .count.apex-bump { animation: apexBump 0.45s ease; }
@keyframes apexBump {
    0% { transform: scale(1); }
    40% { transform: scale(1.35); background: var(--apx-red); }
    100% { transform: scale(1); }
}
/* Мобильный бейдж: !important перекрывает display:none!important
   из style.css (медиа-блок ~2194), иначе цифра не видна на телефоне */
.cart-mobile .count {
    display: flex !important;
    position: absolute;
    top: -7px;
    right: -9px;
    background: var(--apx-red);
    color: #fff;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    line-height: 17px;
    justify-content: center;
    align-items: center;
    padding: 0 4px;
    font-family: "Montserrat", sans-serif;
    z-index: 30;
}
.cart-mobile .count:empty { display: none !important; }
.cart .count.apex-cart-badge,
.cart-mobile .count.apex-bump { animation: apexBump 0.45s ease; }
.apex-cart-badge {
    position: absolute;
    top: -6px;
    right: -10px;
    background: var(--apx-red);
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    padding: 0 4px;
}
.cart-mobile a { position: relative; display: inline-block; }

/* ---------- Reveal-анимации ---------- */
.apex-reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s ease; }
.apex-reveal.is-revealed { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    .apex-reveal { opacity: 1; transform: none; transition: none; }
    .apex-toast, .cart .count.apex-bump { animation: none; transition: none; opacity: 1; transform: none; }
    * { scroll-behavior: auto !important; }
}
