/*
 * responsive-fixes.css
 * Extra responsive fixes — referenced in app.blade.php
 * Complements style.css and frontend-mobile.css
 */

/* =============================================
   GENERAL FIXES
   ============================================= */

/* Prevent horizontal scrollbar on all devices */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

/* Images never overflow */
img {
    max-width: 100%;
    height: auto;
}

/* Fix table overflow on small screens */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* =============================================
   NAVBAR FIXES
   ============================================= */

@media (max-width: 991px) {
    .navbar-nav .nav-link {
        padding: 0.6rem 0.75rem;
    }

    .navbar-collapse {
        border-top: 1px solid #f0f0f0;
        padding-top: 0.5rem;
    }

    /* Dropdown menus on mobile */
    .navbar-nav .dropdown-menu {
        box-shadow: none;
        border: 1px solid #e9ecef;
    }
}

/* =============================================
   PRODUCT CARD FIXES
   ============================================= */

/* Ensure inquiry button never overflows card on small screens */
@media (max-width: 480px) {
    .product-card .btn {
        font-size: 0.78rem !important;
        padding: 0.35rem 0.5rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .product-card {
        min-height: 250px !important;
    }

    .product-image img {
        height: 110px !important;
    }
}

/* =============================================
   HERO SLIDER FIXES
   ============================================= */

@media (max-width: 576px) {
    .carousel-item .row {
        flex-direction: column;
        text-align: center;
    }

    .carousel-item img {
        margin-top: 1rem;
        max-height: 200px;
        object-fit: contain;
    }

    .carousel-control-prev,
    .carousel-control-next {
        width: 10%;
    }

    .carousel-indicators {
        margin-bottom: 0.25rem;
    }
}

/* =============================================
   MODAL FIXES
   ============================================= */

@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* =============================================
   FORM FIXES
   ============================================= */

@media (max-width: 576px) {
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents iOS auto-zoom on focus */
    }

    /* Two column form to single column on mobile */
    .row .col-md-6 {
        margin-bottom: 0.75rem;
    }
}

/* =============================================
   SECTION PADDING FIXES
   ============================================= */

@media (max-width: 768px) {
    section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .mb-5 {
        margin-bottom: 2rem !important;
    }
}

/* =============================================
   TYPOGRAPHY FIXES
   ============================================= */

@media (max-width: 400px) {
    h1 { font-size: 1.5rem !important; }
    h2 { font-size: 1.3rem !important; }
    h3 { font-size: 1.15rem !important; }

    p {
        font-size: 0.9rem;
        line-height: 1.6;
    }
}

/* =============================================
   FOOTER FIXES
   ============================================= */

@media (max-width: 768px) {
    footer .col-md-3,
    footer .col-md-4,
    footer .col-md-6 {
        margin-bottom: 1.5rem;
        text-align: center;
    }

    footer .footer-links,
    footer .footer-contact {
        display: inline-block;
        text-align: left;
    }
}

/* =============================================
   BACK TO TOP BUTTON FIX
   ============================================= */

#backToTop {
    position: fixed;
    bottom: 80px; /* WhatsApp button ke upar */
    right: 20px;
    z-index: 999;
    display: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
}

@media (max-width: 576px) {
    #backToTop {
        bottom: 90px;
        right: 15px;
        width: 38px;
        height: 38px;
    }
}

/* =============================================
   WHATSAPP FLOAT BUTTON FIX
   ============================================= */

.whatsapp-float {
    position: fixed;
    bottom: 25px;
    right: 20px;
    z-index: 1000;
}

@media (max-width: 576px) {
    .whatsapp-float {
        bottom: 20px;
        right: 15px;
    }

    .whatsapp-float a {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}

/* =============================================
   PRODUCT DETAIL PAGE FIXES
   ============================================= */

@media (max-width: 768px) {
    /* Product show page - image upar, info neeche */
    .product-detail-image {
        margin-bottom: 1.5rem;
    }

    /* Related products - 2 per row on mobile */
    .related-products .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* =============================================
   BLOG PAGE FIXES
   ============================================= */

@media (max-width: 768px) {
    .blog-card img {
        height: 160px;
        object-fit: cover;
    }
}

/* =============================================
   INQUIRY MODAL FIX
   ============================================= */

@media (max-width: 576px) {
    #inquiryModal .modal-dialog {
        margin: 0;
        min-height: 100%;
    }

    #inquiryModal .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }
}

/* =============================================
   ADMIN PANEL RESPONSIVE FIXES
   ============================================= */

@media (max-width: 768px) {
    /* Admin sidebar collapse */
    .admin-sidebar {
        position: fixed;
        left: -100%;
        transition: left 0.3s ease;
        z-index: 1050;
    }

    .admin-sidebar.show {
        left: 0;
    }

    /* Admin table - horizontal scroll */
    .admin-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Admin stats cards - 2 per row */
    .admin-stat-card {
        margin-bottom: 1rem;
    }
}

/* =============================================
   PRINT FIXES
   ============================================= */

@media print {
    .navbar,
    footer,
    .whatsapp-float,
    #backToTop,
    .btn {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: #000;
    }
}
