/* ===== COMPARISON PAGE ===== */

/* Hero */
.comparison-hero {
  width: 100%;
  height: 188px;
  border-bottom: 1px solid #e2e8f0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.comparison-hero img {
  width: 100%;
  height: 188px;
  object-fit: contain;
  display: block;
}

/* Content wrapper */
.comparison-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 42px;
  padding: 48px 80px;
  width: 100%;
  box-sizing: border-box;
  direction: rtl;
}

/* Title */
#comparison-title {
  font-size: 30px;
  font-weight: 700;
  color: #002363;
  text-align: center;
  line-height: 36px;
  margin: 0;
}

/* Form */
.comparison-form {
  width: 920px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Dropdowns */
.figma-select {
  width: 100%;
  height: 52px;
  border: 1px solid #d4d4d4;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 18px;
  font-weight: 500;
  color: #8f8f8f;
  background: white;
  direction: rtl;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9L12 15L18 9' stroke='%23002363' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 16px center;
  cursor: pointer;
}
.figma-select:focus { outline: none; border-color: #002f87; }

/* dropdowns قابلة للبحث (نوع الجهاز + المنتجين) — full-width */
.comparison-controls { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.comparison-controls > .comparison-field { width: 100%; }
.comparison-field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.comparison-field__label { font-size: 14px; font-weight: 700; color: #002363; }
.comparison-controls .comparison-product-row { width: 100%; height: auto; align-items: center; gap: 24px; }
.comparison-product-row .comparison-field { flex: 1; }
.comparison-dd { width: 100%; max-width: none; }
.comparison-dd .plp-dd__toggle { height: 60px; font-size: 18px; border-color: #d4d4d4; color: #002363; }
.comparison-dd .plp-dd__panel { max-height: 340px; }
@media (max-width: 640px) { .comparison-controls .comparison-product-row { flex-direction: column; align-items: stretch; } }

/* VS row */
.comparison-product-row {
  display: flex;
  align-items: center;
  gap: 48px;
  height: 64px;
}
.comparison-product-row .figma-select {
  flex: 1;
  height: 64px;
}
.comparison-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: #002f87;
  border-radius: 50%;
  flex-shrink: 0;
}
.comparison-vs span {
  color: white;
  font-size: 14px;
  font-weight: 700;
}

/* Table */
.comparison-table-scroll { width: 100%; overflow-x: auto; }
.comparison-table {
  display: flex;
  width: 100%;
  direction: rtl;
}

/* Labels column */
.comparison-labels {
  width: 190px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.comparison-label {
  height: 76px;
  display: flex;
  align-items: center;
  padding: 24px 0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 20px;
  font-weight: 700;
  color: #002363;
}
.comparison-label:last-child { border-bottom: none; }

/* Product columns */
.comparison-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.comparison-cell {
  height: 76px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 8px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 16px;
  font-weight: 500;
  color: #1a1a1a;
  text-align: center;
  box-sizing: border-box;
}
.comparison-cell:last-of-type { border-bottom: none; }

/* CTA button — navy pill, full width of its column, matches .fp-cta */
.comparison-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  width: 100%;
  min-height: 52px;
  background: #1d3d7c;
  border-radius: 99px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  margin-top: 16px;
  padding: 12px 24px;
  box-sizing: border-box;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.comparison-cta:hover { background: #16305f; color: #fff; box-shadow: 0 6px 16px rgba(29, 61, 124, 0.25); }
.comparison-cta:focus-visible { outline: 2px solid #d4af37; outline-offset: 2px; }
.comparison-cta.is-loading { opacity: 0.6; pointer-events: none; }

/* Mobile */
@media (max-width: 768px) {
  .comparison-content { padding: 24px 16px; gap: 24px; }
  .comparison-form { width: 100%; }
  .comparison-hero { height: 160px; }
  /* task-18: البانر كان بيظهر صغير (contain) — نخليه يملا العرض على الموبايل */
  .comparison-hero img { height: 160px; width: 100%; object-fit: cover; object-position: center; }
  .comparison-product-row { gap: 16px; }
  .comparison-labels { width: 120px; }
  .comparison-label { font-size: 14px; }
  .comparison-cell { font-size: 13px; padding: 12px 4px; }
  .comparison-cta { width: 100%; font-size: 16px; }
  #comparison-title { font-size: 22px; }
}

/* Step 5 — mobile swipe between product columns: scroll-snap + sticky labels.
   Columns take ~58% so the next one peeks (a built-in swipe affordance). */
@media (max-width: 767px) {
  .comparison-table-scroll {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-padding-inline-start: 124px;
  }
  .comparison-labels {
    position: sticky;
    inset-inline-start: 0;
    z-index: 2;
    width: 124px;
    background: #fff;
  }
  .comparison-label { font-size: 14px; }
  .comparison-column {
    flex: 0 0 58%;
    min-width: 58%;
    scroll-snap-align: start;
  }
  .comparison-cell { font-size: 14px; }
}

/* ===== TASK comparison — empty 2nd column + mobile table robustness ===== */
/* أعمدة متساوية حتى لو واحد فاضي (مايختفيش) */
.comparison-column { flex: 1 1 0; min-width: 0; }

/* العمود التاني لما مفيش منتج مختار: يفضل ظاهر بوضوح مع رسالة */
.comparison-column--empty { position: relative; }
.comparison-column--empty .comparison-cell { color: #cbd5e1; }
.comparison-column__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: #64748b;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.6;
  background: rgba(248, 250, 252, 0.9);
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
}

/* موبايل: اتأكد إن الجدول دايمًا ظاهر تحت الـ dropdowns مع سكروول أفقي */
@media (max-width: 767px) {
  .comparison-table-scroll { display: block; overflow-x: auto; width: 100%; }
  .comparison-table { width: 100%; }
  .comparison-column--empty { flex: 0 0 58%; min-width: 58%; }
  .comparison-column__placeholder { font-size: 14px; padding: 16px; }
}
