/**
 * Minimalio WooCommerce Styles
 *
 * This stylesheet contains all the WooCommerce-related styles for the Minimalio theme.
 * Professional styling for WooCommerce pages, blocks, and components.
 *
 * @package Minimalio_WooCommerce_Styling
 * @version 1.0.0
 */

/*
 * Control the hover stylings of outline block style.
 * Unnecessary once block styles are configurable via theme.json
 * https://github.com/WordPress/gutenberg/issues/42794
 */
.wp-block-button.is-style-outline
  > .wp-block-button__link:not(.has-background):hover {
  background-color: var(--wp--preset--color--contrast);
  color: var(--wp--preset--color--base);
  border-color: var(--wp--preset--color--contrast);
}

/*
 * Link styles
 * https://github.com/WordPress/gutenberg/issues/42319
 */
a {
  text-decoration-color: var(--wp--preset--color--primary);
  text-decoration-thickness: 0.5px !important;
  text-underline-offset: 0.05em;
}

/* Reset browser default margins for blockquote element */
.wp-block-pullquote blockquote {
  margin: 0;
}

/* Search button inside style */
.wp-block-search__button-inside .wp-block-search__inside-wrapper {
  padding: 4px;
}

/* Adjust font size for comment reply title */
.wp-block-post-comments-form .comment-reply-title {
  font-size: var(--wp--preset--font-size--large);
}

/* Remove the bottom margin from the button */
.wp-block-post-comments-form .form-submit {
  margin-bottom: 0;
}

/*
 * Responsive menu container padding.
 * This ensures the responsive container inherits the same
 * spacing defined above. This behavior may be built into
 * the Block Editor in the future.
 */
.wp-block-navigation__responsive-container.is-menu-open {
  padding: var(--wp--preset--spacing--50);
}

/* Adjust the top padding for the submenu items */
.wp-block-navigation__responsive-container.is-menu-open
  .wp-block-navigation__responsive-container-content
  .wp-block-navigation__submenu-container {
  padding-top: var(--wp--preset--spacing--30);
}

/* Override the Gutenberg style to theme style */
.wp-block-post-author__byline,
.wp-block-post-author__bio {
  font-size: inherit;
}

/* Round the avatar and reset the vertical alignment */
.wp-block-post-author__avatar img {
  border-radius: 999px;
  line-height: 0;
}

/* Style tag cloud outline style  */
.wp-block-tag-cloud.is-style-outline a {
  border-color: var(--wp--preset--color--tertiary);
  border-radius: 999px;
  padding: 0 0.5rem;
}

.wp-block-tag-cloud.is-style-outline a:hover {
  color: var(--wp--preset--color--base);
  background-color: var(--wp--preset--color--primary);
}

/* Remove the default margin from author bio */
.wp-block-post-author__bio {
  margin: 0;
}

/* Remove the default margin from term description. */
.wp-block-term-description p:first-child {
  margin-top: 0;
}

.wp-block-term-description p:last-child {
  margin-bottom: 0;
}

/* Normalise font sizes for the latest comments and latest posts widgets */
.wp-block-latest-comments__comment-excerpt p,
.wp-block-latest-comments__comment-date,
.wp-block-latest-posts__post-author,
.wp-block-latest-posts__post-date {
  font-size: inherit;
}

/* Adjust font colour in the Calendar widget */
.wp-block-calendar table:where(:not(.has-text-color)) {
  color: var(--wp--preset--color--foreground);
}

/* Fix border radius setting for the avatar block */
.wp-block-avatar a,
.wp-block-avatar img {
  border-radius: inherit;
  vertical-align: middle;
}

/* Fix line height for various fields */
.wp-block-search__input,
.wp-block-post-comments-form
  .comment-form
  input:not([type="submit"]):not([type="checkbox"]),
.wp-block-post-comments-form .comment-form textarea {
  line-height: inherit;
}

/* Style  border colour for search and Jetpack subscription blocks */
.wp-block-search__input,
.wp-block-search__button-inside .wp-block-search__inside-wrapper,
.wp-block-jetpack-subscriptions.wp-block-jetpack-subscriptions__supports-newline
  form
  input[type="email"] {
  border-color: var(--wp--preset--color--tertiary);
}

/* Needed to style input field for various Jetpack blocks */
.wp-block-jetpack-contact-form
  input:not([type="submit"]):not([type="checkbox"]),
.wp-block-jetpack-contact-form select,
.wp-block-jetpack-contact-form textarea,
.wp-block-jetpack-mailchimp input:not([type="submit"]):not([type="checkbox"]),
.wp-block-jetpack-revue input:not([type="submit"]):not([type="checkbox"]) {
  background-color: #fff;
  border: 1px solid var(--wp--preset--color--tertiary);
  font-size: inherit;
  line-height: inherit;
  padding: 0.5rem;
}

.wp-block-jetpack-contact-form.contact-form label {
  font-weight: 400;
}

.wp-block-jetpack-contact-form.contact-form label span {
  opacity: 0.7;
}

.wp-block-jetpack-contact-form.contact-form select {
  padding: 0.5rem;
}

.wp-block-jetpack-contact-form.contact-form textarea {
  margin-bottom: var(--wp--preset--spacing--40);
}

/* Style the feedback you get after submitting the contact form */
div[id^="contact-form-"] h4 {
  font-size: var(--wp--preset--font-size--medium);
  font-weight: inherit;
  line-height: 1.555555556;
}

div[id^="contact-form-"] .contact-form-submission {
  margin: 0;
  padding: 0;
}

/* Adjust vertical margins in the mailchimp block */
.wp-block-jetpack-mailchimp .wp-block-jetpack-button,
.wp-block-jetpack-mailchimp p {
  margin: var(--wp--preset--spacing--40) 0;
}

/* Adjust the size of the consent text in mailchimp block */
#wp-block-jetpack-mailchimp_consent-text {
  font-size: var(--wp--preset--font-size--small);
  margin-bottom: 0;
}

/* Remove underline from the price after discounted */
ins {
  text-decoration: none;
}

/* Fix the hardcoded wide width value in the stylesheet for TT3 */
body.woocommerce-page main {
  max-width: 100%;
}

/* SHOP PAGE */
body.woocommerce {
  /* shop title */
  .page-title {
    font-size: 1.5390234037rem;
    margin-bottom: 1rem;
    @media (min-width: 20em) and (max-width: 60em) {
      font-size: calc(1.5390234037rem + 0.8295696333 * (100vw - 20em) / 40);
    }
    @media (min-width: 60em) {
      font-size: 2.368593037rem;
    }
  }
  select.orderby {
    padding: 0.25rem 0.5rem;
  }

  /* sale badge */
  span.onsale,
  div.product > span.onsale {
    left: 4px;
    margin: 0;
    position: absolute;
    right: 4px;
    top: 4px;
    background: #fff;
    border: 1px solid #43454b;
    border-radius: 0;
    box-sizing: border-box;
    color: #43454b;
    display: inline-block;
    font-size: 0.875em;
    font-weight: 600;
    padding: 0.35em 0.75em;
    line-height: 1.5;
    text-align: center;
    text-transform: uppercase;
    width: fit-content;
    z-index: 9;
  }

  /* product card paddings */
  h2.woocommerce-loop-product__title {
    padding: 0.5em 0;
  }
  ul.products li.product a.button,
  ul.products li.product .price {
    padding: 0 0 0.5rem 0;
    display: block;
  }

  /* product button */
  ul.products li.product a.button {
    text-decoration: underline;
    &:hover {
      text-decoration: none;
    }
  }
}

/* SINGLE PRODUCT */
body.woocommerce {
  .woocommerce-product-gallery {
    float: left !important;
    margin-bottom: 1rem;
  }

  /* product title, other headings */
  div.product div.summary h1.product_title {
    font-size: 1.5390234037rem;
    margin-bottom: 1rem;
    @media (min-width: 20em) and (max-width: 60em) {
      font-size: calc(1.5390234037rem + 0.8295696333 * (100vw - 20em) / 40);
    }
    @media (min-width: 60em) {
      font-size: 2.368593037rem;
    }
  }

  /* quantity */
  .quantity input[type="number"] {
    padding: 0.75rem 0.5rem 0.75rem 0.9rem;
    border: 1px solid black;
    color: black;
    width: 4em;
  }

  table.variations select {
    background-color: transparent;
  }

  /* add to cart button  */

  .cart:not(.variations_form, .grouped_form),
  .woocommerce-variation-add-to-cart {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
  }
  .single_add_to_cart_button {
    background-color: var(--preset--font-color);
    border: 1px solid var(--preset--font-color);
    border-radius: 9999px;
    margin: 0 !important;
    padding: calc(0.667em + 2px) calc(1.333em + 2px);
    transition: 0.2s all;
    cursor: pointer;
    color: var(--wp--preset--color--base);
    font-size: var(--wp--preset--font-size--small);
    line-height: 1;
    &:hover {
      background-color: transparent;
      border: 1px solid;
      color: var(--preset--tertiary-color);
    }
  }

  /* product gallery */

  .product_meta,
  div.product ol.flex-control-thumbs {
    margin-top: 1rem;
  }

  div.product ol.flex-control-thumbs {
    display: flex;
    gap: 1rem;
  }

  div.product ol.flex-control-thumbs li {
    margin: 0;
  }

  /* description, reviews tabs */

  ul.tabs.wc-tabs {
    border-bottom-color: inherit;
    border-bottom-width: 0;
    overflow: visible;
    padding: 0;
  }
  ul.tabs.wc-tabs:after,
  ul.tabs.wc-tabs:before {
    display: none;
  }
  ul.tabs.wc-tabs li {
    background: transparent;
    border: solid transparent;
    border-radius: 0;
    border-width: 0 0 2px;
    color: inherit;
    display: inline-block;
    float: none;
    margin: 0;
    opacity: 0.65;
    padding: 0;
    margin-right: 1em;
    font-weight: inherit;
  }
  ul.tabs.wc-tabs li a {
    border: none;
    color: inherit;
    display: inline-block;
    padding: 0.5em 0;
    text-decoration: none;
    text-shadow: none;
  }
  ul.tabs.wc-tabs li.active,
  ul.tabs.wc-tabs li:focus-within,
  ul.tabs.wc-tabs li:hover {
    background: inherit;
    border-color: inherit;
    color: inherit;
    opacity: 1;
  }
  ul.tabs.wc-tabs li.active a,
  ul.tabs.wc-tabs li:focus-within a,
  ul.tabs.wc-tabs li:hover a {
    border: none;
    color: inherit;
    text-decoration: none;
  }
  ul.tabs.wc-tabs li a:focus:not(:focus-visible),
  ul.tabs.wc-tabs li:focus:not(:focus-visible) {
    outline: none;
  }

  .woocommerce-Tabs-panel {
    margin-left: 0;
  }
  @media only screen and (max-width: 768px) {
    ul.tabs.wc-tabs li {
      border-bottom-width: 0;
      border-left-width: 2px;
      display: block;
      margin-bottom: 2px;
    }
  }
  ul.tabs.wc-tabs li:first-child {
    margin-left: 0;
  }
  ul.tabs.wc-tabs li:after,
  ul.tabs.wc-tabs li:before {
    display: none;
  }

  /* related product tabs */

  .related.products > h2 {
    font-size: 1.5390234037rem;
    @media (min-width: 20em) and (max-width: 60em) {
      font-size: calc(1.5390234037rem + 0.8295696333 * (100vw - 20em) / 40);
    }
    @media (min-width: 60em) {
      font-size: 2.368593037rem;
    }
  }
}

/* woocommerce messages */

body.woocommerce {
  .woocommerce-error,
  .woocommerce-info,
  .woocommerce-message {
    background-color: white;
    border: 2px solid var(--wp--preset--color--primary);
    outline: 0;
  }
}

/* woocommerce reviews */

body.woocommerce .woocommerce-Reviews .comment-form-comment label,
body.woocommerce .woocommerce-Reviews .comment-form-comment textarea {
  margin-top: 1rem;
}
