/* ============================================
   KRDDO FASHION - GLOBAL RESPONSIVE STYLES
   Handles mobile, tablet, and desktop auto-customization
   Loaded on all pages via headerNav.php
   Version: 1.0
   ============================================ */

/* ============================================
   BASE / GLOBAL SAFEGUARDS
   ============================================ */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    width: 100%;
    -webkit-tap-highlight-color: transparent;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 100%;
}

/* Ensure flex/grid children never overflow */
* {
    min-width: 0;
}

/* ============================================
   MOBILE BOTTOM NAVIGATION SPACING
   Prevents content being hidden behind the fixed bottom nav
   ============================================ */
@media (max-width: 1024px) {
    body {
        padding-bottom: 70px;
    }
}

/* ============================================
   PRODUCT CARD ACTIONS - ALWAYS VISIBLE ON TOUCH
   On mobile there is no hover, so show action buttons
   ============================================ */
@media (max-width: 768px) {
    .product-card-actions {
        opacity: 1 !important;
        pointer-events: auto !important;
        top: auto;
        bottom: 12px;
        right: 8px;
        flex-direction: row;
        gap: 6px;
    }

    .product-card-actions button {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .product-card-img {
        aspect-ratio: 1 / 1;
    }

    .product-card-body {
        padding: 12px;
    }

    .product-card-title {
        font-size: 13px;
        min-height: 36px;
    }

    /* ===== VIEW DETAILS BUTTON - MOBILE OPTIMIZED =====
       Compact button size suitable for mobile screens */
    .view-details-btn {
        padding: 8px 10px !important;
        font-size: 11px !important;
        min-height: 32px !important;
        border-radius: 7px !important;
        gap: 4px !important;
        margin-top: 8px !important;
        letter-spacing: 0.2px !important;
    }

    .view-details-btn ion-icon {
        font-size: 13px !important;
    }

    .product-card-footer {
        padding-top: 8px !important;
    }
}

/* ============================================
   PRODUCT CARD IMAGES - KEEP COMPACT ON MOBILE
   Prevents very large/tall product images on small screens
   ============================================ */
@media (max-width: 768px) {
    .product-card-modern {
        max-width: 100%;
    }

    .product-card-img {
        aspect-ratio: 4 / 3 !important;
        max-height: 220px !important;
    }

    .product-card-img img {
        max-height: 100%;
        object-fit: cover;
    }
}

@media (max-width: 480px) {
    .product-card-img {
        aspect-ratio: 4 / 3 !important;
        max-height: 190px !important;
    }

    .product-card-body {
        padding: 10px !important;
    }

    .product-card-title {
        font-size: 12px !important;
        min-height: 32px !important;
        margin-bottom: 6px !important;
    }

    .product-card-cat {
        font-size: 9px !important;
    }

.product-card-rating {
        font-size: 11px !important;
        margin-bottom: 8px !important;
    }

    .rating-count {
        font-size: 10px !important;
    }

    .product-card-footer {
        padding-top: 8px !important;
    }

    .add-to-cart-btn {
        width: auto !important;
        max-width: 100% !important;
        padding: 7px 12px !important;
        font-size: 11px !important;
        gap: 5px !important;
        border-radius: 6px !important;
        min-height: 32px !important;
        white-space: nowrap !important;
    }

    .add-to-cart-btn i {
        font-size: 11px !important;
    }

    .card-badge {
        top: 8px;
        left: 8px;
        padding: 3px 10px;
        font-size: 9px;
    }

    .stock-status {
        bottom: 8px;
        padding: 3px 10px;
        font-size: 9px;
    }
}

/* ============================================
   PRODUCT GRID - AUTO RESPONSIVE
   ============================================ */
/* Modern grid (index.php) */
.product-grid-modern {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

@media (max-width: 1200px) {
    .product-grid-modern {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .product-grid-modern {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .product-grid-modern {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* Legacy product grid (search.php, category.php, product pages) */
.product-main .product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1100px) {
    .product-main .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .product-main .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .product-main .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* ============================================
   HORIZONTAL SCROLL COMPONENTS (.scroll-x, .cat-strip-track)
   Ensure smooth left/right swipe on mobile
   ============================================ */
@media (max-width: 768px) {
    .scroll-x-track,
    .cat-strip-track,
    .brands-track,
    .showcase-wrapper,
    .blog-container {
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        padding-bottom: 16px;
    }

    .scroll-card {
        flex: 0 0 150px;
    }

    /* Show scroll buttons on mobile (they were hidden on hover only) */
    .scroll-x .scroll-btn {
        opacity: 1;
        pointer-events: auto;
        width: 30px;
        height: 30px;
        font-size: 13px;
        top: 15px;
        transform: translateY(0);
    }

    .scroll-x .scroll-btn-left {
        left: 6px;
    }

    .scroll-x .scroll-btn-right {
        right: 6px;
    }

    /* Slight shadow behind scroll buttons for readability */
    .scroll-x .scroll-btn {
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }

    /* ===== ENSURE TOUCH SCROLLING WORKS =====
       Critical for horizontal swipe on mobile */
    .scroll-x-track {
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-x pan-y !important;
        scroll-snap-type: x proximity !important;
        scrollbar-width: thin;
        scrollbar-color: #CE5959 #f5f5f5;
    }

    /* ===== VISIBLE SCROLLBAR FOR PRODUCT CAROUSELS =====
       Makes the horizontal scrollbar clearly visible on mobile
       so users know there are more products to swipe */
    .scroll-x-track::-webkit-scrollbar {
        height: 6px;
    }

    .scroll-x-track::-webkit-scrollbar-thumb {
        background: linear-gradient(90deg, #CE5959, #E8A0A0);
        border-radius: 6px;
        -webkit-box-shadow: 0 0 4px rgba(206,89,89,0.3);
    }

    .scroll-x-track::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(90deg, #b04444, #CE5959);
    }

    .scroll-x-track::-webkit-scrollbar-track {
        background: #f5f5f5;
        border-radius: 6px;
        border: 1px solid #eee;
    }
}

/* ============================================
   HERO SECTION - MOBILE
   ============================================ */
@media (max-width: 768px) {
    .hero-section {
        height: 340px;
    }

    .hero-content {
        left: 6%;
        right: 6%;
        max-width: 100%;
        padding: 0;
    }

    .hero-title {
        font-size: 24px;
    }

    .hero-badge {
        font-size: 11px;
        padding: 4px 14px;
    }

    .hero-cta {
        padding: 10px 20px;
        font-size: 13px;
    }

    .hero-arrow {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .hero-section {
        height: 300px;
    }

    .hero-title {
        font-size: 20px;
    }

    .hero-desc {
        font-size: 14px;
    }

    .hero-buttons {
        gap: 8px;
    }

    .hero-cta {
        padding: 8px 16px;
        font-size: 12px;
    }
}

/* ============================================
   CATEGORY STRIP - MOBILE
   ============================================ */
@media (max-width: 480px) {
    .cat-strip-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .cat-strip-btn {
        padding: 10px 12px;
        min-width: 84px;
    }

    .cat-strip-icon {
        width: 40px;
        height: 40px;
    }

    .cat-strip-label {
        font-size: 11px;
    }

    .cat-strip-count {
        font-size: 10px;
    }
}

/* ============================================
   SECTION HEADERS - MOBILE
   ============================================ */
@media (max-width: 480px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .section-title {
        font-size: 18px;
    }

    .product-count {
        font-size: 12px;
    }
}

/* ============================================
   MAIN LAYOUT - SIDEBAR + CONTENT
   ============================================ */
@media (max-width: 1024px) {
    .krddo-layout {
        flex-direction: column;
    }

    .krddo-sidebar {
        flex: 0 0 auto;
        width: 100%;
        position: static;
    }
}

/* ============================================
   FEATURES STRIP - MOBILE
   ============================================ */
@media (max-width: 768px) {
    .features-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .feature-item {
        min-width: 0;
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .feature-icon {
        font-size: 26px;
    }
}

@media (max-width: 480px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   BRANDS STRIP - MOBILE
   ============================================ */
@media (max-width: 480px) {
    .brands-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .brand-item img {
        width: 56px;
        height: 56px;
        padding: 8px;
    }
}

/* ============================================
   FLOATING ACTIONS - MOBILE
   ============================================ */
@media (max-width: 768px) {
    .floating-actions {
        bottom: 80px;
        right: 14px;
    }

    .floating-btn {
        width: 40px;
        height: 40px;
        font-size: 17px;
    }
}

/* ============================================
   QUICK VIEW MODAL - MOBILE
   ============================================ */
@media (max-width: 768px) {
    .quick-view-modal .modal-content {
        width: 94%;
        max-height: 88vh;
        padding: 20px 15px;
        margin: 10px;
    }

    .modal-body {
        font-size: 14px;
    }
}

/* ============================================
   TOAST NOTIFICATION - MOBILE
   ============================================ */
@media (max-width: 768px) {
    .toast-notification {
        left: 15px;
        right: 15px;
        bottom: 85px;
        max-width: none;
        padding: 14px 18px;
    }
}

/* ============================================
   PAGINATION - MOBILE
   ============================================ */
@media (max-width: 480px) {
    .pagination-modern {
        flex-wrap: wrap;
        gap: 5px;
    }

    .page-link {
        height: 36px;
        padding: 0 12px;
        font-size: 13px;
    }
}

/* ============================================
   DEAL OF THE DAY - MOBILE
   ============================================ */
@media (max-width: 768px) {
    .product-featured .showcase {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .product-featured .showcase-banner {
        min-height: 180px;
    }

    .product-featured .price-box {
        font-size: 18px;
    }
}

/* ============================================
   DEAL OF THE DAY CARDS - MOBILE OVERRIDES
   (Wins over inline styles in dealoftheday.php)
   ============================================ */
@media (max-width: 768px) {
    .deal-card {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }

    .deal-image-wrapper {
        min-height: 0 !important;
        aspect-ratio: 16 / 9 !important;
        max-height: 220px !important;
    }

    .deal-image {
        max-height: none !important;
        height: 100% !important;
        padding: 10px !important;
    }

    .deal-content {
        padding: 14px 16px 16px !important;
        gap: 6px !important;
    }

    .deal-title {
        font-size: 15px !important;
    }

.deal-add-cart-btn {
        width: auto !important;
        min-width: 0 !important;
        padding: 9px 20px !important;
        font-size: 13px !important;
        border-radius: 8px !important;
        min-height: 36px !important;
        gap: 6px !important;
        align-self: flex-start !important;
    }
}



/* ============================================
   SEARCH / CATEGORY / PRODUCT PAGES - BANNER CONTENT
   ============================================ */
@media (max-width: 768px) {
    .banner-content {
        left: 15px;
        right: 15px;
        max-width: none;
        padding: 16px 18px;
    }

    .banner-title {
        font-size: 20px;
    }

    .slider-item {
        height: 280px;
    }
}

/* ============================================
   REGISTRATION / LOGIN - STANDALONE PAGES
   ============================================ */
@media (max-width: 600px) {
    .registeration-box {
        width: 90% !important;
        padding: 10px;
    }
}

/* ============================================
   CHECKOUT PAGE - MOBILE
   (inline styles use .appointments-section, .child-fields)
   ============================================ */
@media (max-width: 768px) {
    .appointments-section {
        width: 92% !important;
    }

    .child-detail-inner {
        flex-direction: column;
        gap: 0;
    }

    .child-fields1,
    .child-fields3,
    .child-fields4,
    .child-fields5,
    .child-fields6,
    .child-fields7,
    .child-fields8,
    .child-fields9,
    .Address-field,
    .dob-fields {
        width: 100% !important;
    }

    .appointment-head {
        font-size: 28px;
    }
}

/* ============================================
   CONTACT PAGE - MOBILE
   ============================================ */
@media (max-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .professional-card {
        padding: 18px 20px;
    }
}

/* ============================================
   ABOUT PAGE - MOBILE
   ============================================ */
@media (max-width: 1024px) {
    .why-grid { grid-template-columns: repeat(2, 1fr); }
    .mvv-grid { grid-template-columns: repeat(2, 1fr); }
    .mvv-card:last-child { grid-column: span 2; }
}

@media (max-width: 768px) {
    .about-hero { padding: 50px 24px; }
    .about-hero-title { font-size: 34px; }
    .about-story-grid { grid-template-columns: 1fr; gap: 44px; }
    .about-badge-box { left: 20px; }
    .mvv-grid { grid-template-columns: 1fr; }
    .mvv-card:last-child { grid-column: span 1; }
    .stats-grid, .why-grid { grid-template-columns: repeat(2, 1fr); }
    .section-heading { font-size: 28px; }
    .testimonial-card { padding: 32px 22px; }
    .cta-banner { padding: 44px 24px; }
    .cta-content h2 { font-size: 26px; }
    .about-stats { padding: 40px 24px; }
}

@media (max-width: 480px) {
    .stats-grid, .why-grid { grid-template-columns: 1fr; }
    .about-hero-title { font-size: 28px; }
    .about-badge-box { padding: 12px 18px; left: 16px; }
    .about-badge-box .badge-number { font-size: 26px; }
}

/* ============================================
   PROFILE PAGE - MOBILE
   ============================================ */
@media (max-width: 768px) {
    .card-container {
        padding: 20px !important;
    }

    .card-container .row {
        flex-direction: column;
        gap: 20px !important;
    }

    .card-container .col {
        width: 100% !important;
        max-width: 100% !important;
    }

    .card-container .card {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ============================================
   CART PAGE - MOBILE (supplement existing styles)
   ============================================ */
@media (max-width: 768px) {
    .cart-page {
        padding: 20px 0;
    }

    .cart-title {
        font-size: 20px;
    }

    .cart-summary {
        padding: 18px;
    }
}

/* ============================================
   VIEW DETAIL PAGE - MOBILE (supplement existing)
   ============================================ */
@media (max-width: 768px) {
    .breadcrumb {
        flex-wrap: wrap;
        line-height: 1.6;
        font-size: 12px;
    }

    .product-detail-wrapper {
        padding: 12px;
    }

    .product-description p {
        font-size: 13px;
    }

    .product-meta {
        gap: 8px;
    }
}

/* ============================================
   HEADER - MOBILE (supplement existing)
   ============================================ */
@media (max-width: 480px) {
    .header-logo img {
        max-height: 36px;
    }

    .header-user-actions {
        gap: 4px;
    }

    .header-user-actions .action-btn {
        font-size: 18px;
        padding: 4px;
    }
}

/* ============================================
   FOOTER SUPPORT - MOBILE
   ============================================ */
@media (max-width: 480px) {
    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-payment {
        width: 100%;
    }

    .payment-img {
        max-width: 220px;
        margin: 0 auto;
    }
}

/* ============================================
   TABLET - EXTRA SAFEGUARDS (768-1024px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    .product-grid-modern,
    .product-main .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .scroll-card {
        flex: 0 0 170px;
    }
}

/* ============================================
   DESKTOP - RESTORE LAYOUTS (helper)
   ============================================ */
@media (min-width: 1025px) {
    .product-card-actions {
        opacity: 0;
        pointer-events: none;
    }

    .product-card-modern:hover .product-card-actions {
        opacity: 1;
        pointer-events: auto;
    }
}
