/* Mobile & Tablet Responsive Improvements */

/* Desktop - Ensure carousel navigation is visible */
@media (min-width: 769px) {
    .carousel-nav {
        display: flex !important;
    }

    .carousel-wrapper {
        margin: 0 40px !important;
    }
}

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {

    /* Adjust grid for fewer columns */
    .lms-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 24px;
    }

    /* Adjust container padding */
    .lms-container {
        padding: 0 20px;
    }

    /* Hero section text size */
    .lms-hero-title {
        font-size: 40px;
    }

    /* Stats grid 2 columns on tablet */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }

    /* Book Details Page - Tablet */
    .book-hero-content {
        grid-template-columns: 250px 1fr !important;
        gap: 40px !important;
    }

    .book-title-large {
        font-size: 40px !important;
    }

    .book-author-large {
        font-size: 20px !important;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {

    /* Navigation - Stack vertically */
    .lms-navbar {
        padding: 12px 0;
    }

    .lms-nav-links {
        flex-wrap: wrap;
        gap: 12px;
        justify-content: center;
    }

    .lms-nav-item {
        font-size: 14px;
    }

    /* Brand logo smaller */
    .lms-brand h2 {
        font-size: 20px;
    }

    /* Search bar - Stack vertically on mobile */
    .lms-container form[action="index.php"]>div {
        flex-direction: column !important;
        gap: 12px !important;
    }

    .lms-container form[action="index.php"] input[type="text"],
    .lms-container form[action="index.php"] select {
        width: 100% !important;
    }

    /* Hero section adjustments */
    .lms-hero-slide {
        flex-direction: column;
        padding: 40px 24px;
        min-height: auto;
    }

    .lms-hero-title {
        font-size: 32px;
    }

    .lms-hero-content {
        max-width: 100%;
        text-align: center;
    }

    .lms-hero-image {
        flex: 0 0 200px;
        margin-top: 24px;
    }

    /* Grid - 2 columns on mobile */
    .lms-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    /* Stats banner - Single column */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    /* Section titles smaller */
    .lms-section-title {
        font-size: 24px;
    }

    /* Container padding smaller */
    .lms-container {
        padding: 0 16px;
    }

    /* User profile in nav - smaller */
    .lms-user-profile img {
        width: 32px;
        height: 32px;
    }

    .lms-user-profile>div {
        display: none;
    }

    /* Footer - stack columns */
    footer>div>div {
        grid-template-columns: 1fr !important;
        gap: 32px;
    }

    /* Book Details Page - Mobile */
    .book-hero-content {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }

    .book-hero {
        padding: 40px 0 !important;
        overflow-x: hidden;
    }

    /* Book cover full width on mobile */
    .book-hero-content>div:first-child {
        width: 100% !important;
        max-width: 100% !important;
    }

    .book-cover-large {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        display: block !important;
    }

    .thumbnail-grid {
        justify-content: center;
    }

    .book-title-large {
        font-size: 32px !important;
    }

    .book-author-large {
        font-size: 18px !important;
    }

    .book-actions {
        flex-direction: column;
        gap: 12px !important;
    }

    .book-actions .lms-btn,
    .book-actions a,
    .book-actions button {
        width: 100%;
        justify-content: center;
        padding: 12px 20px !important;
        font-size: 14px !important;
    }

    /* Book details - Single column layout */
    div[style*="grid-template-columns: 2fr 1fr"] {
        display: block !important;
        gap: 32px !important;
    }

    /* Quick facts on mobile */
    .quick-facts {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    /* Prevent horizontal overflow */
    body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    .lms-container {
        overflow-x: hidden;
        max-width: 100%;
    }

    /* Books carousel - visible scrolling on mobile */
    .books-carousel {
        gap: 16px !important;
        margin: 0 !important;
        padding: 10px 4px 20px 4px !important;
        -webkit-overflow-scrolling: touch;
        overflow-x: auto !important;
        overflow-y: hidden !important;
    }

    /* Show scrollbar on mobile for clarity */
    .books-carousel::-webkit-scrollbar {
        height: 4px;
    }

    .books-carousel::-webkit-scrollbar-track {
        background: #f1f5f9;
        border-radius: 10px;
    }

    .books-carousel::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 10px;
    }

    /* Hide carousel navigation on mobile - use touch scroll */
    .carousel-wrapper {
        margin: 0 !important;
        overflow: hidden;
        max-width: 100%;
    }

    .carousel-nav {
        display: none !important;
    }

}

/* Extra Small Mobile (max-width: 480px) */
@media (max-width: 480px) {

    /* Navigation */
    .lms-brand h2 {
        font-size: 18px;
    }

    .lms-nav-links {
        gap: 8px;
    }

    /* Hero even smaller */
    .lms-hero-title {
        font-size: 28px;
    }

    /* Book cards */
    .lms-book-title {
        font-size: 16px;
    }

    /* Buttons full width */
    .lms-btn {
        width: 100%;
        justify-content: center;
    }

    /* Modal full width */
    .lms-modal-content {
        width: 95%;
        margin: 0 auto;
    }

    /* Book Details Page - Extra Small */
    .book-cover-large {
        max-width: 200px;
    }

    .book-title-large {
        font-size: 24px !important;
    }

    .book-author-large {
        font-size: 16px !important;
    }

    .quick-facts {
        grid-template-columns: 1fr !important;
    }

    .book-hero {
        padding: 40px 0 !important;
    }
}

/* Print styles */
@media print {

    .lms-navbar,
    footer,
    .lms-btn,
    button {
        display: none !important;
    }
}