/* ─── Custom Properties ─── */
:root {
    --primary: #1a56db;
    --accent: #f59e0b;
    --text-dark: #1f2937;
    --card-radius: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.06);
    --shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

/* ─── Global ─── */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text-dark);
    background: #f8fafc;
}

a { color: var(--primary); }

/* ─── Hero banner ─── */
.hero-banner {
    background: linear-gradient(135deg, #1a56db 0%, #0e3b9e 60%, #1a1a2e 100%);
    min-height: 380px;
}

/* ─── Navbar ─── */
.navbar-dark.bg-primary {
    background: linear-gradient(90deg, #1a56db, #1e40af) !important;
}

.navbar-search {
    width: 100%;
    max-width: 420px;
}

.navbar .cart-badge {
    font-size: .6rem;
}

.navbar-mobile-actions .navbar-cart-mobile {
    padding: .5rem .625rem;
    color: rgba(255, 255, 255, .9);
}

.navbar-mobile-actions .navbar-cart-mobile:hover,
.navbar-mobile-actions .navbar-cart-mobile:focus {
    color: #fff;
}

.navbar-mobile-actions .navbar-toggler {
    padding: .375rem .5rem;
}

/* ─── Product cards ─── */
.product-card {
    border-radius: var(--card-radius);
    transition: transform .2s ease, box-shadow .2s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow) !important;
}

.product-card-img {
    height: 200px;
    object-fit: cover;
    border-radius: var(--card-radius) var(--card-radius) 0 0;
}

.product-card-title a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── Category card ─── */
.category-card {
    border-radius: var(--card-radius);
    transition: transform .2s ease, box-shadow .2s ease;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow) !important;
}

/* ─── Category horizontal scroll (mobile) ─── */
.category-scroll-bar {
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

.category-scroll {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding: .625rem 1rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-scroll::-webkit-scrollbar {
    display: none;
}

.category-scroll-item {
    flex-shrink: 0;
    padding: .375rem .875rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #dee2e6;
    color: var(--text-dark);
    text-decoration: none;
    font-size: .8125rem;
    white-space: nowrap;
    transition: background .15s, border-color .15s;
}

.category-scroll-item:hover,
.category-scroll-item:focus {
    background: #e8f0fe;
    border-color: var(--primary);
    color: var(--primary);
}

.category-scroll-item--child {
    font-size: .75rem;
    opacity: .9;
}

/* ─── Product detail ─── */
.product-detail-img {
    height: 420px;
    object-fit: contain;
    background: #f8fafc;
    border-radius: var(--card-radius);
}

.thumbnail-img {
    width: 75px;
    height: 75px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .15s;
}

.thumbnail-img:hover {
    border-color: var(--primary);
}

.qty-input-group {
    width: 140px;
}

.qty-input-group .btn {
    min-width: 2.5rem;
}

/* ─── Price block ─── */
.price-block {
    background: linear-gradient(to right, #eff6ff, #f0fdf4);
    border-radius: var(--card-radius);
}

/* ─── Cart ─── */
.cart-item-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.min-w-0 {
    min-width: 0;
}

/* ─── Breadcrumb ─── */
.breadcrumb {
    background: transparent;
    padding: 0;
    font-size: .875rem;
}

.breadcrumb-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.breadcrumb-scroll .breadcrumb {
    white-space: nowrap;
}

/* ─── Pagination ─── */
.page-link {
    border-radius: 8px !important;
    margin: 0 2px;
}

/* ─── Forms ─── */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .2rem rgba(26, 86, 219, .2);
}

/* ─── Hover shadow util ─── */
.hover-shadow:hover {
    box-shadow: var(--shadow) !important;
}

/* ─── Footer ─── */
footer a.footer-link {
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    transition: color .15s ease;
}

footer a.footer-link:hover {
    color: #fff;
}

footer .footer-text-muted {
    color: rgba(255, 255, 255, 0.65) !important;
}

/* ─── Yandex rating badge ─── */
.yandex-rating-badge {
    display: inline-block;
    line-height: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.yandex-rating-badge iframe {
    display: block;
    border: 0;
}

.yandex-rating-badge--nav {
    box-shadow: none;
}

.navbar-brand {
    max-width: calc(100% - 7rem);
}

.navbar-brand .text-truncate {
    max-width: 12rem;
}

@media (min-width: 576px) {
    .navbar-brand .text-truncate {
        max-width: 16rem;
    }
}

.yandex-rating-badge--hero {
    background: rgba(255, 255, 255, 0.95);
    padding: .75rem 1rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.hero-rating-caption {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.yandex-rating-badge--footer {
    box-shadow: none;
}

/* ─── Alert colours (map Bootstrap message tags) ─── */
.alert-error { background-color: #fee2e2; border-color: #fca5a5; color: #991b1b; }

/* ─── Badge sizing ─── */
.badge.fs-6 { font-size: .9rem !important; }

/* ─── Catalog toolbar ─── */
.catalog-toolbar .form-select {
    min-width: 8rem;
}

/* ─── Compact catalog filters ─── */
.filters-card {
    position: sticky;
    top: 1rem;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-sm);
}

.filters-card .card-header {
    padding: .65rem .9rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    font-size: .875rem;
}

.filters-card .card-body {
    padding: .85rem .9rem;
}

.product-filters {
    display: flex;
    flex-direction: column;
    gap: .7rem;
}

.product-filters__field .form-label {
    margin-bottom: .2rem;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: #6b7280;
}

.product-filters__price {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.product-filters__price .form-control {
    min-width: 0;
}

.product-filters__price-sep {
    color: #9ca3af;
    flex-shrink: 0;
    line-height: 1;
}

.product-filters__availability .form-check-label {
    font-size: .875rem;
}

.product-filters__actions {
    display: flex;
    gap: .5rem;
    margin-top: .15rem;
}

.filter-chips {
    row-gap: .4rem;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    max-width: 100%;
    padding: .2rem .45rem .2rem .55rem;
    border: 1px solid #dbe3f0;
    border-radius: 999px;
    background: #eef3fb;
    color: var(--text-dark);
    font-size: .78rem;
    line-height: 1.25;
    text-decoration: none;
}

.filter-chip:hover {
    background: #e2ebf8;
    border-color: #c5d4ea;
    color: var(--text-dark);
}

.filter-chip__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: rgba(26, 86, 219, .12);
    color: var(--primary);
    font-size: .85rem;
    line-height: 1;
    flex-shrink: 0;
}

.filter-chips__clear {
    color: #6b7280;
    text-decoration: none;
    white-space: nowrap;
}

.filter-chips__clear:hover {
    color: var(--primary);
    text-decoration: underline;
}

.catalog-filters-btn .badge {
    font-size: .65rem;
    vertical-align: text-top;
}

.subcategory-chips .btn {
    white-space: normal;
    text-align: center;
}

.product-specs-table td:first-child {
    width: 40%;
    min-width: 8rem;
}

.offcanvas {
    max-width: min(320px, 90vw);
}

/* ─── Responsive ─── */
.hero-banner h1,
.hero-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

@media (max-width: 991.98px) {
    .hero-banner { min-height: auto; }
    .product-card-img { height: 150px; }
    .product-detail-img { height: 280px; }
    .thumbnail-img { width: 64px; height: 64px; }
    .catalog-sort-select { min-width: 0; width: 100%; }
    .cart-summary-card { position: sticky; bottom: 0; z-index: 10; }
    main.py-4 { padding-top: 1rem !important; padding-bottom: 1.5rem !important; }
    footer.py-5 { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }

    .btn-sm {
        min-height: 2.5rem;
        padding-top: .375rem;
        padding-bottom: .375rem;
    }

    .form-control-sm,
    .form-select-sm {
        min-height: 2.5rem;
    }

    .navbar .nav-link {
        padding-top: .625rem;
        padding-bottom: .625rem;
    }
}

@media (max-width: 768px) {
    .hero-banner { min-height: 260px; padding: 2rem !important; }
    .product-card-img { height: 160px; }
}

@media (max-width: 575.98px) {
    .hero-banner { padding: 1.5rem !important; }
    .product-card-img { height: 130px; }
    .product-card-title { font-size: .85rem; line-height: 1.3; }
    .product-card-price .fs-6 { font-size: .95rem !important; }
    .container { padding-left: .875rem; padding-right: .875rem; }
    .page-link { min-width: 2.25rem; text-align: center; }
    .yandex-rating-badge--hero { width: 100%; text-align: center; }
    .catalog-toolbar .form-select { min-width: 0; }
}

@media (hover: none) {
    .product-card:hover,
    .category-card:hover {
        transform: none;
    }
}

/* ─── Legal documents ─── */
.legal-document {
    border-radius: var(--card-radius);
}

.legal-document__body {
    font-size: .9375rem;
    line-height: 1.7;
    white-space: pre-line;
}

.legal-requisites-table th {
    vertical-align: top;
    font-weight: 600;
}

/* ─── Cookie consent banner ─── */
.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1080;
    background: #1f2937;
    color: #f9fafb;
    padding: .875rem 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, .15);
}

.cookie-consent__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1rem;
}

.cookie-consent__link {
    color: #fbbf24;
    text-decoration: underline;
}

.cookie-consent__link:hover {
    color: #fcd34d;
}

@media (max-width: 575.98px) {
    .cookie-consent__inner {
        flex-direction: column;
        align-items: stretch;
    }
}
