/* ==========================================================================
   Optimasi Product Rewrites - Default Styles
   ==========================================================================
   These defaults ship with the plugin so rewritten products always have
   sensible base styling.  Themes can override any rule by targeting the
   same selector with higher specificity.
   ========================================================================== */

/* -- Custom tab containers ------------------------------------------------- */

.optimasi-tab-container {
    min-height: 160px;
    padding: 0 !important;
}

/* Remove the renderer's description-context padding/margin on opt-* blocks
   when they appear inside one of our tab containers. */
.optimasi-tab-container div[class^="opt-"],
.optimasi-tab-container div[class*=" opt-"] {
    padding-top: 0 !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
}

/* Section headings inside our tab panels use <h3> (the renderer's standard),
   flush with the top of the tab panel. */
.optimasi-tab-container h3 {
    margin-top: 0 !important;
}

/* Additional Q&As subheading - inline gap answers appended to FAQ block. */
.opt-cki-qa-inline-heading {
    margin-top: 20px !important;
    font-weight: 600 !important;
}

/* -- Product title wrapper --------------------------------------------------
   Added by an inline script in wp_footer for rewritten products only.
   Ensures the title remains visible even when theme CSS hides it. */

.opt-primary-title h1.product_title {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    clip: auto !important;
    overflow: visible !important;
    height: auto !important;
    width: auto !important;
    position: static !important;
    font-size: 1.3em !important;
    margin-top: 30px !important;
}

/* -- Global trust content block ---------------------------------------------
   Injected into the product description by the backend during publish. */

.opt-trust {
    padding-top: 1.5em;
}
.opt-trust h2,
.opt-trust h3 {
    font-size: 1em;
    margin-bottom: 0.5em;
}
.opt-trust p {
    margin-bottom: 0.5em;
    line-height: 1.6;
}
.opt-trust li {
    font-size: 0.9em;
}

/* ==========================================================================
   Product Reviews Summary
   ========================================================================== */

.opt-reviews-summary {
    margin-top: 1.5em;
}

.opt-reviews-headline {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 1em;
}

.opt-reviews-section {
    margin-bottom: 1.5em;
}

.opt-reviews-section h3 {
    font-size: 1em;
    margin-bottom: 0.5em;
    color: #444;
}

.opt-reviews-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5em;
    margin-bottom: 0.75em;
}

.opt-reviews-stat {
    text-align: center;
    min-width: 80px;
}

.opt-reviews-stat-value {
    display: block;
    font-size: 1.4em;
    font-weight: 700;
    color: #2a7d2a;
    line-height: 1.2;
}

.opt-reviews-stat-label {
    display: block;
    font-size: 0.75em;
    color: #666;
    margin-top: 0.2em;
}

.opt-reviews-narrative {
    line-height: 1.6;
    margin-bottom: 0.75em;
}

.opt-reviews-trend {
    font-size: 0.9em;
    color: #555;
    font-style: italic;
    margin-top: 0.5em;
}

.opt-reviews-attribution {
    font-size: 0.75em;
    color: #888;
    margin-top: 1em;
    padding-top: 0.75em;
    border-top: 1px solid #eee;
}

/* ==========================================================================
   Collection Pages — v2 Card-Based Layout
   ========================================================================== */

/* -- Title & Intro --------------------------------------------------------- */
.opt-coll-title {
  font-size: 2rem !important;
  margin-bottom: 1.5rem;
  line-height: 1.3;
}
.opt-coll-intro {
  margin-bottom: 2rem;
  font-size: 1.05em;
  line-height: 1.7;
}
.opt-coll-section-title {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

/* -- Showcase Grid --------------------------------------------------------- */
.opt-coll-showcase {
  margin: 2.5rem 0;
}
.opt-coll-showcase__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.opt-coll-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
  transition: box-shadow 0.2s, transform 0.2s;
}
.opt-coll-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}
.opt-coll-card__image-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 6px;
  margin-bottom: 1rem;
  background: #f5f5f5;
}
.opt-coll-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.opt-coll-card__name {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.35rem 0;
}
.opt-coll-card__price {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: #2a7d2a;
  margin-bottom: 0.75rem;
}
.opt-coll-card__blurb {
  font-size: 0.9em;
  color: #555;
  line-height: 1.5;
  margin-bottom: 1rem;
  min-height: 2.7em;
}
.opt-coll-card__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.opt-coll-card__actions .button {
  width: 100%;
  text-align: center;
}

/* -- Buttons --------------------------------------------------------------- */
.opt-coll-btn {
  display: inline-block;
  padding: 10px 20px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 4px;
  text-align: center;
  transition: opacity 0.2s;
}
.opt-coll-btn:hover { opacity: 0.85; }
.opt-coll-btn--view {
  background: #f0f0f0;
  color: #333;
  border: 1px solid #ccc;
}
.opt-coll-btn--view:hover { background: #e4e4e4; }

/* -- Product Reviews (vertical stack) --------------------------------------- */
.opt-coll-review {
  margin: 3rem 0;
  padding: 2rem;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  background: #fafafa;
  text-align: center;
}
.opt-coll-review__name {
  margin: 0 0 1.25rem 0;
  font-size: 1.5rem;
  font-weight: 700;
}
.opt-coll-review__image-wrap {
  width: 100%;
  max-width: 400px;
  margin: 0 auto 1.5rem auto;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f0f0;
}
.opt-coll-review__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.opt-coll-review__summary {
  max-width: 700px;
  margin: 0 auto 1.5rem auto;
  font-size: 1.05em;
  line-height: 1.6;
  color: #444;
}
.opt-coll-review__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  text-align: left;
}
.opt-coll-review__section {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  padding: 1rem 1.25rem;
}
.opt-coll-review__section-title {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
}
.opt-coll-review__list {
  margin: 0;
  padding-left: 1.25rem;
  list-style: disc;
}
.opt-coll-review__list li {
  margin-bottom: 0.35rem;
  line-height: 1.5;
  font-size: 0.95em;
}
.opt-coll-review__section--specs {
  text-align: left;
  margin-bottom: 1.25rem;
}
.opt-coll-review__specs-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: center;
}
.opt-coll-review__spec {
  font-size: 0.9em;
  line-height: 1.6;
}
.opt-coll-review__footer {
  margin-top: 0.5rem;
}
.opt-coll-review__price {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: #2a7d2a;
  margin-bottom: 0.75rem;
}
.opt-coll-review__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* -- FAQ ------------------------------------------------------------------- */
.opt-coll-faq {
  margin: 1rem 0;
}
.opt-coll-faq__item {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}
.opt-coll-faq__q {
  margin: 0 0 0.35rem 0;
}
.opt-coll-faq__a {
  margin: 0;
  line-height: 1.6;
  color: #444;
}

/* -- Verdict --------------------------------------------------------------- */
.opt-coll-verdict {
  background: #f8f8f8;
  border-left: 4px solid #2271b1;
  padding: 1.25rem 1.5rem;
  border-radius: 0 6px 6px 0;
  margin: 1.5rem 0;
  line-height: 1.7;
}

/* -- Responsive ------------------------------------------------------------ */
@media (max-width: 768px) {
  .opt-coll-showcase__grid {
    grid-template-columns: 1fr;
  }
  .opt-coll-review__grid {
    grid-template-columns: 1fr;
  }
  .opt-coll-review__header {
    flex-direction: column;
    text-align: center;
  }
  .opt-coll-title {
    font-size: 1.5rem !important;
  }
}
@media (min-width: 769px) and (max-width: 1024px) {
  .opt-coll-showcase__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   Collection Block (product-page inline grid)
   ========================================================================== */

.opt-collection-block {
  margin: 2.5rem 0;
  padding: 1.5rem;
  background: #fafafa;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
}
.opt-collection-block__heading {
  font-size: 1.25rem;
  margin: 0 0 1.25rem 0;
  text-align: center;
}
.opt-collection-block__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}
.opt-collection-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 1rem;
  text-align: center;
  transition: box-shadow 0.2s;
}
.opt-collection-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.opt-collection-card--current {
  border-color: #2271b1;
  background: #f0f6fc;
}
.opt-collection-card__image {
  max-width: 120px;
  height: auto;
  margin-bottom: 0.75rem;
}
.opt-collection-card__name {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}
.opt-collection-card__price {
  display: block;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.opt-collection-card__link {
  display: block;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
.opt-collection-block__view-all {
  display: block;
  text-align: center;
  margin-top: 1.25rem;
  font-weight: 600;
}

@media (max-width: 480px) {
  .opt-collection-block__grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .opt-collection-card__image {
    max-width: 80px;
  }
}
