/* ============================================
   KHAZEENA-E-KUTUB - COMPLETE RESPONSIVE SYSTEM
   Version: 3.5 - Full Responsive with Button Container
   ============================================ */

/* ===== GLOBAL RESPONSIVE FIXES ===== */
html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* ===== HERO SLIDER ===== */
@media (max-width: 768px) {
    .hero-slider,
    .hero-slides-container {
        min-height: 180px !important;
        height: 180px !important;
    }

    .hero-slide .urdu {
        font-size: 1rem !important;
        line-height: 1.3 !important;
    }

    .hero-slide .english {
        font-size: 0.7rem !important;
    }

    .slider-arrow {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.7rem !important;
    }

    .slider-dot {
        width: 6px !important;
        height: 6px !important;
    }
}

@media (max-width: 550px) {
    .hero-slider,
    .hero-slides-container {
        min-height: 150px !important;
        height: 150px !important;
    }

    .hero-slide .urdu {
        font-size: 0.85rem !important;
    }

    .hero-slide .english {
        font-size: 0.6rem !important;
    }
}

/* ===== HEADER ===== */
@media (max-width: 700px) {
    .header-with-logo {
        flex-wrap: wrap !important;
        gap: 0.8rem !important;
        justify-content: center !important;
    }

    .logo-container {
        order: 1 !important;
        justify-content: center !important;
        width: 100% !important;
    }

    .header-center {
        order: 2 !important;
        display: block !important;
        font-size: 0.7rem !important;
        white-space: normal !important;
        text-align: center !important;
        width: 100% !important;
    }

    .header-search {
        order: 3 !important;
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    .search-form {
        width: 100% !important;
    }

    .nav-icons {
        order: 4 !important;
        justify-content: center !important;
        width: 100% !important;
        gap: 1rem !important;
        flex-wrap: wrap !important;
    }

    .search-mobile {
        display: none !important;
    }
}

@media (max-width: 550px) {
    .language-switcher {
        display: flex !important;
        margin-left: 0;
        padding: 0.2rem 0.4rem;
        gap: 0.3rem;
    }

    .language-switcher a {
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
    }

    .language-switcher .lang-urdu {
        font-size: 0.8rem;
    }

    .language-switcher .lang-english {
        font-size: 0.7rem;
    }

    .language-switcher .separator {
        font-size: 0.7rem;
    }

    .user-name-badge {
        max-width: 55px !important;
        font-size: 0.55rem !important;
        padding: 0.15rem 0.3rem !important;
    }

    .logo-circle {
        width: 35px !important;
        height: 35px !important;
    }

    .urdu-sarem, .logo-text .urdu-sarem {
        font-size: 1.5rem !important;
    }
}

/* ===== BOOK CARDS ===== */
@media (max-width: 900px) {
    .book-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.8rem !important;
    }
}

@media (max-width: 650px) {
    .book-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.8rem !important;
    }

    .book-card {
        width: 100% !important;
        padding: 0.5rem !important;
        position: relative !important;
    }

    .book-cover {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 2/3 !important;
        margin-bottom: 0.5rem !important;
    }

    .book-cover img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    .book-title.urdu {
        font-size: 0.7rem !important;
    }

    .price-circle {
        width: 42px !important;
        height: 42px !important;
        top: 5px !important;
        right: 5px !important;
    }

    .price-circle .price-amount {
        font-size: 0.7rem !important;
    }

    .add-to-cart-btn {
        font-size: 0.55rem !important;
        padding: 0.3rem !important;
        margin-top: 0.3rem !important;
    }
}

@media (max-width: 480px) {
    .price-circle {
        width: 38px !important;
        height: 38px !important;
    }
}

/* ===== CAROUSEL ===== */
@media (max-width: 768px) {
    .carousel-nav-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.7rem !important;
    }

    .carousel-track {
        gap: 0.6rem !important;
    }

    .carousel-track .book-card {
        width: 140px !important;
        flex-shrink: 0 !important;
    }

    .carousel-track .book-cover {
        width: 130px !important;
        height: 195px !important;
    }

    .carousel-track .price-circle {
        width: 40px !important;
        height: 40px !important;
    }
}

@media (max-width: 550px) {
    .carousel-track .book-card {
        width: 120px !important;
    }

    .carousel-track .book-cover {
        width: 110px !important;
        height: 165px !important;
    }

    .carousel-track .price-circle {
        width: 35px !important;
        height: 35px !important;
    }
}

/* ===== CATEGORY TABS ===== */
@media (max-width: 768px) {
    .category-tabs {
        overflow-x: auto !important;
        justify-content: flex-start !important;
        gap: 0.8rem !important;
        padding: 0.5rem 0.5rem 0.8rem 0.5rem !important;
        flex-wrap: nowrap !important;
    }

    .category-tab {
        flex-shrink: 0 !important;
    }

    .category-tab .urdu {
        font-size: 0.8rem !important;
    }

    .category-tab .english-tab {
        font-size: 0.55rem !important;
    }
}

/* ===== SECTION HEADERS ===== */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 0.5rem !important;
    }

    .section-header-left {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.2rem !important;
        text-align: center !important;
    }

    .section-title-urdu {
        text-align: center !important;
        display: block !important;
        width: 100% !important;
    }

    .section-title-english {
        text-align: center !important;
        display: block !important;
        width: 100% !important;
    }

    .view-all-link {
        display: inline-block !important;
        margin-top: 0.2rem !important;
    }
}

/* ===== PACKAGE CARDS ===== */
@media (max-width: 900px) {
    .package-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.8rem !important;
    }
}

@media (max-width: 600px) {
    .package-grid {
        grid-template-columns: 1fr !important;
        gap: 0.8rem !important;
    }

    .package-card {
        padding: 0.8rem !important;
    }

    .package-title-urdu {
        font-size: 0.85rem !important;
    }

    .package-price {
        font-size: 1.1rem !important;
    }

    .package-footer {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .package-add-btn, .package-view-btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.4rem !important;
        font-size: 0.65rem !important;
    }
}

/* ===== RECENTLY ADDED ===== */
@media (max-width: 768px) {
    .recently-added-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)) !important;
        gap: 0.6rem !important;
    }

    .recently-added-card {
        padding: 0.5rem !important;
    }

    .recently-added-card .urdu {
        font-size: 0.65rem !important;
    }
}

/* ===== DYNAMIC LAYOUT ===== */
@media (max-width: 850px) {
    .dynamic-layout {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .layout-column {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ===== MAIN CONTAINER ===== */
@media (max-width: 768px) {
    .main-container {
        padding: 0.8rem !important;
    }

    .top-section-full-width,
    .bottom-section-full-width {
        padding: 0 0.8rem !important;
    }
}

/* ===== QUOTE BLOCK ===== */
@media (max-width: 768px) {
    .quote-block {
        padding: 0.8rem !important;
        margin: 1rem 0 !important;
    }

    .quote-block .urdu {
        font-size: 1rem !important;
    }

    .quote-block .english {
        font-size: 0.65rem !important;
    }
}

/* ===== WHATSAPP SECTION ===== */
@media (max-width: 550px) {
    .whatsapp-section .urdu {
        font-size: 1rem !important;
    }

    .whatsapp-form {
        flex-direction: column !important;
        border-radius: 20px !important;
        max-width: 100% !important;
    }

    .whatsapp-form input {
        border-radius: 20px 20px 0 0 !important;
        text-align: center !important;
        padding: 0.5rem !important;
    }

    .whatsapp-form button {
        border-radius: 0 0 20px 20px !important;
        padding: 0.5rem !important;
    }
}

/* ===== FOOTER ===== */
@media (max-width: 768px) {
    .footer {
        padding: 1.5rem 0.8rem 1rem !important;
        margin-top: 1.5rem !important;
    }

    .footer-content {
        flex-direction: column !important;
        text-align: center !important;
    }

    .footer-brand {
        justify-content: center !important;
    }

    .footer-tagline {
        border-left: none !important;
        border-top: 1px solid #D4AF37 !important;
        padding-left: 0 !important;
        padding-top: 0.5rem !important;
    }

    .social-links {
        justify-content: center !important;
    }

    .footer-links-container {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.8rem !important;
    }

    .footer-links-column {
        align-items: center !important;
        text-align: center !important;
    }

    .footer-bottom {
        flex-direction: column !important;
        text-align: center !important;
    }
}

/* ===== BOOK DETAIL PAGE ===== */
@media (max-width: 768px) {
    .book-detail-container {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        padding: 1rem !important;
    }

    .book-cover-wrapper {
        max-width: 220px !important;
        margin: 0 auto !important;
    }

    .book-title-urdu {
        font-size: 1.2rem !important;
    }

    .book-action-buttons {
        flex-direction: column !important;
    }

    .tabs-header {
        flex-direction: column !important;
        gap: 0.3rem !important;
    }

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

/* ===== CART PAGE ===== */
@media (max-width: 768px) {
    .cart-item {
        grid-template-columns: 1fr !important;
        text-align: center !important;
    }

    .cart-item-image {
        margin: 0 auto !important;
    }

    .cart-item-quantity {
        justify-content: center !important;
    }

    .cart-item-remove {
        margin: 0 auto !important;
    }

    .coupon-input-group {
        flex-direction: column !important;
    }

    .coupon-apply-btn {
        width: 100% !important;
    }
}

/* ===== CHECKOUT PAGE ===== */
@media (max-width: 1000px) {
    .checkout-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .checkout-form-card {
        padding: 1rem !important;
    }

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

    .payment-methods-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }
}

@media (max-width: 550px) {
    .payment-methods-grid {
        grid-template-columns: 1fr !important;
    }

    .order-items-header {
        display: none !important;
    }

    .order-item {
        grid-template-columns: 1fr !important;
        text-align: center !important;
    }

    .summary-row {
        flex-direction: column !important;
        text-align: center !important;
    }
}

/* ===== UTILITY CLASSES ===== */
.hide-on-mobile {
    display: block;
}

.show-on-mobile {
    display: none;
}

@media (max-width: 768px) {
    .hide-on-mobile {
        display: none !important;
    }

    .show-on-mobile {
        display: block !important;
    }
}

/* ===== PACKAGE HEADER ===== */
@media (max-width: 768px) {
    .package-header {
        text-align: center !important;
    }

    .package-title-urdu-header {
        text-align: center !important;
        width: 100% !important;
    }

    .package-title-english-header {
        text-align: center !important;
        width: 100% !important;
    }
}

/* ===== BOOK ACTION BUTTONS CONTAINER - RESPONSIVE ===== */
@media (max-width: 768px) {
    .book-action-buttons-container {
        gap: 0.4rem;
        margin-top: 0.4rem;
    }

    .add-to-cart-btn {
        height: 32px;
        font-size: 0.65rem;
        padding: 0.4rem 0;
    }

    .wishlist-btn {
        min-width: 32px;
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .book-action-buttons-container {
        gap: 0.3rem;
        margin-top: 0.3rem;
    }

    .add-to-cart-btn {
        height: 30px;
        font-size: 0.6rem;
    }

    .wishlist-btn {
        min-width: 30px;
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .book-action-buttons-container {
        margin-top: 0.2rem;
        gap: 0.3rem;
    }

    .add-to-cart-btn {
        height: 28px;
        font-size: 0.55rem;
        padding: 0.3rem 0;
    }

    .wishlist-btn {
        min-width: 28px;
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
}

/* ===== ENGLISH PAGE SPECIFIC LAYOUT ===== */
body.english-page .book-card {
    min-height: 280px !important;
    position: relative !important;
}

body.english-page .book-title.english-font {
    font-size: 0.7rem !important;
    line-height: 1.3 !important;
    white-space: normal !important;
    word-break: break-word !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    height: auto !important;
    min-height: 2.2rem !important;
}

body.english-page .book-author.english-font {
    font-size: 0.6rem !important;
    margin-bottom: 0.2rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* ===== ADDITIONAL MOBILE FIXES ===== */
@media (max-width: 650px) {
    .header-search {
        display: block !important;
    }

    .logo-container {
        justify-content: center !important;
        width: 100% !important;
    }

    .carousel-track .book-cover {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 2/3 !important;
    }

    .hero-slide .urdu {
        font-family: 'Payami Nastaleeq', 'Noto Nastaliq Urdu', serif !important;
        font-size: 0.9rem !important;
        line-height: 1.3 !important;
    }
}

@media (max-width: 480px) {
    .hero-slide .urdu {
        font-size: 0.75rem !important;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== BREADCRUMB CENTER ALIGN ON MOBILE ===== */
@media (max-width: 768px) {
    .breadcrumb-container {
        display: flex !important;
        justify-content: center !important;
        text-align: center !important;
    }

    .breadcrumb {
        display: inline-flex !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
    }
}

/* For extra small devices */
@media (max-width: 480px) {
    .breadcrumb-container {
        display: flex !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 0 0.5rem !important;
    }

    .breadcrumb {
        display: inline-flex !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
        font-size: 0.65rem !important;
        padding: 0.2rem 0.5rem !important;
    }

    .breadcrumb a i {
        font-size: 0.5rem !important;
    }

    .breadcrumb .current.urdu-text {
        font-size: 0.65rem !important;
    }
}
