/*
 Theme Name:   Kiosko Child
 Theme URI:    https://smegma.cc
 Description:  Kiosko Child Theme for Smeg Ma Store
 Author:       Smeg Ma
 Template:     kiosko
 Version:      1.0.12
 Text Domain:  kiosko-child
*/

/* ========= GLOBAL FIXES ========= */

/* Prevent horizontal scrollbar from off-canvas elements like mini-cart */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* ========= MOBILE RESPONSIVE ========= */

/* Header mobile - hamburger menu */
@media (max-width: 768px) {
    /* Hide desktop nav on mobile */
    header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__container {
        display: none;
    }

    /* Show hamburger button */
    .wp-block-navigation__responsive-container-open {
        display: flex !important;
    }

    /* Mobile menu overlay */
    .wp-block-navigation__responsive-container.is-menu-open {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;
        z-index: 9999;
        padding: 2rem;
    }

    .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
}

/* Shop page mobile */
@media (max-width: 768px) {
    /* Stack columns vertically */
    .wp-block-columns.alignwide {
        flex-direction: column !important;
    }

    /* Sidebar full width on mobile - keep at top */
    .wp-block-columns.alignwide > .wp-block-column[style*="flex-basis:250px"] {
        flex-basis: 100% !important;
        width: 100% !important;
        order: 1;
        margin-bottom: 1.5rem;
    }

    /* Products column full width */
    .wp-block-columns.alignwide > .wp-block-column:not([style*="flex-basis"]) {
        flex-basis: 100% !important;
        width: 100% !important;
        order: 2;
    }

    /* Product grid 2 columns on mobile */
    .products-block-post-template {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    /* Category menu scrollable on mobile */
    .shop-category-menu {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem !important;
    }

    .shop-category-menu .wc-block-product-categories-list {
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        padding: 0 1rem !important;
    }

    .shop-category-menu .wc-block-product-categories-list-item > a {
        white-space: nowrap !important;
        font-size: 0.9rem !important;
    }

    /* Tag cloud smaller on mobile */
    .wp-block-tag-cloud {
        font-size: 0.8rem !important;
    }
}

/* Small phones */
@media (max-width: 480px) {
    /* Single column products on very small screens */
    .products-block-post-template {
        grid-template-columns: 1fr !important;
    }

    /* Smaller headings */
    h1, .wp-block-query-title {
        font-size: 1.5rem !important;
    }
}

/* Logo styling */
.wp-block-site-title {
    white-space: nowrap !important;
}
.wp-block-site-title a {
    font-weight: bold !important;
}
.wp-block-site-title a:hover {
    text-decoration: none !important;
    border-bottom: none !important;
}

/* Hide messy short description - full formatted description is in Description tab */
.woocommerce-product-details__short-description {
    display: none;
}

/* Footer columns - consistent spacing after headings */
#menu-footer-shop,
#menu-footer-info {
    list-style: none !important;
    margin: 28px 0 0 0 !important;
    padding: 0 !important;
}
#menu-footer-shop li,
#menu-footer-info li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Category heading links - NO underline, color change on hover */
body.home h3.wp-block-heading a {
    text-decoration: none !important;
    border-bottom: none !important;
    color: #000 !important;
    transition: color 0.2s ease;
}

body.home h3.wp-block-heading a:hover {
    color: #666 !important;
}

/* ========= FOOTER LAYOUT ========= */
/* Override carousel.css rules that break footer */
body.home footer .wp-block-columns > .wp-block-column:first-child {
    flex: 0 0 40% !important;
    max-width: 40% !important;
}
body.home footer .wp-block-columns > .wp-block-column:nth-child(2),
body.home footer .wp-block-columns > .wp-block-column:last-child {
    flex: 0 0 25% !important;
    max-width: 25% !important;
}
/* Mobile: stack columns */
@media (max-width: 781px) {
    footer .wp-block-columns {
        flex-direction: column !important;
    }
    footer .wp-block-column {
        flex-basis: 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}
/* Desktop: 3 columns */
@media (min-width: 782px) {
    footer .wp-block-columns {
        flex-wrap: nowrap !important;
    }
}

/* ========= SHOP PAGE PADDING ========= */
.woocommerce-page .wp-block-group > .wp-block-group,
.post-type-archive-product .wp-block-group > .wp-block-group,
.tax-product_cat .wp-block-group > .wp-block-group,
.tax-product_tag .wp-block-group > .wp-block-group {
    padding-left: 2rem;
    padding-right: 2rem;
}

/* Breadcrumbs, title, and columns padding */
.wc-block-breadcrumbs,
.wp-block-query-title.alignwide,
.wp-block-columns.alignwide {
    padding-left: 2rem !important;
    padding-right: 2rem !important;
}

/* Shop category menu padding */
.shop-category-menu.alignwide {
    padding-left: 2rem !important;
    padding-right: 2rem !important;
}

/* Remove extra padding from sidebar to align with title */
.wp-block-columns.alignwide .wp-block-column .wp-block-group.has-global-padding {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Reduce gap between sidebar elements */
.wp-block-columns.alignwide .wp-block-column:first-child .wp-block-group {
    gap: 0.5rem !important;
    --wp--style--block-gap: 0.5rem !important;
}

/* Remove extra margin on sidebar elements for consistent spacing */
.wp-block-columns.alignwide .wp-block-column:first-child h3.wp-block-heading,
.wp-block-columns.alignwide .wp-block-column:first-child .wp-block-woocommerce-filter-wrapper,
.wp-block-columns.alignwide .wp-block-column:first-child .wc-block-catalog-sorting {
    margin-top: 0.5rem !important;
}

/* Fix price filter bottom margin */
.wp-block-columns.alignwide .wp-block-column:first-child .wc-block-price-filter {
    margin-bottom: 0 !important;
}

/* Style the sort dropdown */
.wc-block-catalog-sorting select.orderby,
select.orderby {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 0.9rem;
    border: 1px solid #000;
    border-radius: 0;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23000' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color 0.2s ease;
}

.wc-block-catalog-sorting select.orderby:hover,
select.orderby:hover {
    border-color: #666;
}

.wc-block-catalog-sorting select.orderby:focus,
select.orderby:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 1px #000;
}

@media (max-width: 768px) {
    .woocommerce-page .wp-block-group > .wp-block-group,
    .post-type-archive-product .wp-block-group > .wp-block-group,
    .tax-product_cat .wp-block-group > .wp-block-group,
    .tax-product_tag .wp-block-group > .wp-block-group {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .wc-block-breadcrumbs,
    .wp-block-query-title.alignwide,
    .wp-block-columns.alignwide,
    .shop-category-menu.alignwide {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

/* ========= SHOP CATEGORY MENU (above breadcrumbs) ========= */
.shop-category-menu .wc-block-product-categories-list--has-images,
.shop-category-menu .wc-block-product-categories-list {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 0.5rem 1.5rem !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.shop-category-menu .wc-block-product-categories-list-item {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
}

.shop-category-menu .wc-block-product-categories-list-item > a {
    text-decoration: none !important;
    font-weight: 500 !important;
    color: #333 !important;
    padding: 0.5rem 0 !important;
    border-bottom: 2px solid transparent !important;
    transition: all 0.2s ease !important;
    display: inline-block !important;
}

.shop-category-menu .wc-block-product-categories-list-item > a:hover {
    color: #000 !important;
    border-bottom-color: #000 !important;
}

/* Dropdown submenu - hidden by default */
.shop-category-menu .wc-block-product-categories-list .wc-block-product-categories-list {
    display: none !important;
    position: absolute !important;
    top: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    padding: 0.75rem 0 !important;
    min-width: 200px !important;
    flex-direction: column !important;
    gap: 0 !important;
    z-index: 1000 !important;
    margin-top: 0 !important;
}

/* Bridge the gap between menu item and dropdown */
.shop-category-menu .wc-block-product-categories-list .wc-block-product-categories-list::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

/* Show dropdown on hover */
.shop-category-menu .wc-block-product-categories-list-item:hover > .wc-block-product-categories-list {
    display: flex !important;
}

/* Dropdown items */
.shop-category-menu .wc-block-product-categories-list .wc-block-product-categories-list .wc-block-product-categories-list-item {
    width: 100% !important;
}

.shop-category-menu .wc-block-product-categories-list .wc-block-product-categories-list .wc-block-product-categories-list-item > a {
    display: block !important;
    padding: 0.5rem 1rem !important;
    border-bottom: none !important;
    font-weight: 400 !important;
    white-space: nowrap !important;
}

.shop-category-menu .wc-block-product-categories-list .wc-block-product-categories-list .wc-block-product-categories-list-item > a:hover {
    background: #f5f5f5 !important;
    border-bottom: none !important;
}

/* Keep submenu visible when touch-activated (for touch devices) */
.shop-category-menu .wc-block-product-categories-list-item.touch-activated > .wc-block-product-categories-list {
    display: flex !important;
}

/* Visual indicator that parent is clickable to navigate */
.shop-category-menu .wc-block-product-categories-list-item.touch-activated > a {
    border-bottom-color: #000 !important;
}

/* ========= MOBILE DROPDOWN - BOTTOM SHEET ========= */
@media (max-width: 768px) {
    /* Bottom sheet style for dropdown on mobile */
    .shop-category-menu .wc-block-product-categories-list .wc-block-product-categories-list {
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        border-radius: 16px 16px 0 0 !important;
        box-shadow: 0 -4px 30px rgba(0,0,0,0.2) !important;
        padding: 1.5rem 1rem 2rem !important;
        background: #fff !important;
        z-index: 9999 !important;
        margin: 0 !important;
        border: none !important;
    }

    /* Bottom sheet items - larger touch targets */
    .shop-category-menu .wc-block-product-categories-list .wc-block-product-categories-list .wc-block-product-categories-list-item > a {
        padding: 1rem 1.25rem !important;
        font-size: 1.1rem !important;
        display: block !important;
        border-bottom: 1px solid #f0f0f0 !important;
        background: none !important;
        white-space: normal !important;
    }

    .shop-category-menu .wc-block-product-categories-list .wc-block-product-categories-list .wc-block-product-categories-list-item:last-child > a {
        border-bottom: none !important;
    }
}

/* ========= PRODUCT GALLERY - HIDE ORIGINAL WHEN SWIPER ACTIVE ========= */

/* Hide the original WooCommerce gallery completely when transformed */
.woocommerce-product-gallery.gallery-transformed .woocommerce-product-gallery__wrapper {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* ========= PRODUCT PAGE MOBILE FIXES ========= */
@media (max-width: 768px) {
    /* Override fixed flex-basis on product columns */
    .single-product .wp-block-column[style*="flex-basis"] {
        flex-basis: 100% !important;
        max-width: 100% !important;
    }

    /* Product gallery container - constrain width */
    .woocommerce-product-gallery {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    /* Main product image - fit container */
    .woocommerce-product-gallery__image img,
    .woocommerce-product-gallery .wp-post-image,
    .product-gallery-main img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
    }

    /* Thumbnail container - constrain and allow scroll */
    .flex-control-thumbs,
    .woocommerce-product-gallery__thumbnails,
    .product-gallery-thumbs-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 0 !important;
    }

    /* Product summary section */
    .summary.entry-summary {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 1rem !important;
    }

    /* Single product container */
    .single-product div.product {
        padding: 0 !important;
    }

    .single-product div.product > * {
        max-width: 100% !important;
    }
}
