/* Mobile navigation styles */
@media (max-width: 991.98px) {
    .navbar-brand {
        font-size: 1rem !important;
        line-height: 1.3 !important;
    }

    .navbar-toggler {
        border-color: rgba(255, 255, 255, 0.3) !important;
    }

    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
    }

    .navbar-collapse {
        background: rgba(30, 58, 138, 0.95);
        margin-top: 0.5rem;
        padding: 1rem;
        border-radius: 0.375rem;
    }

    .navbar-nav {
        gap: 0.5rem !important;
    }

    .nav-link {
        padding: 0.75rem 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    /* Lavka nav-scroller: override global mobile .nav-link padding */
    .lavka-nav-scroller .nav-link {
        padding: 0.6rem 0.95rem !important;
        border-bottom: 0 !important;
    }

    /* Выравнивание выпадающего меню пользователя справа в мобильной версии */
    .navbar-collapse .d-flex {
        justify-content: flex-end !important;
    }

    .navbar-collapse .dropdown {
        position: relative;
    }

    .navbar-collapse .dropdown-menu {
        right: 0 !important;
        left: auto !important;
        transform: none !important;
        margin-top: 0.5rem;
    }
}

/* Extra small screens */
@media (max-width: 575.98px) {
    .navbar-brand {
        font-size: 0.9rem !important;
    }

    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Mobile optimizations for document pages */
@media (max-width: 768px) {
    .document-container {
        padding: 1.5rem 1rem !important;
        margin-bottom: 1rem !important;
    }

    .document-title {
        font-size: 1.8rem !important;
        margin-bottom: 0.75rem !important;
        line-height: 1.3 !important;
    }

    .document-meta {
        padding: 0.75rem !important;
        margin-bottom: 1.5rem !important;
    }

    .document-meta p {
        font-size: 0.9rem !important;
        margin: 0.25rem 0 !important;
    }

    .document-content {
        font-size: 1rem !important;
        line-height: 1.6 !important;
        max-width: 100% !important;
    }

    .document-content p {
        margin-bottom: 1rem !important;
        text-align: justify !important;
    }

    .document-content h2 {
        font-size: 1.3rem !important;
        margin: 1.5rem 0 0.75rem 0 !important;
    }

    .document-content h3 {
        font-size: 1.1rem !important;
        margin: 1.25rem 0 0.5rem 0 !important;
    }

    .document-content ul,
    .document-content ol {
        padding-left: 1.25rem !important;
        margin-bottom: 1rem !important;
    }

    .document-content li {
        margin-bottom: 0.25rem !important;
    }

    /* Таблицы вариант А: горизонтальный скролл + подсказка */
    .table-scroll-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    .table-scroll-wrapper table th:first-child,
    .table-scroll-wrapper table td:first-child {
        position: sticky;
        left: 0;
        background: #fff;
        z-index: 1;
        box-shadow: 2px 0 2px -1px rgba(0, 0, 0, 0.05);
    }

    .table-scroll-wrapper table thead th:first-child {
        z-index: 2;
        background: #f9fafb;
    }

    .table-scroll-hint {
        display: block;
        font-size: 0.8rem;
        color: #6b7280;
        margin-bottom: 0.5rem;
    }
}

/* Подсказка «Свайп влево» только на мобильных */
@media (min-width: 769px) {
    .table-scroll-hint {
        display: none !important;
    }
}

/* Lavka: ensure cart offcanvas scroll works in PWA/mobile */
#lavkaOffcanvasCart .offcanvas-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Avoid flex children preventing scroll inside offcanvas */
#lavkaOffcanvasCart .offcanvas-body > * {
    min-height: 0;
}

/* Lavka: nav-scroller (secondary menu like Bootstrap example) */
.lavka-nav-scroller {
    position: relative;
    z-index: 2;
    overflow-y: hidden;
}

.lavka-nav-scroller .nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    gap: 0.6rem;
}

.lavka-nav-scroller .nav-link {
    border: 0;
    background: transparent;
    padding: 0.75rem 1rem;
    color: #6b7280;
    font-weight: 500;
    cursor: pointer;
}

.lavka-nav-scroller .nav-link.active {
    color: #1f2937;
    box-shadow: inset 0 -2px 0 0 #1e3a8a;
}

/* Lavka: catalog cards (fixed size, square images, clean footer row) */
.lavka-catalog-card {
    min-height: 22rem;
}

.lavka-card-media img {
    object-fit: cover;
}

.lavka-card-title {
    line-height: 1.25;
    margin-bottom: 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lavka-card-desc {
    line-height: 1.35;
    margin-bottom: 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lavka-card-footerRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.lavka-card-price {
    font-weight: 700;
    white-space: nowrap;
}

.lavka-card-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 1 1 auto;
    min-width: 10rem;
    flex-wrap: wrap;
}

.lavka-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
    white-space: nowrap;
}

/* Lavka: carousels (40% click zones + arrows bottom corners + dots under photo) */
.lavka-carousel {
    width: 100%;
}

.lavka-carousel .carousel {
    position: relative;
}

.lavka-carousel-dots {
    margin-top: 0.45rem;
    display: flex;
    justify-content: center;
    gap: 0.45rem;
}

.lavka-carousel-dots .lavka-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    border: 0;
    background: rgba(17, 24, 39, 0.35);
    opacity: 1;
}

.lavka-carousel-dots .lavka-dot.active,
.lavka-carousel-dots button.active {
    background: rgba(30, 58, 138, 0.95);
}

.lavka-carousel-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    z-index: 3;
    cursor: pointer;
    display: flex;
    align-items: flex-end; /* arrows at bottom */
}

.lavka-carousel-zone-prev {
    left: 0;
    justify-content: flex-start;
    padding-left: 0.25rem;
    padding-bottom: 0.25rem;
}

.lavka-carousel-zone-next {
    left: auto;
    right: 0;
    justify-content: flex-end;
    padding-right: 0.25rem;
    padding-bottom: 0.25rem;
}

.lavka-carousel-arrow {
    margin: 0;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.55);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    line-height: 1;
    user-select: none;
}

/* Lavka nav-scroller: mobile polish (no white bg, hide scrollbar) */
@media (max-width: 991.98px) {
    .lavka-nav-scroller {
        background: transparent !important;
        box-shadow: none !important;
    }

    .lavka-nav-scroller .nav {
        scrollbar-width: none; /* Firefox */
    }

    .lavka-nav-scroller .nav::-webkit-scrollbar {
        display: none; /* WebKit */
    }
}

