.textbook-content .carousel-container .scroll-snap-container {
    display: flex;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
}

.textbook-content .carousel-container .scroll-snap-container::-webkit-scrollbar {
    display: none;
}

.textbook-content .carousel-container .scroll-snap-slide {
    flex: none;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    display: block;
}

.textbook-content .carousel-container .scroll-snap-slide > * {
    width: 100%;
    height: auto;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .textbook-content .carousel-container .scroll-snap-container {
        /* Enhanced touch scrolling for mobile */
        overscroll-behavior-x: contain;
        scroll-padding: 0;
    }

    .textbook-content .carousel-container .scroll-snap-slide {
        /* Prevent content overflow on small screens */
        min-width: 100%;
        max-width: 100%;
    }
}

/* Tablet optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .textbook-content .carousel-container .scroll-snap-container {
        /* Smoother scrolling on tablets */
        scroll-behavior: smooth;
    }
}

/* Desktop fallback - maintain existing behavior */
@media (min-width: 1025px) {
    .textbook-content .carousel-container .scroll-snap-container {
        /* Desktop can handle more complex animations */
        transition: scroll-left 0.3s ease-out;
    }
}

/* Drawing mode overrides - higher specificity needed here */
.textbook-content .carousel-container .scroll-snap-container.drawing-mode {
    overflow-x: hidden;
    scroll-snap-type: none;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .textbook-content .carousel-container .scroll-snap-container {
        scroll-behavior: auto;
    }
}

/* Loading state */
.textbook-content .carousel-container .scroll-snap-container.loading .scroll-snap-slide {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.textbook-content .carousel-container .scroll-snap-container.loaded .scroll-snap-slide {
    opacity: 1;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .textbook-content .carousel-container .scroll-snap-slide {
        border: 1px solid currentColor;
    }
}

/* Print styles - only use !important for print overrides as it's acceptable */
@media print {
    .scroll-snap-container {
        display: block !important;
        overflow: visible !important;
    }

    .scroll-snap-slide {
        display: block !important;
        width: auto !important;
        page-break-before: always;
    }

    .scroll-snap-slide:first-child {
        page-break-before: auto;
    }
}

/* Specific override for slick carousel remnants if they exist */
.textbook-content .carousel-container .scroll-snap-container.slick-slider {
    display: flex;
}

.textbook-content .carousel-container .scroll-snap-slide.slick-slide {
    float: none;
    display: block;
}
