/*
 Theme Name:  Taimelamp Astra Child
 Theme URI:   https://taimelamp.ee/
 Description: Astra child theme with a custom high-converting homepage for Taimelamp.ee
 Author:      Aivoma Innovations
 Author URI:  https://aivoma.com/
 Template:    astra
 Version:     1.0.2
 License:     GNU General Public License v2 or later
 License URI: https://www.gnu.org/licenses/gpl-2.0.html
 Text Domain: taimelamp-astra-child
*/


/* === Aivoma fix: remove excessive top space on WooCommerce shop/archive grid === */
/* === Global layout tidy-up === */
:root {
    --tl-container-max-width: 1240px;
    --tl-container-padding: clamp(1rem, 4vw, 2rem);
}

body,
.site,
#page {
    background: #040f13;
    margin: 0;
}

.ast-container,
.container,
.woocommerce .ast-container,
.woocommerce-page .ast-container {
    max-width: var(--tl-container-max-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--tl-container-padding);
    padding-right: var(--tl-container-padding);
}

@media (min-width: 1480px) {
    .ast-container,
    .container,
    .woocommerce .ast-container,
    .woocommerce-page .ast-container {
        max-width: 1320px;
    }
}

body,
html {
    overflow-x: hidden;
}

body.home #content,
body.home #primary,
body.home .site-main,
body.home .entry-content {
    margin-top: 0;
    padding-top: 0;
}

/* Ensure no accidental gap under custom header on home */
body.home .site-content,
body.home #content .ast-container { padding-top: 0 !important; margin-top: 0 !important; }


body.home #content > .ast-container {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

body.home,
body.home #page {
    overflow-x: hidden;
}

body.home .taimelamp-home,
body.home .tl-hero-ultra {
    padding-top: 0;
    margin-top: 0;
}

/* Align product grid with sidebar filters and headings */
body.archive.post-type-archive.product .site-content,
body.tax-product_cat .site-content,
.ast-woocommerce-container .ast-shop-content-area {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Remove extra spacing above the products list on shop/category pages */
.woocommerce ul.products,
.woocommerce ul.products.columns-3,
.woocommerce ul.products.columns-4 {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Some themes add spacing via first product item; normalize it */
.woocommerce ul.products li.product:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Result count / ordering row margins tightened so grid sits closer */
.woocommerce .woocommerce-result-count,
.woocommerce .woocommerce-ordering {
    margin-top: 0 !important;
    margin-bottom: 1rem !important;
}

/* Safety: remove any top margin from the primary content area on shop pages */
.ast-woocommerce-container #primary,
.ast-shop-content-area {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* === Package Contents Styling === */

/* Accessibility: improve contrast for links on dark surfaces */
/* Cookie banner link and any anchors inside the banner */
.cookie-banner a,
.cookie-banner .cookie-link {
    color: #e5e7eb !important; /* light gray for dark background */
    text-decoration: underline;
}
.cookie-banner a:hover,
.cookie-banner .cookie-link:hover,
.cookie-banner a:focus {
    color: #ffffff !important;
}

/* Admin bar links on front-end: ensure readable contrast on dark */
body:not(.wp-admin) #wpadminbar .ab-item,
body:not(.wp-admin) #wpadminbar a.ab-item,
body:not(.wp-admin) #wpadminbar > #wp-toolbar span.ab-label {
    color: #f3f4f6 !important; /* near-white */
    text-shadow: none !important;
}
body:not(.wp-admin) #wpadminbar .ab-top-menu > li:hover > .ab-item,
body:not(.wp-admin) #wpadminbar .ab-top-menu > li > .ab-item:focus {
    color: #ffffff !important;
}

/* Footer links on dark background: keep high contrast */
.taimelamp-footer a { color: #dbeafe; }
.taimelamp-footer a:hover { color: #ffffff; }

/* WooCommerce: Fix show password toggle visibility/position */
.woocommerce form .password-input { position: relative; display: block; }
.woocommerce form .password-input input[type="password"],
.woocommerce form .password-input input[type="text"] {
  padding-right: 2.5rem; /* leave room for toggle */
}
.woocommerce form .password-input .show-password-input,
.woocommerce form .password-input .hide-password-input {
  position: absolute;
  right: .6rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #065f46 !important;
  padding: .25rem !important;
  line-height: 1 !important;
  min-width: auto !important;
}
.woocommerce form .password-input .show-password-input:hover,
.woocommerce form .password-input .hide-password-input:hover { color: #0b3b2e !important; }
.package-contents {
    background: linear-gradient(135deg, #f8fffe 0%, #f0f9ff 100%);
    border: 2px solid #54B435;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    list-style: none;
    box-shadow: 0 4px 12px rgba(84, 180, 53, 0.1);
}

.package-contents li {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(84, 180, 53, 0.2);
    font-size: 1rem;
    line-height: 1.4;
}

.package-contents li:last-child {
    border-bottom: none;
}

.package-contents li:before {
    content: "✓";
    background: #54B435;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    margin-right: 12px;
    flex-shrink: 0;
}

.package-contents li strong {
    color: #2d4a2d;
}

/* Package contents header styling */
h3:has(+ .package-contents),
h3:has(+ ul.package-contents) {
    color: #54B435;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* Additional mobile touch and scroll optimizations */
@media (max-width: 480px) {
  /* Extra small mobile devices */
  .container, .ast-container {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  /* Prevent any potential overflow on very small screens */
  body, html {
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Optimize touch targets */
  a, button, .btn, input, select, textarea {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .package-contents {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .package-contents li {
        font-size: 0.9rem;
        padding: 0.5rem 0;
    }
    
    .package-contents li:before {
        width: 20px;
        height: 20px;
        font-size: 12px;
        margin-right: 10px;
    }
}

/* Optional: ensure product cards align neatly */
.woocommerce ul.products li.product {
    vertical-align: top;
}

/* ===== Readability on dark background (Shop, Category, Search) ===== */
.woocommerce,
.woocommerce-page {
  color: #e5e7eb;
}

/* Improve readability on dark backgrounds (Cart, Checkout, Account) */
.woocommerce-cart, .woocommerce-checkout, .woocommerce-account {
  color: #e6f4ef;
}
.woocommerce-cart a, .woocommerce-checkout a, .woocommerce-account a {
  color: #c7f9dd;
}
.woocommerce-cart a:hover, .woocommerce-checkout a:hover, .woocommerce-account a:hover {
  color: #a7f3d0;
}
.woocommerce table.shop_table,
.woocommerce table.shop_table th,
.woocommerce table.shop_table td,
.woocommerce .woocommerce-cart-form,
.woocommerce .cart_totals,
.woocommerce-account .woocommerce-MyAccount-content,
.woocommerce-account .woocommerce-MyAccount-navigation {
  color: inherit;
  border-color: rgba(255,255,255,0.12);
}
.woocommerce .woocommerce-message,
.woocommerce .woocommerce-info,
.woocommerce .woocommerce-error {
  color: #052e12;
  background: #d9f99d;
  border-color: #86efac;
}

/* Product card title and links */
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product a {
  color: #e6f7ee;
}
.woocommerce ul.products li.product a:hover,
.woocommerce ul.products li.product a:focus {
  color: #b7f3cf;
}

/* Prices */
.woocommerce ul.products li.product .price,
.woocommerce div.product p.price,
.woocommerce div.product span.price {
  color: #d1fae5;
}
.woocommerce ul.products li.product .price ins,
.woocommerce div.product p.price ins,
.woocommerce div.product span.price ins {
  color: #a7f3d0;
  text-decoration: none;
}
.woocommerce ul.products li.product .price del,
.woocommerce div.product p.price del,
.woocommerce div.product span.price del {
  color: #9ca3af;
  opacity: 0.85;
}

/* Loop buttons */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce .added_to_cart,
.woocommerce .button.add_to_cart_button {
  background: linear-gradient(135deg, #54B435, #22c55e);
  color: #051a0c;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 24px rgba(84,180,53,.25);
}
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce .button.add_to_cart_button:hover,
.woocommerce .added_to_cart:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

/* Quantity controls */
.woocommerce .quantity .qty,
.woocommerce .quantity input[type="number"] {
  background: #0a1712;
  color: #e5e7eb;
  border: 1px solid rgba(255,255,255,0.15);
}

/* Result/order row */
.woocommerce .woocommerce-result-count,
.woocommerce .woocommerce-ordering,
.woocommerce .woocommerce-ordering select {
  color: #cbd5e1;
}
.woocommerce .woocommerce-ordering select,
.woocommerce .woocommerce-ordering .orderby {
  background: #07140e;
  border: 1px solid rgba(255,255,255,.12);
  color: #e5e7eb;
}

/* Sale badge */
.woocommerce span.onsale {
  background: linear-gradient(135deg, #54B435, #10b981);
  color: #04120c;
  box-shadow: 0 10px 26px rgba(84,180,53,.32);
}

/* Subtle borders for product cards on dark BG */
.woocommerce ul.products li.product,
.woocommerce div.product {
  border-color: rgba(255,255,255,0.06);
}

/* Hide PayPal express buttons on single product pages */
body.single-product .woocommerce-paypal-payments-form,
body.single-product .wc-paypal-payments-form,
body.single-product .ppcp-buttons,
body.single-product .paypal-express-checkout,
body.single-product .wc_paypal_express_checkout_button,
body.single-product .woocommerce-paypal-express-checkout,
body.single-product .wc-paypal-express-checkout-form,
body.single-product .paypal-button,
body.single-product .paypal-buttons,
body.single-product .wc-gateway-ppcp-buttons,
body.single-product .wc-ppcp-funding-source-paypal {
    display: none !important;
}

/* Hide SKU from public product pages (keep it in admin) */
body.single-product .product_meta .sku_wrapper,
body.single-product .product_meta .sku,
body.single-product .product_meta span.sku,
body.single-product .woocommerce-product-details__short-description .sku {
    display: none !important;
}

/* ===== 5 Products Per Row (Shop/Category) ===== */
/* When WooCommerce adds .columns-5 to the products list, render as 5-column grid */
.woocommerce ul.products.columns-5 {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
  list-style: none;
}
.woocommerce ul.products.columns-5 li.product {
  width: 100% !important;
  margin: 0 !important;
  float: none !important;
}

/* Responsive fallbacks */
@media (max-width: 1200px) {
  .woocommerce ul.products.columns-5 { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 992px) {
  .woocommerce ul.products.columns-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .woocommerce ul.products.columns-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .woocommerce ul.products.columns-5 { grid-template-columns: 1fr; }
}

/* Enforce 5 columns on shop and category archives even if theme outputs columns-4 */
body.archive.post-type-archive.product .woocommerce ul.products,
body.tax-product_cat .woocommerce ul.products {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
}
body.archive.post-type-archive.product .woocommerce ul.products li.product,
body.tax-product_cat .woocommerce ul.products li.product {
  width: 100% !important;
  margin: 0 !important;
  float: none !important;
}

/* Responsive fallbacks for enforced grid */
@media (max-width: 1200px) {
  body.archive.post-type-archive.product .woocommerce ul.products,
  body.tax-product_cat .woocommerce ul.products { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 992px) {
  body.archive.post-type-archive.product .woocommerce ul.products,
  body.tax-product_cat .woocommerce ul.products { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  body.archive.post-type-archive.product .woocommerce ul.products,
  body.tax-product_cat .woocommerce ul.products { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  body.archive.post-type-archive.product .woocommerce ul.products,
  body.tax-product_cat .woocommerce ul.products { grid-template-columns: 1fr; }
}
/* === Enhanced Mobile Touch and Scroll Performance === */
/* Smooth momentum scrolling for all scrollable elements */
body, html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Prevent zoom on input focus (mobile Safari) */
input[type="text"], input[type="email"], input[type="tel"], input[type="number"], textarea, select {
  font-size: 16px !important;
  transform: scale(1);
}

/* Optimize touch interactions */
a, button, .btn, [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Prevent overscroll bounce effects */
body {
  overscroll-behavior: none;
}

/* Fix potential layout shifts */
* {
  box-sizing: border-box;
}

/* === End fix === */

/* Homepage title color override - LIGHT THEME */
.taimelamp-home .tl-section__title {
  color: #1E293B !important;
  background: none !important;
  -webkit-background-clip: initial !important;
  -webkit-text-fill-color: initial !important;
}

/* Hero title override - LIGHT THEME */
.taimelamp-home .tl-hero__content h1 {
  color: #1E293B !important;
}

/* Final CTA title override - LIGHT THEME */
.taimelamp-home .tl-final-cta h2 {
  color: #1E293B !important;
}

/* Enhanced Mobile Scrolling Fixes */
@media (max-width: 768px) {
  /* Prevent horizontal scrolling */
  body, html {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  body.home {
    overflow-x: hidden !important;
  }

  .site-content {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Fix container widths */
  .container, .ast-container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    box-sizing: border-box !important;
  }

  /* Ensure all images are responsive */
  img {
    max-width: 100% !important;
    height: auto !important;
    box-sizing: border-box !important;
  }

  /* Fix grid overflows */
  .woocommerce ul.products,
  .products,
  .grid {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Improve touch scrolling */
  * {
    -webkit-overflow-scrolling: touch !important;
    touch-action: manipulation !important;
  }
}

/* === MOBILE IMAGE GALLERY SCROLLING FIX === */
/* WooCommerce Product Gallery Mobile Touch Scrolling */

/* Thumbnail scrolling container */
.flex-control-thumbs {
  list-style: none !important;
  margin: 8px 0 0 !important;
  padding: 0 !important;
  display: grid !important;
  grid-auto-flow: column !important;
  grid-auto-columns: 84px !important;
  gap: 8px !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: thin !important;
  touch-action: pan-x !important;
  user-select: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  position: static !important;
}

.flex-control-thumbs li img {
  width: 100% !important;
  height: 84px !important;
  object-fit: cover !important;
  object-position: center !important;
  border: 1px solid #e0e0e0 !important;
  border-radius: 8px !important;
  background: #fff !important;
  cursor: pointer !important;
  display: block !important;
  touch-action: manipulation !important;
  pointer-events: auto !important;
}

.flex-control-thumbs li img:hover {
  border-color: #54B435 !important;
}

.flex-control-thumbs li img.flex-active {
  outline: 2px solid #54B435 !important;
  outline-offset: 1px !important;
}

/* Mobile specific improvements */
@media (max-width: 768px) {
  .flex-control-thumbs {
    grid-auto-columns: 76px !important;
    padding: 0 16px !important;
    margin-left: -16px !important;
    margin-right: -16px !important;
    scroll-behavior: smooth !important;
    scroll-snap-type: x mandatory !important;
  }

  .flex-control-thumbs li {
    scroll-snap-align: start !important;
    min-width: 76px !important;
  }

  .flex-control-thumbs li img {
    height: 76px !important;
  }

  /* Prevent parent elements from interfering with scrolling */
  .woocommerce-product-gallery {
    touch-action: pan-y pinch-zoom !important;
  }

  .woocommerce-product-gallery__wrapper {
    touch-action: pan-y pinch-zoom !important;
  }
}

/* Desktop layout - keep thumbnails below image for clean look */
@media (min-width: 1024px) {
  .flex-control-thumbs {
    grid-auto-columns: 96px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    justify-content: flex-start !important;
    margin-top: 16px !important;
    overflow-x: visible !important;
  }

  .flex-control-thumbs li {
    width: 96px !important;
  }

  .flex-control-thumbs li img {
    height: 96px !important;
  }
}

/* Ensure Astra theme doesn't override our gallery styles */
.ast-woocommerce-container .flex-control-thumbs,
.woocommerce-product-gallery .flex-control-thumbs {
  display: grid !important;
}

/* Override any Astra/WooCommerce conflicting styles */
.woocommerce div.product .woocommerce-product-gallery .flex-control-thumbs {
  opacity: 1 !important;
  visibility: visible !important;
  position: static !important;
}

.woocommerce div.product .woocommerce-product-gallery .flex-control-thumbs li {
  list-style: none !important;
  margin: 0 !important;
}

/* Make sure thumbnail images are properly sized in Astra */
.ast-woocommerce-container .flex-control-thumbs li img {
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1/1 !important;
  object-fit: cover !important;
}

/* === Homepage Featured Products Grid Fix === */
.tl-featured {
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

.tl-featured .container {
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding-left: 20px;
  padding-right: 20px;
}

.tl-featured .wc-grid {
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.tl-featured .woocommerce ul.products {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin: 0 !important;
  padding: 0 !important;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.tl-featured .woocommerce ul.products li.product {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
  min-width: 0; /* Allow items to shrink */
  overflow: hidden;
}

/* Responsive grid for smaller screens */
@media (max-width: 1200px) {
  .tl-featured .woocommerce ul.products {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
  }
}

@media (max-width: 768px) {
  .tl-featured .woocommerce ul.products {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .tl-featured .woocommerce ul.products {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* Navigation styling adjustments live in header.php. Removing legacy overrides. */

/* =============================================================
   Light Theme Overrides (v1.3.0)
   Switch global palette from dark to light without touching templates.
   These rules are appended last to win specificity with minimal !important.
   ============================================================= */

/* Base */
body,
.site,
#page { background: #ffffff; color: #111827; }

/* Containers */
.ast-container,
.container,
.woocommerce .ast-container,
.woocommerce-page .ast-container { background: transparent; }

/* Links */
a { color: #065f46; }
a:hover, a:focus { color: #047857; }

/* WooCommerce general text */
.woocommerce,
.woocommerce-page { color: #111827; }

/* Product card links and titles */
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product a { color: #111827; }
.woocommerce ul.products li.product a:hover,
.woocommerce ul.products li.product a:focus { color: #065f46; }

/* Prices */
.woocommerce ul.products li.product .price,
.woocommerce div.product p.price,
.woocommerce div.product span.price { color: #16a34a; }
.woocommerce ul.products li.product .price del,
.woocommerce div.product p.price del,
.woocommerce div.product span.price del { color: #6b7280; opacity: .9; }

/* Buttons */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce .added_to_cart,
.woocommerce .button.add_to_cart_button {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #ffffff;
  border: 1px solid #16a34a33;
  box-shadow: 0 6px 18px rgba(34,197,94,.22);
}

/* Forms / selects */
.woocommerce .quantity .qty,
.woocommerce .quantity input[type="number"],
.woocommerce .woocommerce-ordering select,
.woocommerce .woocommerce-ordering .orderby {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #111827;
}

/* Tables and panels */
.woocommerce table.shop_table,
.woocommerce table.shop_table th,
.woocommerce table.shop_table td,
.woocommerce .woocommerce-cart-form,
.woocommerce .cart_totals,
.woocommerce-account .woocommerce-MyAccount-content,
.woocommerce-account .woocommerce-MyAccount-navigation { border-color: #e5e7eb; color: inherit; }

/* Notices */
.woocommerce .woocommerce-message,
.woocommerce .woocommerce-info,
.woocommerce .woocommerce-error {
  color: #065f46;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

/* Sale badge */
.woocommerce span.onsale { background: linear-gradient(135deg, #22c55e, #10b981); color: #ffffff; }

/* Card borders subtler on light */
.woocommerce ul.products li.product,
.woocommerce div.product { border-color: #e5e7eb; }

/* Lighten homepage hero */
.tl-hero-ultra { background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%); }
.tl-hero-ultra__title { color: #111827; text-shadow: none; }
.tl-hero-ultra__description p { color: #475569; }
.tl-feature-pill { background: #f1f5f9; border-color: #e2e8f0; color: #334155; }

/* Stronger sale price color on light theme */
.woocommerce ul.products li.product .price ins,
.woocommerce div.product p.price ins,
.woocommerce div.product span.price ins {
  color: #0f766e; /* teal-700 for contrast */
  text-decoration: none;
  font-weight: 700;
}

/* Product page: brand green for shipping/payment helper text under price */
.single-product .ast-shipping-text {
  color: #54B435 !important;
  font-weight: 600;
}

/* Result count readability */
.woocommerce .woocommerce-result-count { color: #334155; font-weight: 500; }

/* Proceed to Checkout — match "Lisa korvi" button */
.woocommerce .wc-proceed-to-checkout a.checkout-button,
.woocommerce a.checkout-button,
.woocommerce .checkout-button.button,
.woocommerce .checkout-button.button.alt,
.wc-block-components-button__button,
.wc-block-cart__submit-button {
  background: linear-gradient(135deg, #22c55e, #16a34a) !important;
  color: #ffffff !important;
  border: 1px solid #16a34a33;
  box-shadow: 0 6px 18px rgba(34,197,94,.22);
  border-radius: 14px;
  padding: 0.9rem 1.25rem;
  font-weight: 700;
}

.woocommerce .wc-proceed-to-checkout a.checkout-button:hover,
.woocommerce a.checkout-button:hover,
.woocommerce .checkout-button.button:hover,
.woocommerce .checkout-button.button.alt:hover,
.wc-block-components-button__button:hover,
.wc-block-cart__submit-button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.woocommerce .wc-proceed-to-checkout a.checkout-button span,
.woocommerce a.checkout-button span,
.woocommerce .checkout-button.button span,
.woocommerce .checkout-button.button.alt span,
.wc-block-components-button__button span,
.wc-block-components-button__button .wc-block-components-button__text,
.wc-block-cart__submit-button span,
.wc-block-cart__submit-button .wc-block-components-button__text {
  color: #ffffff !important;
}

/* ======================
   CLS Guards: Cart Page
   ====================== */
/* Reserve space for totals sidebar while Woo Blocks hydrate */
.woocommerce-cart .wc-block-cart__sidebar,
.woocommerce-cart .wp-block-woocommerce-cart-totals-block,
.woocommerce-cart .wc-block-components-sidebar {
  min-height: 420px;
  align-self: start;
}

.woocommerce-cart .wc-block-cart__totals {
  min-height: 420px;
}

@media (max-width: 781px) {
  .woocommerce-cart .wc-block-cart__sidebar,
  .woocommerce-cart .wp-block-woocommerce-cart-totals-block,
  .woocommerce-cart .wc-block-cart__totals,
  .woocommerce-cart .wc-block-components-sidebar { min-height: 0; }
}



/* Single Product – enforce light surfaces and dark text */
.single-product .site-content,
.single-product .ast-container,
.single-product .content-area,
.single-product .site-main,
.single-product .entry-content,
.single-product .product,
.single-product .summary,
.single-product .woocommerce-product-details__short-description {
  background: #ffffff !important;
  color: #111827 !important;
}

.single-product .woocommerce-tabs,
.single-product .woocommerce-Tabs-panel,
.single-product .related,
.single-product .upsells,
.single-product .cross-sells {
  background: #ffffff !important;
  color: #111827 !important;
}

.single-product .woocommerce div.product .product_title,
.single-product .woocommerce div.product .price,
.single-product .woocommerce div.product .woocommerce-product-details__short-description,
.single-product .woocommerce div.product .entry-summary { color: #111827 !important; }

/* Single product link colors */
.single-product .woocommerce div.product a { color: #065f46; }
.single-product .woocommerce div.product a:hover,
.single-product .woocommerce div.product a:focus { color: #047857; }

/* Ensure product gallery images are visible */
.single-product .woocommerce-product-gallery, 
.single-product .woocommerce-product-gallery__wrapper,
.single-product .woocommerce-product-gallery__image img { opacity: 1 !important; filter: none !important; }

/* Prevent layout shift from Woo zoom clone image (belt & suspenders in case zoom is injected) */
.woocommerce img.zoomImg { display: none !important; }

/* Remove ESTO calculator widget on single product pages (perf + CLS) */
.single-product #esto_calculator,
.single-product div#esto_calculator,
.single-product [id^="esto_calculator"],
.single-product .esto-calculator,
.single-product .esto-calculator-wrapper,
.single-product .esto_widget,
.single-product .esto-pay,
.single-product .esto-widget {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* ======================
   CLS Guards: Single Product
   ====================== */
/* Reserve stable space for above-the-fold summary elements */
.single-product .product .entry-summary h1.product_title { min-height: 2.6rem; }
.single-product .product .entry-summary p.price { min-height: 2.0rem; display: block; }
.single-product .woocommerce-product-details__short-description { min-height: 3.5rem; }
.single-product .product .entry-summary form.cart { min-height: 3.2rem; display: flex; align-items: center; gap: .5rem; }

/* Consistent control heights */
.single-product .quantity .qty { height: 44px; padding: 0 .75rem; }
.single-product .single_add_to_cart_button.button {
  height: 44px;
  line-height: 44px;
  padding: 0 1.1rem;
  border-radius: 12px;
}
/* Ensure vertical centering on all themes/browsers */
.single-product .single_add_to_cart_button.button,
.single-product .single_add_to_cart_button.button span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2; /* avoid double line-height stacking */
}


/* Cart/Checkout readability tweaks */
.woocommerce-cart .product-name a,
.woocommerce-checkout .product-name a { color: #0f172a !important; }
.woocommerce-cart .product-name a:hover,
.woocommerce-checkout .product-name a:hover { color: #065f46 !important; }
.woocommerce table.shop_table th { color: #111827; }
.woocommerce table.shop_table td { color: #334155; }

/* Override legacy dark scheme on Cart/Checkout/Account */
.woocommerce-cart, .woocommerce-checkout, .woocommerce-account { color: #111827 !important; }
.woocommerce-cart a, .woocommerce-checkout a, .woocommerce-account a { color: #065f46 !important; }
.woocommerce-cart a:hover, .woocommerce-checkout a:hover, .woocommerce-account a:hover { color: #047857 !important; }

/* Ensure WooCommerce cart/checkout content stays centered on mobile */
.woocommerce-cart .woocommerce,
.woocommerce-checkout .woocommerce {
  max-width: min(100%, 960px);
  margin: 0 auto;
  padding: 0 clamp(1.2rem, 6vw, 2.5rem);
  box-sizing: border-box;
}

.woocommerce-cart .ast-container,
.woocommerce-checkout .ast-container,
.woocommerce-cart #primary,
.woocommerce-checkout #primary,
.woocommerce-cart .site-main,
.woocommerce-checkout .site-main,
.woocommerce-cart .entry-content,
.woocommerce-checkout .entry-content {
  max-width: min(100%, 960px);
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1.2rem, 6vw, 2.5rem);
  padding-right: clamp(1.2rem, 6vw, 2.5rem);
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .woocommerce-cart .woocommerce,
  .woocommerce-checkout .woocommerce {
    padding: 0 1.4rem;
  }
  .woocommerce-cart .ast-container,
  .woocommerce-checkout .ast-container,
  .woocommerce-cart #primary,
  .woocommerce-checkout #primary,
  .woocommerce-cart .site-main,
  .woocommerce-checkout .site-main,
  .woocommerce-cart .entry-content,
  .woocommerce-checkout .entry-content {
    padding-left: 1.4rem;
    padding-right: 1.4rem;
  }
  .woocommerce table.shop_table,
  .woocommerce-cart table.shop_table,
  .woocommerce-checkout table.shop_table {
    margin: 0 auto;
  }
}

/* Fix: ensure Proceed to Checkout button text is white on Cart page */
.woocommerce-cart .wc-proceed-to-checkout a.checkout-button,
.woocommerce-cart a.checkout-button,
.woocommerce-cart .checkout-button.button,
.woocommerce-cart .checkout-button.button.alt {
  color: #ffffff !important;
  font-weight: 700;
}
.woocommerce-cart .wc-proceed-to-checkout a.checkout-button:hover,
.woocommerce-cart a.checkout-button:hover,
.woocommerce-cart .checkout-button.button:hover,
.woocommerce-cart .checkout-button.button.alt:hover {
  color: #ffffff !important;
}

/* Checkout: scale Esto bank logos for a cleaner layout */
body.woocommerce-checkout .esto-pay-logo {
  min-height: 68px !important;
  padding: 10px !important;
  border-radius: 10px;
  flex: 0 1 calc(25% - 15px);
}

body.woocommerce-checkout .esto-pay-logos {
  gap: 15px !important;
}

body.woocommerce-checkout .esto-pay-logos__country {
  gap: 15px !important;
}

body.woocommerce-checkout .esto-pay-logos-layout-columns-3 .esto-pay-logo {
  flex: 0 1 calc(25% - 15px);
}

body.woocommerce-checkout .esto-pay-logo img {
  max-height: 44px !important;
  max-width: 65% !important;
  min-height: auto !important;
}

@media (max-width: 1024px) {
  body.woocommerce-checkout .esto-pay-logos-layout-columns-3 .esto-pay-logo {
    flex: 0 1 calc(33.333% - 15px);
  }
}

@media (max-width: 768px) {
  body.woocommerce-checkout .esto-pay-logo {
    flex: 0 1 calc(50% - 12px);
    min-height: 58px !important;
  }
  body.woocommerce-checkout .esto-pay-logo img {
    max-height: 40px !important;
  }
}

@media (max-width: 520px) {
  body.woocommerce-checkout .esto-pay-logo {
    flex: 0 1 100%;
  }
}
