/**
 * @file: frontend-utilities.css
 * @description: Общие стили фронтенда, вынесенные из inline.
 * @dependencies: /static/css/style.css, /static/css/main.css
 * @created: 2026-01-31
 */

:root {
    --font-family-base: 'Montserrat', sans-serif;
    --content-indent: 8px; /* минимальный отступ, вплотную к краям */
}

/* Bootstrap container tweak (preview parity) */
div.container-fluid {
    padding-left: 11px;
}

/* Global page content padding */
.page-content {
    padding-left: var(--content-indent);
    padding-right: var(--content-indent);
}

.page-content-left {
    padding-left: var(--content-indent);
}

.page-content-right {
    padding-right: var(--content-indent);
}

body, button, input, select, textarea, a, h1, h2, h3, h4, h5, h6, p, small, span, label, li, ul, ol {
    font-family: 'Montserrat', sans-serif !important;
}

/* Tabs module: mobile 1 card per view — только внутри главной вкладки, не PDP «Другие товары» (.related-products-section) */
@media (max-width: 767px) {
    .tabs-module-container .products-carousel .swiper-wrapper {
        width: 100% !important;
    }
    .tabs-module-container .products-carousel .swiper-slide {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        padding: 0 !important;
        flex: 0 0 auto !important;
    }
}

/* Tabs nav: single row with horizontal scroll on mobile */
.tabs-navigation .nav {
    flex-wrap: nowrap !important;
    gap: 0.75rem;
    justify-content: center;
}
.tabs-navigation .nav-link {
    white-space: nowrap;
}
@media (max-width: 576px) {
    .tabs-navigation .nav {
        justify-content: flex-start !important;
    }
}

/* Favorite buttons unified */
.fav-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: #fff;
    border: 1px solid #000;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
    color: #000;
    opacity: 1;
}
.fav-btn svg {
    width: 16px;
    height: 16px;
    color: #000;
}
.fav-btn svg path {
    fill: none;
    stroke: currentColor;
}
.fav-btn:hover {
    transform: scale(1.05);
}
.fav-btn.active {
    background: #fff;
    color: #000;
    border-color: #000;
}
.fav-btn.active svg path {
    fill: currentColor;
    stroke: currentColor;
}

/* Unified alerts: minimal style matching offcanvas design */
.alert {
    border: 1px solid #e5e5e5 !important;
    border-radius: 0 !important;
    padding: 10px 12px !important;
    box-shadow: none;
    font-weight: 500;
    font-size: 12px;
    background: #fff !important;
    color: #111 !important;
}
.alert-success,
.alert-warning,
.alert-danger,
.alert-info,
.alert-primary,
.alert-secondary {
    background: #fff !important;
    color: #111 !important;
    border-color: #e5e5e5 !important;
}
.alert.position-fixed {
    min-width: 200px;
    max-width: 320px;
}
.alert .btn-close {
    filter: none;
    opacity: 0.6;
    width: 12px;
    height: 12px;
    padding: 8px;
}
.alert .btn-close:hover {
    opacity: 1;
}
.alert strong {
    font-weight: 600;
}

/* Offcanvas width on desktop (cart/auth/user) */
@media (min-width: 992px) {
    #cartOffcanvas.offcanvas-end,
    #authOffcanvas.offcanvas-end,
    #userOffcanvas.offcanvas-end {
        width: 30vw;
        max-width: 30vw;
    }
}

/* Конвертер валют */
.currency-converter {
    position: relative;
}
.currency-converter .dropdown-toggle {
    display: flex;
    align-items: center;
    font-weight: 500;
    border: none !important;
    box-shadow: none !important;
}
.currency-converter .dropdown-toggle::after,
#currencyDropdownMobile.dropdown-toggle::after {
    display: none;
}
.currency-converter .dropdown-toggle:focus {
    outline: none;
    box-shadow: none;
}
.currency-converter .dropdown-menu {
    min-width: auto;
    width: auto;
    padding: 0.25rem 2.5px;
    border: none;
    box-shadow: none;
    background: #fff;
}
.currency-converter #currencyDropdownMenu {
    left: 0 !important;
    right: auto !important;
    top: 100% !important;
    margin-top: 2px;
}
.currency-converter #currencyDropdownMenu li {
    width: auto;
}
.currency-converter .dropdown-item {
    font-size: 0.9rem;
    width: auto;
    height: auto;
    padding: 0.25rem 5px;
}
.currency-converter .currency-option {
    cursor: pointer;
    padding: 0;
    display: block;
    text-decoration: none;
    color: inherit;
    font-weight: 500;
}
.currency-converter .currency-option:hover {
    background: transparent;
    text-decoration: none;
}
.currency-converter .currency-option.active {
    background: transparent;
    font-weight: 600;
}

/* Правая зона навбара */
nav.navbar .d-md-flex.align-items-center.d-none.ms-auto {
    min-height: 28px;
}

nav.navbar .navbar-right {
    gap: 12px;
    overflow: visible;
    padding-left: 20px;
    padding-right: 20px;
}

nav.navbar .navbar-icons {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

nav.navbar .navbar-icons .nav-item {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

nav.navbar .navbar-icons .nav-link {
    padding: 0;
}

nav.navbar .navbar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 20px;
    height: 20px;
    color: #000;
    transition: color 0.15s ease;
}

nav.navbar .navbar-icon svg {
    width: 20px !important;
    height: 20px !important;
}

nav.navbar .navbar-icon img {
    width: 20px !important;
    height: 20px !important;
    display: block;
}

nav.navbar .navbar-icon:hover,
nav.navbar .navbar-icon:focus {
    color: #e5241f;
}

nav.navbar .navbar-icon:hover svg,
nav.navbar .navbar-icon:focus svg {
    stroke: #e5241f;
}

nav.navbar .navbar-icon:hover img,
nav.navbar .navbar-icon:focus img {
    filter: brightness(0) saturate(100%) invert(22%) sepia(88%) saturate(4277%) hue-rotate(347deg) brightness(92%) contrast(97%);
}

nav.navbar #searchbox:hover,
nav.navbar #searchbox:focus {
    color: #e5241f;
}

nav.navbar #searchbox:hover svg,
nav.navbar #searchbox:focus svg {
    stroke: #e5241f;
}

nav.navbar .currency-converter .dropdown-toggle:hover,
nav.navbar .currency-converter .dropdown-toggle:focus {
    color: #e5241f;
}

nav.navbar .currency-converter .dropdown-toggle:hover #currencyDisplay,
nav.navbar .currency-converter .dropdown-toggle:focus #currencyDisplay {
    color: #e5241f;
}

nav.navbar .cart-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #000;
}

nav.navbar .cart-icon-wrapper svg {
    width: 20px !important;
    height: 20px !important;
    stroke: currentColor;
}

nav.navbar .cart-icon-wrapper:hover,
nav.navbar .cart-icon-wrapper:focus {
    color: #e5241f;
}

nav.navbar .cart-count-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    font-size: 0.6rem;
    padding: 0.15rem 0.35rem;
    min-width: 1rem;
    line-height: 1;
}

/* Offcanvas below header (моб. шапка ~42–48px; 60px давало зазор до первого пересчёта JS) */
:root {
    --navbar-height: 48px;
    --offcanvas-top: 48px;
}

.offcanvas-below-header {
    top: var(--offcanvas-top) !important;
    height: calc(100% - var(--offcanvas-top)) !important;
    margin-top: 0;
}

.offcanvas-backdrop {
    top: var(--offcanvas-top) !important;
    height: calc(100% - var(--offcanvas-top)) !important;
    padding-left: 0;
    padding-right: 0;
    margin-left: 0;
    margin-right: 0;
    border: none;
    outline: none;
}

#currencyDisplay {
    font-size: 14px;
    color: rgba(0, 0, 0, 1);
    height: 18px;
}

.offcanvas-backdrop {
    font-size: 12px;
}

/* Верхняя плашка */
h6.text-white {
    font-size: 12px;
}

/* Quantity controls */
.quantity-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.quantity-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #000;
    color: #fff;
    border: 1px solid #000;
    border-radius: 0;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.quantity-btn:hover {
    background: #222;
    border-color: #222;
    color: #fff;
}
.quantity-input {
    width: 56px;
    height: 32px;
    text-align: center;
    border: 1px solid #000;
    border-radius: 0;
    padding: 0 6px;
    font-size: 14px;
}
.quantity-input.no-spin {
    -moz-appearance: textfield;
}
.quantity-input.no-spin::-webkit-outer-spin-button,
.quantity-input.no-spin::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.quantity-input:focus {
    outline: none;
    border-color: #000;
    box-shadow: none;
}

/* Slider buttons: стекло + blur как у .carousel-card__button (rgba 10%, backdrop-filter на элементе) */
.slider-hover-btn {
    position: relative;
    isolation: isolate;
    font-weight: 600;
    color: rgba(255, 255, 255, 1);
    background: rgba(255, 255, 255, 0.1) !important;
    background: color-mix(in srgb, var(--slider-btn-bg, #ffffff) 10%, transparent) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    -webkit-font-smoothing: antialiased;
}
.slider-hover-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    background: color-mix(in srgb, var(--slider-btn-bg, #ffffff) 20%, transparent) !important;
}
.slider-hover-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* Зачёркнутая старая цена (карточки каталога, карусели, товар, мегаменю) */
span.text-decoration-line-through.text-muted {
    color: rgba(0, 0, 0, 1) !important;
    font-weight: 400;
}

/* Плавающая кнопка «Чат поддержки» (клиентская часть, не /account) */
.support-chat-fab {
    position: fixed;
    z-index: 1040;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: max(20px, env(safe-area-inset-bottom, 0px));
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    border-radius: 50%;
    background: #111;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    text-decoration: none;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.support-chat-fab:hover {
    background: #000;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}
.support-chat-fab:focus-visible {
    outline: 2px solid #111;
    outline-offset: 3px;
}
.support-chat-fab__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}
@media (max-width: 991.98px) {
    .support-chat-fab {
        bottom: max(72px, env(safe-area-inset-bottom, 0px));
    }
}
