/* ============================================================
   Compare Page — Dreamer Theme
   ============================================================ */

/* PAGE WRAPPER */
#product-compare {
  padding-bottom: 48px;
}

/* PAGE HEADER */
.compare-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin: 20px 0 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.compare-page-header__left {}

.compare-page-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 6px;
}

.compare-page-subtitle {
  font-size: 13px;
  color: #888;
  margin: 0;
}

.compare-page-header__right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.compare-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
}

.compare-action-btn .material-icons {
  font-size: 17px;
}

.compare-action-btn--icon {
  background: #fff;
  color: #333;
  border-color: #ddd;
}

.compare-action-btn--icon:hover {
  background: #f5f5f5;
}

.compare-action-btn--blue {
  background: #3535c8;
  color: #fff;
  border-color: #3535c8;
}

.compare-action-btn--blue:hover {
  background: #2828a8;
  border-color: #2828a8;
}

/* TABLE WRAPPER */
.compare-table-wrap {
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  background: #fff;
}

/* ============================================================
   GRID LAYOUT
   All rows use: 200px label col + 4 equal product cols
   ============================================================ */
.compare-product-row,
.compare-row {
  display: grid;
  grid-template-columns: 200px repeat(var(--compare-cols, 4), 1fr);
}

/* ============================================================
   PRODUCT SELECTION ROW (top)
   ============================================================ */
.compare-product-row {
  border-bottom: 2px solid #e8e8e8;
  border-radius: 8px 8px 0 0;
  overflow: visible;
}

.compare-label-col--header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
  background: #f8f8f8;
  border-right: 1px solid #e8e8e8;
  border-radius: 8px 0 0 0;
}

.compare-max-label {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-align: center;
  line-height: 1.6;
}

/* Product column (shared base) */
.compare-product-col {
  position: relative;
  padding: 16px 12px 20px;
  border-right: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.compare-product-col:last-child {
  border-right: none;
  border-radius: 0 8px 0 0;
}

/* Filled product column */
.compare-product-col--filled {}

/* Empty slot column */
.compare-product-col--empty {
  background: #fafafa;
  min-height: 220px;
}

/* Search row inside column */
.compare-col-search {
  position: relative;
  width: 100%;
}

.compare-search-input {
  width: 100%;
  padding: 8px 32px 8px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  color: #333;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.compare-search-input:focus {
  border-color: #3535c8;
  outline: none;
  box-shadow: 0 0 0 2px rgba(53, 53, 200, 0.08);
}

.compare-search-input[readonly] {
  background: #f5f5f5;
  cursor: default;
  color: #444;
}

.compare-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  padding: 0;
  display: flex;
  align-items: center;
  text-decoration: none;
  line-height: 1;
}

.compare-search-clear:hover {
  color: #ef4a23;
}

.compare-search-clear .material-icons {
  font-size: 17px;
}

/* Autocomplete dropdown */
.compare-col-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 9000;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.13);
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.compare-col-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background 0.12s;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}

.compare-col-dropdown-item:last-child {
  border-bottom: none;
}

.compare-col-dropdown-item:hover {
  background: #f5f5ff;
}

.compare-col-dropdown-thumb {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border: 1px solid #eee;
  border-radius: 3px;
  flex-shrink: 0;
}

.compare-col-dropdown-info {
  flex: 1;
  min-width: 0;
}

.compare-col-dropdown-name {
  color: #333;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compare-col-dropdown-price {
  font-size: 12px;
  color: #ef4a23;
  font-weight: 600;
  margin-top: 2px;
}

.compare-col-dropdown-empty {
  padding: 16px;
  text-align: center;
  color: #999;
  font-size: 13px;
}

/* Product image */
.compare-product-img-link {
  display: block;
}

.compare-product-img {
  width: 130px;
  height: 130px;
  object-fit: contain;
  border: 1px solid #eee;
  border-radius: 4px;
  background: #fafafa;
  padding: 6px;
}

/* Product name */
.compare-product-name {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  text-align: center;
  line-height: 1.45;
  display: block;
  text-decoration: none;
}

.compare-product-name:hover {
  color: #3535c8;
}

/* Price */
.compare-product-price {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.compare-price-special {
  font-size: 16px;
  font-weight: 700;
  color: #ef4a23;
}

.compare-price-original {
  font-size: 12px;
  color: #aaa;
  text-decoration: line-through;
}

.compare-price-regular {
  font-size: 16px;
  font-weight: 700;
  color: #ef4a23;
}

/* Placeholder text for empty slots */
.compare-placeholder-text {
  font-size: 12px;
  color: #bbb;
  text-align: center;
  padding: 16px 8px;
  line-height: 1.6;
  margin-top: auto;
}

.compare-placeholder-icon {
  display: block;
  font-size: 36px;
  color: #ddd;
  margin-bottom: 8px;
}

/* ============================================================
   COMPARISON DATA ROWS
   ============================================================ */
.compare-section {}

.compare-row {
  border-bottom: 1px solid #f0f0f0;
  min-height: 46px;
}

.compare-row:last-child {
  border-bottom: none;
}

.compare-row--actions {
  border-top: 2px solid #e8e8e8;
  border-bottom: none;
  border-radius: 0 0 8px 8px;
}

.compare-row--actions .compare-label-col {
  border-radius: 0 0 0 8px;
}

.compare-label-col {
  padding: 13px 16px;
  background: #f8f8f8;
  border-right: 1px solid #e8e8e8;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  display: flex;
  align-items: center;
}

.compare-value-col {
  padding: 13px 12px;
  border-right: 1px solid #f0f0f0;
  font-size: 13px;
  color: #333;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.compare-value-col:last-child {
  border-right: none;
}

.compare-value-col--empty {
  background: #fafafa;
}

.compare-value--highlight {
  color: #ef4a23;
  font-weight: 600;
}

.compare-value--summary {
  font-size: 12px;
  color: #555;
  align-items: flex-start;
  line-height: 1.6;
}

/* Stars */
.compare-stars {
  display: flex;
  align-items: center;
  gap: 1px;
}

.compare-star {
  font-size: 17px;
  color: #ddd;
}

.compare-star--filled {
  color: #f5a623;
}

.compare-reviews {
  font-size: 11px;
  color: #888;
  width: 100%;
  display: block;
  margin-top: 2px;
}

/* ============================================================
   ATTRIBUTE GROUP SECTIONS (collapsible)
   ============================================================ */
.compare-attr-group {}

.compare-attr-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #3535c8;
  color: #fff;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.15s;
}

.compare-attr-group-header:hover {
  background: #2828a8;
}

.compare-attr-group-name {
  font-size: 13px;
  font-weight: 700;
}

.compare-chevron {
  font-size: 20px;
  color: rgba(255, 255, 255, 0.8);
  transition: transform 0.2s;
}

/* Collapsed state */
.compare-attr-group.collapsed .compare-chevron {
  transform: rotate(180deg);
}

.compare-attr-group.collapsed .compare-attr-group-body {
  display: none;
}

/* ============================================================
   BUY NOW BUTTON
   ============================================================ */
.compare-buy-btn {
  width: 100%;
  background: #3535c8;
  color: #fff;
  border: none;
  padding: 11px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.compare-buy-btn:hover {
  background: #2828a8;
}

/* ============================================================
   EMPTY STATE (no products)
   ============================================================ */
.compare-empty {
  text-align: center;
  padding: 64px 20px;
  color: #999;
}

.compare-empty .material-icons {
  font-size: 64px;
  color: #ddd;
  display: block;
  margin-bottom: 16px;
}

.compare-empty p {
  font-size: 15px;
  margin-bottom: 24px;
  color: #666;
}

.compare-continue-btn {
  display: inline-block;
  padding: 12px 28px;
  background: #3535c8;
  color: #fff;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.2s;
}

.compare-continue-btn:hover {
  background: #2828a8;
}

/* ============================================================
   COMPARE PICKER CARD  (cpk-*)  — empty state
   ============================================================ */

.cpk-wrap {
  display: flex;
  justify-content: center;
  padding: 56px 16px 72px;
}

.cpk-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 36px 32px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.09);
}

.cpk-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 8px;
}

.cpk-sub {
  font-size: 13px;
  color: #666;
  margin: 0 0 22px;
  line-height: 1.55;
}

/* ── Search field ── */
.cpk-field {
  position: relative;
  margin-bottom: 12px;
  text-align: left;
}

.cpk-input-row {
  position: relative;
}

.cpk-text {
  display: block;
  width: 100%;
  padding: 12px 40px 12px 14px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #333;
  background: #fff;
  box-sizing: border-box;
  box-shadow: 0 1px 6px rgba(0,0,0,0.09);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cpk-text::placeholder {
  color: #bbb;
}

.cpk-text:focus {
  border-color: #3535c8;
  box-shadow: 0 0 0 3px rgba(53,53,200,0.10);
}

.cpk-text.cpk-selected {
  border-color: #3535c8;
  background: #f5f5ff;
}

.cpk-icon {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: #999;
  pointer-events: none;
  line-height: 1;
}

/* ── Dropdown ── */
.cpk-drop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 9999;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.13);
  max-height: 270px;
  overflow-y: auto;
  overflow-x: hidden;
}

.cpk-drop-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #f3f3f3;
  transition: background 0.1s;
}

.cpk-drop-item:last-child {
  border-bottom: none;
}

.cpk-drop-item:hover {
  background: #eef2ff;
}

.cpk-drop-thumb {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border: 1px solid #eee;
  border-radius: 5px;
  flex-shrink: 0;
  background: #fafafa;
}

.cpk-drop-thumb-ph {
  width: 38px;
  height: 38px;
  border: 1px solid #eee;
  border-radius: 5px;
  flex-shrink: 0;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-size: 18px;
}

.cpk-drop-info {
  flex: 1;
  min-width: 0;
}

.cpk-drop-name {
  color: #1a1a1a;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cpk-drop-price {
  font-size: 12px;
  color: #ef4a23;
  font-weight: 600;
  margin-top: 2px;
}

.cpk-drop-empty {
  padding: 18px;
  text-align: center;
  color: #aaa;
  font-size: 13px;
}

/* ── View Comparison button ── */
.cpk-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 13px 20px;
  background: transparent;
  color: #3535c8;
  border: 2px solid #3535c8;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s, color 0.15s;
}

.cpk-btn:hover {
  background: #3535c8;
  color: #fff;
}

.cpk-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: transparent;
  color: #3535c8;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1199px) {
  .compare-product-row,
  .compare-row {
    grid-template-columns: 160px repeat(var(--compare-cols, 4), 1fr);
  }

  .compare-label-col--header {
    min-width: 160px;
  }
}

@media (max-width: 767px) {
  .compare-table-wrap {
    overflow-x: auto;
  }

  .compare-product-row,
  .compare-row {
    grid-template-columns: 120px repeat(var(--compare-cols, 4), minmax(150px, 1fr));
    min-width: 740px;
  }

  .compare-page-header {
    flex-direction: column;
  }

  .compare-page-header__right {
    width: 100%;
    justify-content: flex-start;
  }
}


/* ============================================================
   PRINT / PDF EXPORT
   ============================================================ */
@page {
  size: A4 portrait;
  margin: 12mm;
}

@media print {
  html, body {
    background: #fff !important;
  }

  #product-compare {
    padding-bottom: 0;
  }

  .compare-page-header__right,
  .compare-search-clear,
  .compare-col-dropdown,
  .compare-buy-btn,
  .compare-action-btn,
  .breadcrumb {
    display: none !important;
  }

  .compare-table-wrap {
    border: none;
    border-radius: 0;
  }

  .compare-page-title {
    font-size: 18px;
  }

  .compare-page-subtitle {
    color: #666;
  }

  .compare-product-row,
  .compare-row {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .compare-product-col,
  .compare-label-col--header,
  .compare-label-col,
  .compare-value-col {
    box-shadow: none !important;
    background: #fff !important;
    border-color: #ddd !important;
  }
}
