/* ==========================================================================
   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;
}

/* ==========================================================================
   Collection Comparison Table (standalone collection page)
   ========================================================================== */

.opt-collection-comparison {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
}
.opt-collection-comparison th,
.opt-collection-comparison td {
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: top;
}
.opt-collection-comparison thead th {
  background: #f8f8f8;
  font-weight: 700;
}
.opt-feature-col { width: 25%; }
.opt-product-col  { width: 25%; }
.opt-section-header td {
  background: #f0f0f0;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85em;
  letter-spacing: 0.5px;
}
.opt-collection-comparison tbody tr:nth-child(even):not(.opt-section-header):not(.opt-product-images):not(.opt-actions) {
  background: #fafafa;
}
.opt-product-images img {
  max-width: 150px;
  height: auto;
}
.opt-price { font-weight: 700; }
.opt-sale   { text-decoration: line-through; color: #999; margin-left: 6px; font-weight: 400; }
.opt-view-btn {
  display: inline-block;
  padding: 8px 16px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
  margin-bottom: 8px;
}
.opt-view-btn:hover { background: #e9e9e9; }
.opt-actions td { padding-top: 20px; }

@media (max-width: 768px) {
  .opt-collection-comparison,
  .opt-collection-comparison thead,
  .opt-collection-comparison tbody,
  .opt-collection-comparison th,
  .opt-collection-comparison td,
  .opt-collection-comparison tr { display: block; }
  .opt-collection-comparison thead { display: none; }
  .opt-collection-comparison td {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid #eee;
  }
  .opt-collection-comparison td::before {
    content: attr(data-label);
    font-weight: 600;
    margin-right: 12px;
    min-width: 120px;
  }
  .opt-section-header td::before { content: none; }
  .opt-section-header td { justify-content: flex-start; }
  .opt-product-col { border-top: 2px solid #333; }
}

/* ==========================================================================
   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;
  }
}
