/*
Theme Name: Avewood Theme
Theme URI: https://avewood.com
Author: Avewood
Author URI: https://avewood.com
Description: A highly optimized, modern WordPress theme built with Tailwind CSS, featuring mobile-first design, minimal JS, strict security measures, built-in SEO optimizations, and full WooCommerce compatibility.
Version: 1.0.0
Requires at least: 5.8
Tested up to: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: avewood_theme
Tags: tailwind, woocommerce, seo, performance, mobile-first
*/

/* Base styles will be handled by Tailwind CSS */

/* Custom styling not covered by Tailwind */
#search-results-popup {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
}

/* Important to override any possible ring shadows from Tailwind */
#search-results-popup,
#search-results-popup:focus,
#search-results-popup:hover {
    --tw-ring-shadow: 0 0 #0000 !important;
    --tw-ring-offset-shadow: 0 0 #0000 !important;
    box-shadow: none !important;
}

/* Checkout: side by side phone and email fields on desktop */
@media (min-width: 768px) {
    form.checkout #billing_phone_field,
    form.checkout #billing_email_field {
        display: inline-block !important;
        vertical-align: top !important;
        width: calc(50% - 1rem) !important;
        margin-right: 1rem !important;
        clear: none !important;
    }
    form.checkout #billing_email_field {
        margin-right: 0 !important;
    }
}

/* Checkout: two-column layout for billing fields on desktop */
@media (min-width: 768px) {
    .woocommerce-checkout form.checkout .woocommerce-billing-fields__field-wrapper .form-row-first,
    .woocommerce-checkout form.checkout .woocommerce-billing-fields__field-wrapper .form-row-last {
        width: calc(50% - 1rem) !important;
        float: left !important;
        margin-right: 1rem !important;
    }
    .woocommerce-checkout form.checkout .woocommerce-billing-fields__field-wrapper .form-row-last {
        margin-right: 0 !important;
    }
}

/* Remove top margin from Billing details title in checkout */
.woocommerce form.checkout .woocommerce-billing-fields h3 {
    margin-top: 0 !important;
}

/* Hide top page title on Checkout page */
body.woocommerce-checkout h1.entry-title,
body.woocommerce-checkout .entry-header {
    display: none !important;
}

/* Checkout: hide all WooCommerce notices/messages/errors */
body.woocommerce-checkout .woocommerce-notices-wrapper .woocommerce-info,
body.woocommerce-checkout .woocommerce-notices-wrapper .woocommerce-message {
    display: none !important;
}

@media (max-width: 767px) {
    #cookiescript_badge {
        display: none !important;
    }
    #scroll-to-top {
        bottom: calc(4rem + 1.5rem) !important;
    }
    /* Hide mobile header burger icon */
    #mobile-menu-button {
        display: none !important;
    }
    /* Reduce header font size by 20% */
    header#masthead {
        font-size: 0.8rem !important;
    }
    /* Reset categories button margin in mobile */
    #drawer-categories-open {
        margin-left: 0 !important;
        margin-right: 5px !important;
    }
    #search-product-preview {
        display: none !important;
    }
    /* Make search popup full viewport width and fixed below header on mobile */
    #search-results-popup {
        position: fixed !important;
        top: calc(5rem + 0.5rem) !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: none !important;
        margin: 0 !important;
        /* restore rounded corners on mobile */
        border-radius: 0.5rem !important;
        z-index: 9999 !important;
    }
    /* Mobile: hide Brands & Price Range boxes (we show them in modal) */
    body.woocommerce-shop aside .sidebar-product-brands,
    body.woocommerce-shop aside .sidebar-product-price,
    body.tax-product_cat aside .sidebar-product-brands,
    body.tax-product_cat aside .sidebar-product-price {
        display: none !important;
    }
    #sort-icon-button {
        display: none !important;
    }
    /* Show first sidebar block (subcategories) on mobile again */
    body.woocommerce-shop aside > div:first-of-type {
        display: block !important;
    }
    /* Hide WooCommerce breadcrumbs on mobile – replaced by custom Back button */
    .woocommerce .woocommerce-breadcrumb {
        display: none !important;
    }
    /* Hide entire empty sidebar on shop page (mobile) */
    body.woocommerce-shop aside.block {
        display: none !important;
    }
    /* Hide empty sidebar wrapper produced on mobile (block with md:sticky) */
    aside.block.md\:sticky:not(:has(div:not([style*='display: none']))) {
        display: none !important;
    }
    /* Remove shadow from login/account block on mobile */
    body.woocommerce-checkout .bg-white.rounded-lg.p-6.shadow-sm.not-prose {
        box-shadow: none !important;
    }
    /* Align price+stock left, cart right */
    .woocommerce ul.products li.product .mb-1.flex.items-center,
    .woocommerce ul.products li.product .flex.items-center.gap-2{
        display:flex !important;
        justify-content:space-between !important;
        align-items:center !important;
    }
    .woocommerce ul.products li.product .absolute.bottom-4.right-4{
        position:relative !important;
        bottom:auto !important;
        right:auto !important;
        margin-left:auto !important;
        margin-top:0.25rem !important;
    }
}

/* Search input placeholder smaller to match button font size */
#ajax-search-input::placeholder {
    font-size: 0.875rem !important;
}

/* Prevent horizontal overflow (but not on single product pages for sticky to work) */
body:not(.single-product) {
    overflow-x: hidden;
}

/* Ensure single product pages have visible overflow */
body.single-product {
    overflow: visible !important;
}

/* Ensure search input font-size 16px on mobile to prevent auto-zoom */
@media (max-width: 767px) {
    #ajax-search-input {
        font-size: 1rem !important;
    }
}

/* Hide Product categories box on Shop page only on mobile */
@media (max-width: 767px) {
    body.woocommerce-shop aside > div:first-of-type {
        display: none !important;
    }
}
@media (min-width: 768px) {
    body.woocommerce-shop aside > div:first-of-type {
        display: block !important;
    }
}

/* Hide sort and filter toolbar on small/medium screens */
@media (max-width: 1180px){
  body.woocommerce-shop .desktop-sortbar{
      display:none !important;
  }
}

/* Header becomes fixed after scroll */
@media (min-width: 768px){
  .header-scrolled{
    position: fixed !important;
    top: 0 !important;
    left:0 !important;
    right:0 !important;
    z-index:40 !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08) !important;
    background:#ffffff !important;
  }
}

@media (max-width: 767px) {
  /* Checkout: force all billing fields to full width stacked on mobile */
  .woocommerce-checkout form.checkout .woocommerce-billing-fields__field-wrapper .form-row-first,
  .woocommerce-checkout form.checkout .woocommerce-billing-fields__field-wrapper .form-row-last,
  form.checkout #billing_phone_field,
  form.checkout #billing_email_field,
  .woocommerce-checkout form.checkout .woocommerce-billing-fields__field-wrapper .form-row,
  .woocommerce-checkout form.checkout .woocommerce-shipping-fields__field-wrapper .form-row {
      width: 100% !important;
      margin-right: 0 !important;
      float: none !important;
      display: block !important;
  }
}

/* Checkout: remove inner card padding */
body.woocommerce-checkout .bg-white.rounded-lg.p-6.shadow-sm {
    padding: 0 !important;
}

/* Shrink coupon input width so button fits on small screens */
.woocommerce form .coupon input#coupon_code {
    width: 6rem !important; /* 96px */
}

/* Ensure button and input sit side-by-side without overflow */
.woocommerce form .coupon {
    gap: 0.5rem;
}

/* Checkout: yellow order summary box padding */
body.woocommerce-checkout #order-summary-sticky {
    padding: 10px !important;
}

/* Checkout coupon form: make input fixed width (~8rem) and prevent flex growth */
@media (max-width: 767px) {
    body.woocommerce-checkout .checkout_coupon input[name="coupon_code"] {
        width: 8rem !important; /* 128px */
        flex: none !important;
    }

    /* keep small gap between input and button */
    body.woocommerce-checkout .checkout_coupon .flex.items-center {
        gap: 0.5rem;
    }
}

/* Remove shadow for login/account box on all viewports */
body.woocommerce-checkout .bg-white.rounded-lg.p-6.shadow-sm.not-prose {
    box-shadow: none !important;
}

@media (min-width: 1024px) {
   /* Center search popup under header search on desktop */
   #search-results-popup {
    left: -15% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    /* Tablet: hide Brands & Price Range boxes (use pop-ups instead) */
    body.woocommerce-shop aside .sidebar-product-brands,
    body.woocommerce-shop aside .sidebar-product-price,
    body.tax-product_cat aside .sidebar-product-brands,
    body.tax-product_cat aside .sidebar-product-price {
        display: none !important;
    }
    /* Hide entire sidebar container when empty */
    body.woocommerce-shop aside.block {
        display: none !important;
    }
    /* Prevent placeholder sticky wrapper */
    aside.block.md\:sticky:not(:has(div:not([style*='display: none']))) {
        display: none !important;
    }
    /* Hide Sort toolbar icon (replaced by pop-up) */
    #sort-icon-button {
        display: none !important;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    #search-results-popup {
        left: 0% !important;
        transform: translateX(-50%) !important;
        width: 90vw !important;
        max-width: 640px !important;
        right: auto !important;
    }
}

@media (min-width: 768px) and (max-width: 1366px){
    /* Front page hero: extend to full width on iPad sizes */
    body.home .site-main section.bg-white:first-of-type > .container{
        max-width:none !important;
        padding-left:0 !important;
        padding-right:0 !important;
    }
    #hero-left-col{
        width:calc(100% - 2rem) !important; /* full minus 1rem padding each side */
        margin:1rem 1rem !important;
    }
    #promo-banner,#promo-products,#homepage-right-slider{
        width:calc(100% - 2rem) !important;
        margin:0 1rem !important;
    }
    #promo-products{
        margin-top:1rem !important;
    }
    /* iPad: remove left margin on categories drawer button */
    #drawer-categories-open{margin-left:0 !important;}
    /* Show hero slider and stack below for iPad */
    #homepage-right-slider{display:block !important;}
}

@media (max-width: 1279px){
    #scroll-to-top{
        bottom:6.5rem !important;
    }
}

/* Increase product card font sizes */
.woocommerce ul.products li.product,
#products-grid-ajax > a{
    font-size:150% !important;
}

/* Force product title (was 0.625rem) to 1rem */
.woocommerce ul.products .text-\[0\.625rem\],
#products-grid-ajax .text-\[0\.625rem\]{
    font-size:1rem !important;
}

/* Up-size titles that used text-[0.7rem] */
.woocommerce ul.products .text-\[0\.7rem\],
#products-grid-ajax .text-\[0\.7rem\]{
    font-size:1rem !important;
}

/* Force Tailwind utility text-[0.625rem] globally to 1rem */
.text-\[0\.625rem\]{font-size:1rem !important;}

@media (max-width: 767px){
    .text-\[0\.625rem\],
    .text-\[0\.7rem\]{
        font-size:0.8rem !important;
    }
} 