/* ============ Альфа-Коммерц: стили сайта ============ */
:root {
    --primary-color: #0d6efd;
    --primary-dark: #0a58ca;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --body-bg: #ffffff;
    --body-color: #212529;
    --muted-color: #6c757d;
    --card-bg: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.95);
    --footer-bg: #141414;
    --border-color: #dee2e6;
    --shadow: rgba(0, 0, 0, 0.12);
    --navbar-color: #212529;
    --section-bg: #f8f9fa;
    --glass-bg: rgba(255, 255, 255, 0.93);
    --glass-border: rgba(255, 255, 255, 0.6);
    --gradient-primary: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    --gradient-warning: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    --bg-overlay: 0;
}

[data-theme="dark"] {
    --primary-color: #4dabf7;
    --primary-dark: #3b99e6;
    --secondary-color: #868e96;
    --success-color: #51cf66;
    --warning-color: #ffd43b;
    --danger-color: #ff6b6b;
    --body-bg: #121212;
    --body-color: #e9ecef;
    --muted-color: #adb5bd;
    --card-bg: #1e1e1e;
    --header-bg: rgba(20, 20, 20, 0.94);
    --footer-bg: #0a0a0a;
    --border-color: #3a3a3a;
    --shadow: rgba(0, 0, 0, 0.45);
    --navbar-color: #f8f9fa;
    --section-bg: #1a1a1a;
    --glass-bg: rgba(22, 22, 22, 0.86);
    --glass-border: rgba(255, 255, 255, 0.08);
    --gradient-primary: linear-gradient(135deg, #4dabf7 0%, #3b99e6 100%);
    --gradient-warning: linear-gradient(135deg, #ffd43b 0%, #ffc107 100%);
}

[data-theme="dark"] .text-muted { color: var(--muted-color) !important; }
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select {
    background-color: #242424; color: var(--body-color); border-color: var(--border-color);
}
[data-theme="dark"] .form-control::placeholder { color: #7a7a7a; }
[data-theme="dark"] .table { --bs-table-color: var(--body-color); --bs-table-bg: transparent; }
[data-theme="dark"] .page-link { background: #1e1e1e; border-color: #333; color: var(--body-color); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--body-bg);
    color: var(--body-color);
    transition: background-color .3s ease, color .3s ease;
    overflow-x: hidden;
    min-height: 100vh;
}
h1, h2, h3, h4, h5, h6 { font-family: 'Cormorant Garamond', serif; font-weight: 600; }
a { color: var(--primary-color); }
img { max-width: 100%; }

/* ---------- Фон сайта (KLEBER) ---------- */
body.has-bg { background-color: #0c0c0c; }
.site-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: #0c0c0c var(--bg-desktop) center top / cover no-repeat;
    pointer-events: none;
}
.site-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, var(--bg-overlay));
}
@media (max-aspect-ratio: 1/1) {
    .site-bg { background-image: var(--bg-mobile); background-position: center top; }
}

/* Стеклянные панели поверх фона */
.glass-panel {
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 15px 35px var(--shadow);
}
.glass-on .glass-panel,
.glass-on .category-card,
.glass-on .product-card,
.glass-on .section-head {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    backdrop-filter: blur(14px) saturate(1.2);
    border-color: var(--glass-border);
}
body:not(.glass-on).has-bg .section-head { background: var(--card-bg); }

/* ---------- Навигация ---------- */
.navbar {
    background-color: var(--header-bg) !important;
    box-shadow: 0 2px 15px var(--shadow);
    padding: 14px 0;
    transition: padding .3s ease, box-shadow .3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.navbar.scrolled { padding: 8px 0; box-shadow: 0 5px 20px var(--shadow); }
.navbar-toggler { color: var(--navbar-color); border-color: var(--border-color); }
.navbar-brand { font-weight: 700; display: flex; align-items: center; color: var(--navbar-color) !important; }
.nav-link {
    color: var(--navbar-color) !important;
    font-weight: 500;
    position: relative;
    margin: 0 8px;
}
.nav-link:not(.dropdown-toggle):not(.nav-admin):after {
    content: '';
    position: absolute;
    width: 0; height: 2px; bottom: 0; left: 0;
    background-color: var(--warning-color);
    transition: width .3s ease;
}
.nav-link:hover:after, .nav-link.active:after { width: 100%; }
.nav-link:hover { color: var(--warning-color) !important; }

.letter-animation { display: inline-flex; align-items: center; }
.letter {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    color: var(--navbar-color);
    font-size: 1.7rem;
    animation: letterBounce .6s ease both;
}
.letter:first-child { font-family: 'Playfair Display', serif; color: var(--warning-color); font-size: 2.1rem; margin-right: 2px; }
@keyframes letterBounce {
    0% { transform: translateY(0) rotate(0); }
    30% { transform: translateY(-10px) rotate(-4deg); }
    55% { transform: translateY(3px) rotate(2deg); }
    80% { transform: translateY(-2px); }
    100% { transform: translateY(0) rotate(0); }
}

/* Выпадающий каталог с миниатюрами */

.nav-search { display: flex; align-items: center; margin: 6px 8px; background: var(--section-bg); border: 1px solid var(--border-color); border-radius: 30px; overflow: hidden; }
.nav-search input { border: 0; background: transparent; color: var(--body-color); padding: 6px 12px; width: 170px; outline: none; font-size: .9rem; }
.nav-search button { border: 0; background: var(--warning-color); color: #212529; padding: 6px 12px; }

/* Переключатель темы */
.theme-switch-wrapper { display: flex; align-items: center; margin: 6px 8px; }
.theme-switch { display: inline-block; height: 26px; position: relative; width: 50px; margin: 0; }
.theme-switch input { display: none; }
.slider { background-color: #ccc; inset: 0; cursor: pointer; position: absolute; transition: .4s; border-radius: 34px; }
.slider:before { background-color: #fff; bottom: 3px; content: ""; height: 20px; left: 3px; position: absolute; transition: .4s; width: 20px; border-radius: 50%; }
input:checked + .slider { background-color: #3b3b3b; }
input:checked + .slider:before { transform: translateX(24px); }
.slider .fa-sun { position: absolute; left: 7px; top: 6px; color: #f39c12; font-size: 13px; opacity: 0; transition: opacity .3s; }
.slider .fa-moon { position: absolute; right: 7px; top: 6px; color: #f1c40f; font-size: 13px; transition: opacity .3s; }
input:checked + .slider .fa-sun { opacity: 1; }
input:checked + .slider .fa-moon { opacity: 0; }

/* ---------- Карусель ---------- */
.carousel { margin-top: 0; }
.carousel-item { height: 80vh; min-height: 500px; }
.carousel-item img { object-fit: cover; height: 100%; width: 100%; }
.carousel-caption {
    background: rgba(0, 0, 0, .6);
    border-radius: 15px;
    padding: 30px;
    bottom: 18%;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    max-width: 700px;
    margin: 0 auto;
}
.carousel-caption h3 { font-size: 1.5rem; color: var(--warning-color); }
.carousel-caption h1 { font-size: 3.5rem; font-weight: 700; text-shadow: 2px 2px 5px rgba(0,0,0,.5); }
.carousel-caption p { font-size: 1.2rem; }

.hero-bg-section { min-height: 85vh; display: flex; align-items: center; padding: 120px 0 60px; }
.hero-brand { font-family: 'Montserrat', sans-serif; font-weight: 900; font-size: clamp(2.5rem, 8vw, 6rem); color: #111; text-shadow: 0 2px 20px rgba(255,255,255,.35); }
.hero-lead { font-size: 1.3rem; color: #111; font-weight: 600; max-width: 700px; margin: 0 auto 30px; }

/* ---------- Кнопки ---------- */
.btn-ribbon {
    background: var(--gradient-primary);
    border: none; border-radius: 50px; color: #fff; font-weight: 600;
    padding: 12px 30px; margin: 8px;
    box-shadow: 0 4px 15px rgba(13, 110, 253, .3);
    transition: all .3s ease; position: relative; overflow: hidden; z-index: 1;
}
.btn-ribbon:before { content: ''; position: absolute; inset: 0; width: 0; background: var(--gradient-warning); transition: width .3s ease; z-index: -1; }
.btn-ribbon:hover:before { width: 100%; }
.btn-ribbon:hover { transform: translateY(-4px); color: #212529; }
.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* ---------- Секции ---------- */
.category-section, .products-section, .content-section, .production-section, .contacts-section, .product-section { padding: 70px 0; }
.has-bg .category-section, .has-bg .products-section, .has-bg .content-section,
.has-bg .production-section, .has-bg .contacts-section { background: transparent; }
body:not(.has-bg) .production-section { background: var(--section-bg); }

.section-head {
    text-align: center;
    margin: 0 auto 40px;
    padding: 24px 30px 30px;
    max-width: 760px;
    border-radius: 20px;
    border: 1px solid transparent;
}
body:not(.has-bg) .section-head { padding: 0; }
.section-title {
    font-family: 'Playfair Display', serif; font-weight: 700; font-size: 2.4rem;
    position: relative; display: inline-block; margin-bottom: 22px;
}
.section-title:after {
    content: ''; position: absolute; width: 60%; height: 4px;
    background: var(--gradient-warning); bottom: -10px; left: 20%; border-radius: 2px;
}

/* Карточки категорий (миниатюры) */
.category-card {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    height: 100%; padding: 22px 16px 20px;
    background: var(--card-bg); color: var(--body-color);
    border-radius: 18px; border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px var(--shadow);
    text-decoration: none; position: relative; overflow: hidden;
    transition: transform .35s ease, box-shadow .35s ease;
}
.category-card:before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--gradient-warning); }
.category-card:hover { transform: translateY(-10px); box-shadow: 0 22px 45px var(--shadow); color: var(--body-color); }
.category-thumb {
    width: 130px; height: 130px; border-radius: 22px; overflow: hidden; margin-bottom: 14px;
    background: #fff; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 18px rgba(0,0,0,.12); position: relative;
}
.category-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.category-card:hover .category-thumb img { transform: scale(1.1); }
.thumb-fallback { display: none; font-size: 3rem; color: #e0a800; }
.noimg .thumb-fallback { display: block; }
.category-thumb.noimg { background: linear-gradient(135deg, #fff8dc, #ffe08a); }
.category-icon-badge {
    position: absolute; top: 18px; right: 18px; width: 34px; height: 34px; border-radius: 50%;
    background: var(--warning-color); color: #212529; display: flex; align-items: center; justify-content: center; font-size: .9rem;
}
.category-card h4 { font-size: 1.35rem; margin-bottom: 4px; }
.category-count { font-size: .85rem; color: var(--muted-color); }

/* Контент */
.content-section h1, .production-section h1 { font-size: 2.4rem; margin-bottom: 20px; }
.content-section p { line-height: 1.8; font-size: 1.08rem; }
.content-image { height: 420px; border-radius: 15px; overflow: hidden; box-shadow: 0 15px 30px var(--shadow); }
.content-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.content-image:hover img { transform: scale(1.05); }
.feature-list { list-style: none; padding-left: 0; }
.feature-list li { margin-bottom: 12px; padding-left: 30px; position: relative; font-size: 1.05rem; }
.feature-list li:before { content: '✓'; position: absolute; left: 0; color: var(--success-color); font-weight: bold; font-size: 1.2rem; }
.animated-number { font-size: 2.2rem; font-weight: 700; color: var(--primary-color); display: inline-block; line-height: 1; }
.animated-number-label { font-size: .82rem; text-transform: uppercase; letter-spacing: 1px; font-weight: 500; margin-top: 5px; display: block; }
.floating-element { animation: float 6s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

.company-section { padding: 100px 0; color: #fff; }
body:not(.has-bg) .company-section {
    background: linear-gradient(rgba(0,0,0,.7), rgba(0,0,0,.7)), url('/static/img/depositphotos_119310186-stock-photo-abstract-dark-blue-and-black.jpg') center / cover fixed;
}
.company-card {
    background: rgba(10, 10, 10, .72);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-radius: 20px; padding: 40px;
    box-shadow: 0 15px 35px rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.1);
}
.company-card h1 { font-size: 3.2rem; font-family: 'Playfair Display', serif; text-align: center; color: var(--warning-color); margin-bottom: 25px; }
.company-card p { font-size: 1.15rem; line-height: 1.8; text-align: justify; }

/* ---------- Шапка внутренних страниц ---------- */
.page-hero { padding: 130px 0 30px; }
.page-top { padding-top: 110px; }
.page-hero-inner { display: flex; align-items: center; gap: 24px; }
.page-title { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: clamp(2rem, 5vw, 3.4rem); margin: 0; color: var(--body-color); }
.has-bg .page-title { color: #111; text-shadow: 0 2px 14px rgba(255,255,255,.45); }
.page-subtitle { font-size: 1.15rem; margin: 6px 0 0; }
.has-bg .page-subtitle { color: #1b1b1b; font-weight: 600; }
.page-hero-thumb {
    width: 110px; height: 110px; flex: 0 0 110px; border-radius: 24px; overflow: hidden; background: #fff;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 25px rgba(0,0,0,.2);
}
.page-hero-thumb img { width: 100%; height: 100%; object-fit: cover; }


.sort-form { display: flex; align-items: center; }

/* ---------- Карточки товаров ---------- */
.product-card {
    background: var(--card-bg); border-radius: 18px; border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px var(--shadow); padding: 16px; height: 100%;
    display: flex; flex-direction: column; transition: transform .3s ease, box-shadow .3s ease;
}
.product-card:hover { transform: translateY(-8px); box-shadow: 0 20px 40px var(--shadow); }
.product-image { display: block; position: relative; height: 210px; border-radius: 12px; overflow: hidden; background: #fff; margin-bottom: 14px; }
.product-image img { width: 100%; height: 100%; object-fit: contain; transition: transform .4s ease; }
.product-card:hover .product-image img { transform: scale(1.06); }
.product-badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; }
.badge-hit, .badge-sale { font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.badge-hit { background: #ff6b00; color: #fff; }
.badge-sale { background: var(--danger-color); color: #fff; }
.badge-on-image { position: absolute; top: 12px; left: 12px; }
.product-name { font-family: 'Inter', sans-serif; font-size: 1rem; font-weight: 600; line-height: 1.35; flex: 1; margin-bottom: 8px; }
.product-name a { color: var(--body-color); text-decoration: none; }
.product-name a:hover { color: var(--primary-color); }
.product-price { font-size: 1.25rem; font-weight: 700; color: var(--primary-color); margin-bottom: 4px; }
.old-price { text-decoration: line-through; color: var(--muted-color); font-size: .8em; font-weight: 400; margin-right: 6px; }
.unit { font-size: .75em; font-weight: 500; color: var(--muted-color); }
.product-stock { font-size: .85rem; margin-bottom: 6px; }
.product-stock.in { color: var(--success-color); }
.product-stock.out { color: #e8590c; }
.product-rating { color: #ffc107; font-size: .85rem; margin-bottom: 10px; }
.btn-product { background: var(--gradient-primary); color: #fff; border: 0; border-radius: 30px; font-weight: 600; padding: 9px 16px; }
.btn-product:hover { background: var(--gradient-warning); color: #212529; }

/* Карточка товара */
.product-features { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 24px 0; }
.feature-item { display: flex; gap: 8px; align-items: center; font-size: .92rem; }
.feature-item i { color: var(--success-color); }
.contact-card-mini { border-radius: 16px; padding: 20px; background: linear-gradient(135deg, #1b1b1b, #2b2b2b); color: #fff; }
.contact-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.contact-icon { color: var(--warning-color); font-size: 1.4rem; }
.contact-numbers { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.contact-number { background: var(--warning-color); color: #212529; padding: 8px 16px; border-radius: 30px; font-weight: 700; text-decoration: none; }
.contact-number:hover { background: #fff; color: #212529; }

/* Контакты */
.contact-card, .form-card, .map-card { padding: 32px; height: 100%; }
.contact-icon-big { font-size: 2.6rem; color: var(--warning-color); margin-bottom: 12px; }
.contact-title { font-size: 1.7rem; }
.contact-info-list { list-style: none; padding: 0; margin: 20px 0 0; }
.contact-info-list li { display: flex; gap: 14px; margin-bottom: 16px; line-height: 1.5; }
.contact-info-list li i { color: var(--warning-color); font-size: 1.2rem; margin-top: 3px; min-width: 20px; }
.contact-link { text-decoration: none; }
.form-title { display: flex; align-items: center; gap: 12px; font-size: 1.7rem; margin-bottom: 22px; }
.form-title i { color: var(--warning-color); }
.btn-submit { background: var(--gradient-warning); color: #212529; font-weight: 700; border: 0; border-radius: 30px; padding: 12px; }
.btn-submit:hover { filter: brightness(1.05); transform: translateY(-2px); }

/* ---------- Футер ---------- */
.site-footer { background-color: var(--footer-bg); color: #fff; padding: 70px 0 20px; margin-top: 40px; }
.site-footer h4 { color: var(--warning-color); }
.social-icons a {
    color: #fff; font-size: 1.3rem; margin-right: 12px; display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.1); transition: all .3s;
}
.social-icons a:hover { color: var(--warning-color); transform: translateY(-4px); }
.footer-links a { color: #adb5bd; text-decoration: none; display: block; margin-bottom: 8px; transition: all .3s; }
.footer-links a:hover { color: #fff; padding-left: 5px; }
.footer-links-2col { columns: 2; column-gap: 20px; }
.footer-phone { color: #e9ecef; text-decoration: none; }
.footer-phone:hover { color: var(--warning-color); }
.copyright { border-top: 1px solid #333; padding-top: 20px; margin-top: 40px; color: #adb5bd; }

/* ---------- Прочее ---------- */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: none; }
.loading { position: fixed; inset: 0; background: var(--body-bg); display: flex; justify-content: center; align-items: center; z-index: 9999; transition: opacity .5s, visibility .5s; }
.loading.hidden { opacity: 0; visibility: hidden; }
.loader { width: 50px; height: 50px; border: 5px solid var(--border-color); border-top-color: var(--warning-color); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.to-top {
    position: fixed; right: 18px; bottom: 18px; width: 46px; height: 46px; border-radius: 50%; border: 0;
    background: var(--warning-color); color: #212529; box-shadow: 0 6px 18px rgba(0,0,0,.3);
    opacity: 0; visibility: hidden; transition: all .3s; z-index: 900;
}
.to-top.show { opacity: 1; visibility: visible; }

@media (prefers-reduced-motion: reduce) {
    .floating-element, .pulse, .letter { animation: none !important; }
    .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Адаптив ---------- */
@media (max-width: 991.98px) {
    .navbar-collapse { padding: 10px 0; max-height: 80vh; overflow-y: auto; }
    .nav-search input { width: 100%; }
    .nav-search { width: auto; }
}
@media (max-width: 768px) {
    .carousel-item { height: 62vh; min-height: 400px; }
    .carousel-caption { padding: 18px; bottom: 10%; left: 5%; right: 5%; }
    .carousel-caption h1 { font-size: 2rem; }
    .carousel-caption h3 { font-size: 1.1rem; }
    .btn-ribbon { display: block; width: 100%; margin: 10px 0; }
    .section-title { font-size: 1.9rem; }
    .content-image { height: 280px; }
    .letter { font-size: 1.35rem; }
    .letter:first-child { font-size: 1.75rem; }
    .company-card { padding: 24px; }
    .company-card h1 { font-size: 2.2rem; }
    .company-card p { text-align: left; font-size: 1.02rem; }
    .page-hero-inner { flex-direction: column; text-align: center; gap: 14px; }
    .product-features { grid-template-columns: 1fr; }
    .category-section, .products-section, .content-section, .production-section, .contacts-section, .product-section { padding: 40px 0; }
}
@media (max-width: 576px) {
    .container { padding-left: 16px; padding-right: 16px; }
    .category-thumb { width: 96px; height: 96px; border-radius: 18px; }
    .category-card { padding: 16px 10px; }
    .category-card h4 { font-size: 1.1rem; }
    .category-card .btn { display: none; }
    .product-image { height: 150px; }
    .product-card { padding: 10px; }
    .product-name { font-size: .9rem; }
    .product-price { font-size: 1.05rem; }
    .btn-product { padding: 7px 10px; font-size: .85rem; }
    .animated-number { font-size: 1.6rem; }
    .animated-number-label { font-size: .68rem; }
    .contact-card, .form-card, .map-card { padding: 20px; }
    .section-head { padding: 18px 16px 22px; }
    .footer-links-2col { columns: 1; }
}
