/**
 * Advanced WooCommerce Elements for Elementor
 * Frontend stylesheet – Premium minimalist design system.
 *
 * Table of contents:
 *   1.  Design tokens (CSS custom properties)
 *   2.  Live Search – wrapper & input
 *   3.  Live Search – spinner
 *   4.  Live Search – results dropdown
 *   5.  Live Search – result items
 *   6.  Live Search – states (loading, no-results)
 *   7.  Live Search – accessibility / keyboard
 *   8.  Product Grid – grid container
 *   9.  Product Grid – card
 *   10. Product Grid – image & badges
 *   11. Product Grid – body (title, price, rating, button)
 *   12. Product Grid – image hover effects
 *   13. Product Grid – loop template wrapper
 *   14. Utilities & responsive
 */

/* ─── 1. Design tokens ─────────────────────────────────────────────────────── */

:root {
  --awe-primary:        #5b4fcf;
  --awe-primary-dark:   #4639b5;
  --awe-primary-light:  #ede9ff;
  --awe-accent:         #f97316;
  --awe-bg:             #ffffff;
  --awe-surface:        #f8f8fb;
  --awe-border:         rgba(0, 0, 0, 0.08);
  --awe-text:           #1a1a2e;
  --awe-text-muted:     #6b7280;
  --awe-text-price:     #5b4fcf;
  --awe-radius-sm:      6px;
  --awe-radius-md:      12px;
  --awe-radius-lg:      18px;
  --awe-shadow-sm:      0 2px 8px rgba(0, 0, 0, 0.06);
  --awe-shadow-md:      0 8px 30px rgba(0, 0, 0, 0.10);
  --awe-shadow-lg:      0 20px 60px rgba(0, 0, 0, 0.14);
  --awe-transition:     0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --awe-font:           inherit;
  --awe-sale-bg:        #ef4444;
  --awe-featured-bg:    #f59e0b;
  --awe-badge-text:     #ffffff;
}

/* ─── 2. Live Search – wrapper & input ─────────────────────────────────────── */

.awe-live-search {
  position:   relative;
  width:      100%;
  font-family: var(--awe-font);
}

.awe-search-wrapper {
  display:         flex;
  align-items:     center;
  background:      var(--awe-bg);
  border:          1.5px solid var(--awe-border);
  border-radius:   var(--awe-radius-lg);
  box-shadow:      var(--awe-shadow-sm);
  transition:      border-color var(--awe-transition),
                   box-shadow   var(--awe-transition);
  overflow:        hidden;
  gap:             0;
}

.awe-search-wrapper:focus-within {
  border-color: var(--awe-primary);
  box-shadow:   0 0 0 3px var(--awe-primary-light),
                var(--awe-shadow-sm);
}

.awe-search-input {
  flex:            1;
  background:      transparent;
  border:          none;
  outline:         none;
  font-size:       0.9375rem;
  color:           var(--awe-text);
  padding:         14px 18px;
  width:           100%;
  min-width:       0;
  font-family:     inherit;
}

.awe-search-input::placeholder {
  color:     var(--awe-text-muted);
  opacity:   1;
}

/* Icon */
.awe-search-icon {
  display:     flex;
  align-items: center;
  color:       var(--awe-text-muted);
  flex-shrink: 0;
  transition:  color var(--awe-transition);
}

.awe-search-wrapper.has-icon.icon-left  .awe-search-icon {
  padding-left: 16px;
  order: -1;
}

.awe-search-wrapper.has-icon.icon-right .awe-search-icon {
  padding-right: 16px;
}

.awe-search-wrapper:focus-within .awe-search-icon {
  color: var(--awe-primary);
}

.awe-search-icon svg {
  width:  18px;
  height: 18px;
  display: block;
}

/* ─── 3. Live Search – spinner ─────────────────────────────────────────────── */

.awe-search-spinner {
  display:      none;
  width:        18px;
  height:       18px;
  border:       2.5px solid var(--awe-border);
  border-top:   2.5px solid var(--awe-primary);
  border-radius:50%;
  flex-shrink:  0;
  margin-right: 14px;
  animation:    awe-spin 0.7s linear infinite;
}

.awe-live-search.is-loading .awe-search-spinner {
  display: block;
}

.awe-live-search.is-loading .awe-search-icon {
  display: none;
}

@keyframes awe-spin {
  to { transform: rotate(360deg); }
}

/* ─── 4. Live Search – results dropdown ────────────────────────────────────── */

.awe-results-dropdown {
  position:         absolute;
  top:              calc(100% + 8px);
  left:             0;
  right:            0;
  z-index:          9999;
  background:       var(--awe-bg);
  border:           1.5px solid var(--awe-border);
  border-radius:    var(--awe-radius-md);
  box-shadow:       var(--awe-shadow-lg);
  overflow-y:       auto;
  max-height:       480px;
  overscroll-behavior: contain;
  /* Entrance animation */
  opacity:          0;
  transform:        translateY(-8px) scale(0.98);
  transition:       opacity 0.18s ease,
                    transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.awe-results-dropdown.is-visible {
  opacity:   1;
  transform: translateY(0) scale(1);
}

/* Scrollbar styling (webkit) */
.awe-results-dropdown::-webkit-scrollbar {
  width: 4px;
}

.awe-results-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.awe-results-dropdown::-webkit-scrollbar-thumb {
  background:    var(--awe-border);
  border-radius: 99px;
}

/* ─── 5. Live Search – result items ────────────────────────────────────────── */

.awe-result-item {
  display:        flex;
  align-items:    center;
  gap:            14px;
  padding:        12px 16px;
  border-top:     1px solid var(--awe-border);
  text-decoration:none;
  color:          inherit;
  transition:     background-color var(--awe-transition);
  cursor:         pointer;
}

.awe-result-item:first-child {
  border-top: none;
}

.awe-result-item:hover,
.awe-result-item.is-highlighted {
  background-color: var(--awe-surface);
}

/* Thumbnail */
.awe-result-image {
  width:        60px;
  height:       60px;
  flex-shrink:  0;
  border-radius:var(--awe-radius-sm);
  overflow:     hidden;
  background:   var(--awe-surface);
}

.awe-result-image img {
  width:      100%;
  height:     100%;
  object-fit: cover;
  display:    block;
}

/* Text group */
.awe-result-text {
  flex:     1;
  min-width:0;
}

.awe-result-title {
  font-size:     0.9rem;
  font-weight:   600;
  color:         var(--awe-text);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
  display:       block;
  margin-bottom: 3px;
  transition:    color var(--awe-transition);
}

.awe-result-item:hover .awe-result-title {
  color: var(--awe-primary);
}

.awe-result-price {
  font-size:   0.8125rem;
  font-weight: 500;
  color:       var(--awe-text-muted);
}

.awe-result-price .woocommerce-Price-amount {
  color: var(--awe-text-price);
}

/* CTA */
.awe-result-action {
  flex-shrink:      0;
  font-size:        0.75rem;
  font-weight:      600;
  letter-spacing:   0.02em;
  text-transform:   uppercase;
  padding:          6px 12px;
  border-radius:    var(--awe-radius-sm);
  background:       var(--awe-primary);
  color:            #fff;
  text-decoration:  none;
  white-space:      nowrap;
  transition:       background-color var(--awe-transition),
                    transform        var(--awe-transition);
}

.awe-result-action:hover {
  background: var(--awe-primary-dark);
  transform:  translateY(-1px);
}

/* ─── 6. Live Search – states ──────────────────────────────────────────────── */

.awe-result-status {
  padding:    20px 18px;
  text-align: center;
  font-size:  0.875rem;
  color:      var(--awe-text-muted);
  font-style: italic;
}

/* ─── 7. Live Search – keyboard highlight ──────────────────────────────────── */

.awe-result-item:focus {
  outline:          2px solid var(--awe-primary);
  outline-offset:  -2px;
  background-color: var(--awe-surface);
}

/* ─── 8. Product Grid – container ──────────────────────────────────────────── */

.awe-product-grid {
  display:               grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap:            24px;
  row-gap:               24px;
  width:                 100%;
}

@media (max-width: 1024px) {
  .awe-product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .awe-product-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── 9. Product Grid – card ───────────────────────────────────────────────── */

.awe-product-card {
  display:        flex;
  flex-direction: column;
  background:     var(--awe-bg);
  border:         1px solid var(--awe-border);
  border-radius:  var(--awe-radius-md);
  overflow:       hidden;
  box-shadow:     var(--awe-shadow-sm);
  transition:     transform    var(--awe-transition),
                  box-shadow   var(--awe-transition),
                  border-color var(--awe-transition);
  will-change:    transform;
}

.awe-product-card:hover {
  transform:    translateY(-4px);
  box-shadow:   var(--awe-shadow-md);
  border-color: rgba(91, 79, 207, 0.2);
}

/* ─── 10. Product Grid – image & badges ────────────────────────────────────── */

.awe-product-image-wrap {
  position:       relative;
  display:        block;
  overflow:       hidden;
  background:     var(--awe-surface);
  aspect-ratio:   4 / 3;
}

.awe-product-image {
  width:      100%;
  height:     100%;
  object-fit: cover;
  display:    block;
  transition: transform var(--awe-transition),
              opacity   var(--awe-transition);
}

/* Badges */
.awe-badges {
  position:  absolute;
  top:       10px;
  left:      10px;
  display:   flex;
  flex-wrap: wrap;
  gap:       5px;
  z-index:   2;
}

.awe-badge {
  display:       inline-block;
  padding:       3px 9px;
  border-radius: var(--awe-radius-sm);
  font-size:     0.7rem;
  font-weight:   700;
  letter-spacing:0.05em;
  text-transform:uppercase;
  color:         var(--awe-badge-text);
  line-height:   1.4;
}

.awe-badge--sale     { background: var(--awe-sale-bg); }
.awe-badge--featured { background: var(--awe-featured-bg); }

/* ─── 11. Product Grid – body ──────────────────────────────────────────────── */

.awe-product-body {
  display:        flex;
  flex-direction: column;
  flex:           1;
  padding:        16px;
  gap:            8px;
}

.awe-product-title {
  font-size:     0.9375rem;
  font-weight:   600;
  line-height:   1.4;
  margin:        0;
  color:         var(--awe-text);
}

.awe-product-title a {
  text-decoration: none;
  color:           inherit;
  transition:      color var(--awe-transition);
}

.awe-product-title a:hover {
  color: var(--awe-primary);
}

.awe-product-rating {
  line-height: 1;
}

.awe-product-rating .star-rating {
  font-size: 0.7rem;
  color:     #fbbf24;
}

.awe-product-price {
  font-size:   0.9375rem;
  font-weight: 700;
  color:       var(--awe-text-price);
  margin-top:  auto;
}

.awe-product-price .woocommerce-Price-amount {
  color: inherit;
}

.awe-product-price del .woocommerce-Price-amount {
  font-weight: 400;
  color:       var(--awe-text-muted);
  font-size:   0.8125rem;
}

.awe-add-to-cart-btn {
  display:         block;
  width:           100%;
  text-align:      center;
  padding:         10px 16px;
  border-radius:   var(--awe-radius-sm);
  background:      var(--awe-primary);
  color:           #fff;
  font-size:       0.8125rem;
  font-weight:     700;
  letter-spacing:  0.04em;
  text-transform:  uppercase;
  text-decoration: none;
  border:          none;
  cursor:          pointer;
  transition:      background-color var(--awe-transition),
                   transform        var(--awe-transition),
                   box-shadow       var(--awe-transition);
  margin-top:      4px;
}

.awe-add-to-cart-btn:hover {
  background: var(--awe-primary-dark);
  transform:  translateY(-2px);
  box-shadow: 0 6px 20px rgba(91, 79, 207, 0.35);
  color:      #fff;
}

/* Tick icon on "added" state (WooCommerce native class) */
.awe-add-to-cart-btn.added::after {
  content:      ' ✓';
  font-weight:  900;
}

/* ─── 12. Product Grid – image hover effects ───────────────────────────────── */

/* Zoom */
.awe-product-image-wrap.hover-zoom .awe-product-image {
  transform-origin: center;
}

.awe-product-card:hover .awe-product-image-wrap.hover-zoom .awe-product-image {
  transform: scale(1.07);
}

/* Fade */
.awe-product-card:hover .awe-product-image-wrap.hover-fade .awe-product-image {
  opacity: 0.75;
}

/* ─── 13. Product Grid – loop template wrapper ─────────────────────────────── */

.awe-loop-item {
  width: 100%;
}

/* ─── 14. Utilities ─────────────────────────────────────────────────────────── */

.awe-no-products {
  text-align:  center;
  color:       var(--awe-text-muted);
  padding:     40px 20px;
  font-size:   0.9375rem;
}
