/*
 * 4kids theme overrides.
 *
 * Loaded after the Kidol template CSS (via wp_head), so anything here wins.
 * Keep it to WordPress/WooCommerce fixes the static template never had to make.
 */

/* ---------------------------------------------------------------------------
 * Sidebar cart thumbnails
 *
 * Kidol sizes the thumb column with `flex: 0 0 70px`, but a flex item also has
 * `min-width: auto`, so it can never shrink below its content's intrinsic size.
 * The demo shipped 70px images; WooCommerce serves 300px+ ones, which blew the
 * column open and left the pictures uncropped. Pin the box and crop to square.
 * ------------------------------------------------------------------------ */
.cart-content ul li {
  align-items: flex-start;
}

.cart-content ul li .cart-img {
  flex: 0 0 70px !important;
  width: 70px;
  max-width: 70px;
  min-width: 0;
}

.cart-content ul li .cart-img a,
.cart-content ul li .cart-img a img,
.cart-content ul li .cart-img img {
  display: block;
  width: 70px !important;
  height: 70px !important;
  max-width: 70px;
  object-fit: cover;
  border-radius: 8px;
  margin: 0;
  float: none;
}

.cart-content ul li .cart-title {
  min-width: 0;
  margin-left: 20px;
}

.cart-content ul li .cart-title h4 {
  overflow-wrap: anywhere;
}

.cart-content ul li .cart-delete a {
  line-height: 1;
}

/* WooCommerce prints its own variation/meta list inside the item. */
.cart-content ul li .cart-title .variation {
  font-size: 13px;
  margin: 4px 0 0;
}

.cart-content ul li.woocommerce-mini-cart__empty-message {
  display: block;
  color: #636e72;
}

/* ---------------------------------------------------------------------------
 * Wishlist / compare tables - square, cropped product images
 * ------------------------------------------------------------------------ */
.wishlist-table-content .product-thumbnail img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
}

.compare-table .product-image-title .image img {
  width: 100%;
  max-width: 180px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
}

.compare-table .product-image-title .category {
  display: block;
  font-size: 13px;
  color: #636e72;
  margin: 10px 0 4px;
}

.compare-table .product-image-title .title {
  display: block;
  font-weight: 500;
}

/* ---------------------------------------------------------------------------
 * "Deal Of The Day" band
 *
 * The countdown markup was renamed off `.countdown-timer` (see front-page.php),
 * so these mirror the template's rules under the new class.
 * ------------------------------------------------------------------------ */
.divider-area.divider-style1-area .divider-content .countdown-content .fourkids-countdown {
  position: relative;
  display: flex;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
  top: 0;
  left: 0;
  bottom: 0;
}

.divider-area.divider-style1-area .divider-content .countdown-content .fourkids-countdown li {
  background-image: url("../assets/img/divider/shape5.png");
  background-color: transparent;
  background-size: cover;
  display: inline-block;
  width: 100px;
  height: 100px;
  font-size: 48px;
  font-weight: 700;
  margin: 0;
  padding: 0;
  position: relative;
  text-align: center;
}

.divider-area.divider-style1-area .divider-content .countdown-content .fourkids-countdown li + li {
  margin-left: 30px;
}

.divider-area.divider-style1-area .divider-content .countdown-content .fourkids-countdown li span {
  color: #fff;
  font-family: "Fredoka One", cursive;
  font-size: 30px;
  line-height: 1;
  display: inline-block;
  margin-top: 26px;
}

.divider-area.divider-style1-area .divider-content .countdown-content .fourkids-countdown li p {
  margin-bottom: 0;
  margin-top: 4px;
  font-weight: 500;
}

@media only screen and (max-width: 1199px) {
  .divider-area.divider-style1-area .divider-content .countdown-content .fourkids-countdown li + li {
    margin-left: 22px;
  }
}

@media only screen and (max-width: 575px) {
  .divider-area.divider-style1-area .divider-content .countdown-content .fourkids-countdown li {
    height: 59px;
    width: 59px;
    line-height: 0.8;
  }
  .divider-area.divider-style1-area .divider-content .countdown-content .fourkids-countdown li + li {
    margin-left: 18px;
  }
  .divider-area.divider-style1-area .divider-content .countdown-content .fourkids-countdown li span {
    font-size: 22px;
    margin-top: 14px;
  }
  .divider-area.divider-style1-area .divider-content .countdown-content .fourkids-countdown li p {
    font-size: 12px;
  }
}

/*
 * The two kid cut-outs sit in a .shape-group that appears earlier in the DOM
 * than the band's scalloped edges, so with no z-index the white scallop painted
 * over their heads. Put the children in front of the edges.
 */
.divider-area.divider-style1-area .container .shape-group .shape-style3,
.divider-area.divider-style1-area .container .shape-group .shape-style4 {
  z-index: 3;
}

.divider-area.divider-style1-area > .shape-group .shape-style1,
.divider-area.divider-style1-area > .shape-group .shape-style2 {
  z-index: 1;
}

.divider-area.divider-style1-area .divider-content {
  position: relative;
  z-index: 2;
}

/* ---------------------------------------------------------------------------
 * Product cards / shop grid
 * ------------------------------------------------------------------------ */
.product-item .product-thumb {
  position: relative;
}

/*
 * The card wraps its image in a link (the template's was a bare <img>), so the
 * anchor becomes the flex item inside .product-thumb. Make it fill the slot,
 * otherwise it shrinks to the image's intrinsic width.
 */
.product-item .product-thumb > a {
  display: block;
  width: 100%;
  line-height: 0;
  padding: 16px 16px 0;
}

/*
 * Inset the photo so the card's blue frame stays visible around it; without
 * the padding, busy edge-to-edge photos read as overflowing the card.
 */
.product-item .product-thumb img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
}

/* ---------------------------------------------------------------------------
 * Coupon note under a discounted price
 * ------------------------------------------------------------------------ */
.fourkids-coupon-note {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
  color: #3aa84a;
  text-transform: uppercase;
}

.product-item .fourkids-coupon-note {
  font-size: 11px;
}

/* ---------------------------------------------------------------------------
 * Shop filter sidebar
 * ------------------------------------------------------------------------ */
.fourkids-filters {
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 10px;
  padding: 0 20px 8px;
  font-size: 14px;
}

.fourkids-pincode {
  padding: 16px 0 14px;
  border-bottom: 1px solid #ececec;
}

.fourkids-pincode-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fourkids-pincode-caption {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .4px;
  color: #6b6b6b;
}

.fourkids-pincode-value {
  color: #2f6fd0;
  font-size: 14px;
}

.fourkids-pincode-edit {
  background: none;
  border: 0;
  padding: 0;
  color: #6b6b6b;
  cursor: pointer;
  font-size: 13px;
}

.fourkids-pincode-edit:hover {
  color: #f379a7;
}

.fourkids-pincode-editor {
  margin-top: 10px;
}

.fourkids-pincode-input {
  display: flex;
  gap: 6px;
}

.fourkids-pincode-field {
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  border: 1px solid #e2e2e2;
  border-radius: 4px;
  padding: 0 10px;
  font-size: 13px;
  letter-spacing: 1px;
}

.fourkids-pincode-field:focus {
  outline: none;
  border-color: #f379a7;
}

.fourkids-pincode-save {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 4px;
  background: #f379a7;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.fourkids-pincode-detect {
  background: none;
  border: 0;
  padding: 8px 0 0;
  color: #2f6fd0;
  font-size: 13px;
  cursor: pointer;
}

.fourkids-pincode-message {
  margin: 6px 0 0;
  font-size: 12px;
  color: #3aa84a;
  min-height: 16px;
}

.fourkids-pincode-message.is-error {
  color: #d63638;
}

.fourkids-filters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
  border-bottom: 1px solid #ececec;
}

.fourkids-filters-head h3 {
  font-size: 15px;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin: 0;
}

.fourkids-filters-clear,
.fourkids-filter-clear-group {
  background: none;
  border: 0;
  padding: 0;
  color: #f379a7;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}

.fourkids-filter-group {
  border-bottom: 1px solid #f2f2f2;
  padding: 4px 0 14px;
}

.fourkids-filter-group:last-of-type {
  border-bottom: 0;
}

.fourkids-filter-title {
  margin: 0;
}

.fourkids-filter-toggle {
  width: 100%;
  background: none;
  border: 0;
  padding: 16px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: #404041;
  cursor: pointer;
}

.fourkids-filter-toggle i {
  transition: transform .2s ease;
  font-size: 18px;
}

.fourkids-filter-group.is-collapsed .fourkids-filter-toggle i {
  transform: rotate(-90deg);
}

.fourkids-filter-searchbox {
  position: relative;
  margin: 4px 0 10px;
}

.fourkids-filter-searchbox i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #9b9b9b;
  font-size: 13px;
}

.fourkids-filter-search {
  width: 100%;
  height: 34px;
  border: 1px solid #e2e2e2;
  border-radius: 4px;
  padding: 0 10px 0 30px;
  font-size: 13px;
}

.fourkids-filter-search:focus {
  outline: none;
  border-color: #f379a7;
}

.fourkids-filter-options {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 230px;
  overflow-y: auto;
}

.fourkids-filter-options::-webkit-scrollbar { width: 6px; }
.fourkids-filter-options::-webkit-scrollbar-thumb { background: #d8d8d8; border-radius: 3px; }

.fourkids-filter-option label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 9px;
  cursor: pointer;
  line-height: 1.3;
  color: #404041;
}

.fourkids-filter-option input {
  margin: 0;
  flex: 0 0 auto;
  accent-color: #f379a7;
}

.fourkids-filter-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .15);
  flex: 0 0 auto;
}

.fourkids-filter-count {
  color: #9b9b9b;
  font-size: 13px;
}

.fourkids-filter-more {
  background: none;
  border: 0;
  padding: 2px 0 0;
  color: #404041;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

.fourkids-filters-open {
  display: none;
  margin-bottom: 20px;
}

@media (max-width: 767px) {
  .fourkids-filters-open { display: inline-block; }
  .fourkids-filters { display: none; margin-bottom: 30px; }
  .fourkids-filters.is-open { display: block; }
}

/* ---------------------------------------------------------------------------
 * Shop results: toolbar, active filter chips, product grid
 * ------------------------------------------------------------------------ */
/* AJAX filtering: dim the results and show a spinner while the swap is in flight. */
#fourkids-shop-results {
  position: relative;
  min-height: 200px;
}

#fourkids-shop-results.is-loading {
  opacity: .45;
  pointer-events: none;
}

#fourkids-shop-results.is-loading::after {
  content: "";
  position: absolute;
  top: 120px;
  left: 50%;
  width: 38px;
  height: 38px;
  margin-left: -19px;
  border: 3px solid rgba(243, 121, 167, .25);
  border-top-color: #f379a7;
  border-radius: 50%;
  animation: fourkids-spin .7s linear infinite;
  z-index: 5;
}

.fourkids-shop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 14px;
}

.fourkids-shop-toolbar .woocommerce-result-count {
  margin: 0;
  float: none;
  color: #6b6b6b;
  font-size: 14px;
}

.fourkids-shop-toolbar .woocommerce-ordering {
  margin: 0;
  float: none;
}

.fourkids-shop-toolbar .woocommerce-ordering select {
  height: 40px;
  border: 1px solid #e2e2e2;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 14px;
  background: #fff;
  max-width: 100%;
}

.fourkids-active-filters {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid #ececec;
  border-bottom: 1px solid #ececec;
  padding: 12px 0;
  margin-bottom: 24px;
}

.fourkids-active-filters-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.fourkids-chip-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fourkids-chip-label {
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: .4px;
  color: #6b6b6b;
}

.fourkids-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #404041;
  line-height: 1;
}

.fourkids-chip i {
  font-size: 13px;
  color: #9b9b9b;
}

.fourkids-chip:hover,
.fourkids-chip:hover i {
  color: #f379a7;
}

.fourkids-chips-clear {
  color: #f379a7;
  font-size: 14px;
  white-space: nowrap;
}

/*
 * WooCommerce lays the loop out with floats and percentage widths tuned to a
 * full-width page, which leaves narrow, uneven cards inside the 9-column
 * results area. A grid fills the available width whatever the column count.
 */
.woocommerce ul.products,
ul.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 30px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.woocommerce ul.products::before,
.woocommerce ul.products::after {
  content: none;
}

.woocommerce ul.products li.product,
ul.products li.product {
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  float: none !important;
  clear: none !important;
}

.woocommerce ul.products li.product .product-item {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.woocommerce ul.products li.product .product-item .product-info {
  flex: 1 1 auto;
}

@media (max-width: 575px) {
  .woocommerce ul.products,
  ul.products {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
  }
}

/* ---------------------------------------------------------------------------
 * Add-to-cart loading state
 *
 * WooCommerce sets `loading` on the button for the duration of the request;
 * fourkids-shop.js adds `fk-loading` with a minimum visible duration so the
 * spinner is not a sub-50ms flash on a local install. The sidebar cart opens
 * when the spinner clears.
 * ------------------------------------------------------------------------ */
@keyframes fourkids-spin {
  to { transform: rotate(360deg); }
}

.add_to_cart_button.loading,
.add_to_cart_button.fk-loading,
.single_add_to_cart_button.fk-loading {
  pointer-events: none;
  opacity: 0.9;
}

/* Icon buttons on the product cards: swap the glyph for a spinner in place. */
.product-item .product-thumb .product-action a.add_to_cart_button.loading i,
.product-item .product-thumb .product-action a.add_to_cart_button.fk-loading i {
  display: inline-block;
  width: 20px;
  height: 20px;
  font-size: 0;
  vertical-align: middle;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fourkids-spin 0.6s linear infinite;
}

/* Text buttons: wishlist table, compare table, single product page. */
.wishlist-cart a.add_to_cart_button.loading,
.wishlist-cart a.add_to_cart_button.fk-loading,
.pro-addtocart a.add_to_cart_button.loading,
.pro-addtocart a.add_to_cart_button.fk-loading,
.single_add_to_cart_button.fk-loading {
  position: relative;
  color: transparent !important;
}

.wishlist-cart a.add_to_cart_button.loading::after,
.wishlist-cart a.add_to_cart_button.fk-loading::after,
.pro-addtocart a.add_to_cart_button.loading::after,
.pro-addtocart a.add_to_cart_button.fk-loading::after,
.single_add_to_cart_button.fk-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fourkids-spin 0.6s linear infinite;
}

/*
 * WooCommerce appends a "View cart" link next to the button once the item is
 * added. The sidebar cart already covers that, and inside the icon overlay it
 * renders as stray text.
 */
.product-item .product-action .added_to_cart,
.wishlist-cart .added_to_cart,
.pro-addtocart .added_to_cart {
  display: none;
}

/* WooCommerce's loop <ul> should not carry list bullets or default padding. */
.woocommerce ul.products,
ul.products {
  list-style: none;
  margin-left: 0;
  padding-left: 0;
}

.woocommerce ul.products li.product {
  list-style: none;
}

/* ---------------------------------------------------------------------------
   Google Map embed on the Contact page
   The iframe carries width/height attributes for browsers that load it before
   the CSS; the ratio box below overrides them so it scales on every screen.
   -------------------------------------------------------------------------*/
.fourkids-map {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 280px;
  margin: 0 0 20px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .08);
}

.fourkids-map iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* aspect-ratio is unsupported on older Safari/Edge; fall back to a padding box. */
@supports not (aspect-ratio: 16 / 9) {
  .fourkids-map {
    height: 0;
    padding-bottom: 56.25%;
    min-height: 0;
  }
}

.fourkids-map-link {
  display: inline-block;
  font-weight: 500;
}

@media (max-width: 575px) {
  .fourkids-map {
    aspect-ratio: 4 / 3;
    min-height: 240px;
  }
}
