/* ================================================
   KRISHANA THEME - Mobile Responsive CSS
   ================================================ */

/* ---- Tablet & Mobile (≤ 1024px) ---- */
@media (max-width: 1024px) {
    .kr-container {
        padding: 0 15px;
    }

    /* Header - Wrapped Layout */
    .kr-header-main {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
        padding: 8px 0;
        position: relative;
    }

    .kr-logo {
        flex: 0 0 auto;
        min-width: auto;
        max-width: 130px;
    }

    .kr-logo-text h1 {
        font-size: 1.1rem;
        margin: 0;
    }

    .kr-logo-text small {
        font-size: 0.6rem;
        display: block;
        margin-top: -2px;
    }

    /* Hide desktop nav */
    .kr-nav {
        display: none;
    }

    /* Actions Wrapper - Push directly next to hamburger */
    .kr-header-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-left: auto;
        /* Push to right */
    }

    /* Consolidate Search into Actions Strip if possible, 
       but since HTML structure puts .kr-search-box outside, 
       we'll display it as a full-width bar BELOW the header row for mobile.
       This satisfies "one line header" for the sticky/main part.
    */
    .kr-search-box {
        display: block;
        flex: 0 0 100%;
        order: 101;
        /* Force to new line below everything */
        margin-top: 8px;
        position: relative;
        z-index: 10;
        width: 100%;
    }

    .kr-search-box form {
        display: flex;
        width: 100%;
        align-items: stretch;
    }

    .kr-search-box input {
        height: 38px;
        font-size: 0.9rem;
        border-radius: 20px 0 0 20px;
        padding-left: 15px;
        flex: 1;
        width: auto;
        min-width: 0;
    }

    .kr-search-box button {
        height: 38px;
        padding: 0 16px;
        font-size: 0.8rem;
        border-radius: 0 20px 20px 0;
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* Hide text labels in actions to save space */
    .kr-header-actions .kr-btn-login {
        font-size: 0;
        /* Hide text */
        padding: 6px;
        width: 34px;
        height: 34px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: var(--kr-purple-light);
        color: var(--kr-purple);
    }

    .kr-header-actions .kr-btn-login i {
        font-size: 1rem;
        margin: 0;
    }

    .kr-header-actions .kr-gold-wallet {
        display: none;
        /* Hide wallet on mobile */
    }

    .kr-account-dropdown span {
        display: none;
        /* Hide username */
    }

    /* Optimize Icons */
    .kr-header-action {
        width: 34px;
        height: 34px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: #fdf6f0;
        /* var(--kr-cream) */
    }

    .kr-header-action i {
        font-size: 1rem;
        color: var(--kr-purple);
    }

    .kr-badge {
        top: -2px;
        right: -2px;
        width: 16px;
        height: 16px;
        font-size: 0.65rem;
    }

    /* Hamburger */
    .kr-mobile-menu-btn {
        display: flex;
        flex-direction: column;
        order: 100;
        margin-left: 5px;
        width: 34px;
        height: 34px;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        cursor: pointer;
        gap: 5px;
    }

    .kr-mobile-menu-btn span {
        display: block;
        width: 22px;
        height: 2px;
        background-color: var(--kr-purple);
        transition: all 0.3s ease;
    }

    /* Mobile Sidebar & Overlay */
    .kr-mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .kr-mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .kr-mobile-sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        /* Start off-screen */
        width: 280px;
        max-width: 80vw;
        height: 100vh;
        background: #fff;
        z-index: 9999;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        display: flex;
        flex-direction: column;
        transition: left 0.3s ease;
        overflow-y: auto;
    }

    .kr-mobile-sidebar.active {
        left: 0;
        /* Slide in */
    }

    .kr-mobile-sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20px 15px;
        background: var(--kr-pink-bg);
        border-bottom: 1px solid var(--kr-pink-border);
    }

    .kr-mobile-close {
        background: transparent;
        border: none;
        font-size: 1.2rem;
        color: var(--kr-purple);
        cursor: pointer;
        padding: 5px;
    }

    .kr-mobile-sidebar-content {
        padding: 15px 0;
    }

    .kr-mobile-nav-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .kr-mobile-nav-item a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 20px;
        color: #333;
        font-weight: 500;
        font-size: 0.95rem;
        text-decoration: none;
        border-bottom: 1px solid #f9f9f9;
    }

    .kr-mobile-nav-item a i.fa-chevron-right {
        font-size: 0.7rem;
        color: #ccc;
    }

    .kr-mobile-nav-item a i.fa-user,
    .kr-mobile-nav-item a i.fa-user-circle,
    .kr-mobile-nav-item a i.fa-shopping-bag,
    .kr-mobile-nav-item a i.fa-sign-out-alt {
        margin-right: 10px;
        color: var(--kr-gold);
        width: 16px;
        text-align: center;
        font-size: 1.1em;
    }

    /* Hero Slider - Better Layout */
    .kr-hero {
        min-height: auto;
    }

    .kr-hero-slide {
        min-height: auto;
        padding: 25px 0;
    }

    .kr-hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 15px;
        padding: 0;
    }

    .kr-hero-img-left,
    .kr-hero-img-right {
        display: none;
    }

    /* Reduce Fonts */
    .kr-hero-title {
        font-size: 1.8rem;
        line-height: 1.2;
    }

    .kr-hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 15px;
        padding: 0 20px;
    }

    /* Hero Buttons - Flexible */
    .kr-hero-cta {
        display: flex;
        justify-content: center;
        gap: 10px;
        flex-wrap: nowrap;
        padding: 0 10px;
    }

    .kr-hero-cta .kr-btn-gold,
    .kr-hero-cta .kr-btn-outline-purple {
        padding: 10px 12px;
        font-size: 0.85rem;
        flex: 1;
        /* Equal width */
        min-width: 0;
        white-space: nowrap;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Section Headers */
    .kr-section-title {
        font-size: 1.6rem;
    }

    .kr-section-subtitle {
        font-size: 0.9rem;
    }

    /* Grids - Product Grid Mobile */
    .kr-product-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding-bottom: 0;
        overflow-x: visible;
        scroll-snap-type: none;
    }

    .kr-product-card {
        margin-bottom: 0;
        flex: unset;
        scroll-snap-align: none;
        max-width: 100%;
    }

    .kr-product-image {
        height: 200px;
        /* Adjust height slightly larger for flex layout */
    }

    .kr-product-info {
        padding: 12px;
    }

    .kr-product-info h3 {
        font-size: 0.95rem;
        margin-bottom: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Product Card Footer Buttons */
    .kr-product-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .kr-product-footer>div {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
    }

    .kr-price {
        font-size: 1.15rem;
    }

    .kr-price-old {
        font-size: 0.8rem;
    }

    .kr-cart-btn {
        width: 100%;
        padding: 10px;
        justify-content: center;
        margin-top: 5px;
    }

    /* Category Grid */
    .kr-category-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    /* Gifting */
    .kr-gifting-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .kr-gift-card.main {
        grid-column: auto;
        height: 220px;
    }

    /* Footer */
    .kr-footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        text-align: left;
    }

    /* Jewellery Listing Page */
    .listing-main-layout {
        display: flex;
        flex-direction: column;
    }

    /* Mobile Filter Button */
    .kr-mobile-filter-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 12px;
        background: var(--kr-pink-light);
        border: 1px solid var(--kr-pink-border);
        color: var(--kr-purple);
        font-family: 'Playfair Display', serif;
        font-size: 1.1rem;
        margin-bottom: 20px;
        border-radius: 4px;
        cursor: pointer;
    }

    /* Off-canvas Sidebar */
    .premium-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -100% !important;
        /* Start entirely off screen */
        width: 300px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        background: #fff !important;
        z-index: 9999 !important;
        margin-bottom: 0;
        border-right: none;
        border-bottom: none;
        padding: 20px;
        padding-top: 60px;
        /* Space for close btn */
        transition: left 0.3s ease !important;
        overflow-y: auto;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    }

    .premium-sidebar.active {
        left: 0 !important;
    }

    .kr-sidebar-close {
        display: block !important;
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--kr-purple);
        cursor: pointer;
    }

    /* Force 2 products per row on mobile listing */
    .premium-product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }

    /* Listing Top Banner */
    .premium-top-banner-wide {
        height: 120px;
    }
}

/* ---- Mobile (≤ 768px) ---- */
@media (max-width: 768px) {

    /* Top Bar - Hide on small mobile to save vertical space? Or keep stacked thin */
    .kr-top-bar-inner {
        flex-direction: column;
        gap: 2px;
        text-align: center;
        font-size: 0.75rem;
    }

    .kr-ticker span {
        display: inline-block;
        margin: 0 5px;
    }

    .kr-top-links {
        display: none;
    }

    /* Grids */
    .kr-category-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .kr-wedding-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .kr-plan-wrapper {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .kr-plan-content .kr-btn-gold {
        width: 100%;
        justify-content: center;
        margin-bottom: 12px;
    }

    .kr-testimonial-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .kr-insta-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Gifting */
    .kr-gifting-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .kr-gift-card.main {
        grid-column: 1 / -1;
        height: 180px;
    }

    /* Footer */
    .kr-footer-grid {
        grid-template-columns: 1fr;
        gap: 25px;
        text-align: center;
    }

    .kr-assurance-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .kr-footer-assurance .kr-assurance-item div strong {
        color: var(--kr-pink-light);
    }

    .kr-footer-assurance .kr-assurance-item div span {
        color: rgba(255, 255, 255, 0.7);
    }

    .kr-footer-col {
        max-width: 100%;
        box-sizing: border-box;
    }

    .kr-newsletter-form {
        display: flex;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .kr-newsletter-form input {
        flex: 1 1 stretch;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .kr-newsletter-form button {
        flex: 0 0 auto;
    }

    .kr-footer-about {
        align-items: center;
    }

    .kr-social-icons {
        justify-content: center;
    }

    /* Product Details Page */
    .pd-container {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    .pd-gallery {
        flex-direction: column;
    }

    .pd-thumbnails {
        flex-direction: row;
        width: 100%;
        overflow-x: auto;
        gap: 10px;
        order: 2;
        margin-top: 10px;
    }

    .pd-main-image {
        height: 320px;
        width: 100%;
    }

    .pd-title {
        font-size: 1.4rem;
    }

    .product-price-block .current-price {
        font-size: 1.6rem;
    }

    /* Cart/Checkout Tables */
    .cart-table,
    .checkout-table {
        display: block;
        overflow-x: auto;
    }
}

/* ---- Small Mobile (≤ 480px) ---- */
@media (max-width: 480px) {
    .kr-category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .kr-insta-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Even thinner header padding */
    .kr-header-main {
        padding: 6px 0;
    }

    .kr-hero-title {
        font-size: 1.5rem;
    }

    .kr-product-image {
        height: 150px;
    }

    .kr-product-card h3 {
        font-size: 0.85rem;
    }

    .kr-footer-grid {
        grid-template-columns: 1fr;
    }
}