* { box-sizing: border-box; }

body {
  padding: 0;
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  direction: rtl;
  background: #f0f2f5;
  color: #333;
}

header {
  background: linear-gradient(135deg, #cc0000 0%, #ff4444 100%);
  padding: 20px;
  text-align: center;
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

header h1 {
  margin: 0 0 16px 0;
  font-size: 1.9em;
}

.search-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-bar input {
  padding: 12px 20px;
  width: 420px;
  max-width: 90vw;
  border: none;
  border-radius: 25px;
  font-size: 16px;
  direction: rtl;
  outline: none;
  font-family: inherit;
}

.search-bar button {
  padding: 12px 28px;
  background: #ff6b00;
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.search-bar button:hover { background: #e05a00; }

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
}

.section-title {
  font-size: 1.4em;
  font-weight: bold;
  margin: 30px 0 16px;
  padding-right: 12px;
  border-right: 4px solid #cc0000;
  color: #222;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.product-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
}

.product-card img {
  width: 100%;
  height: 195px;
  object-fit: contain;
  padding: 10px;
  background: #fafafa;
}

.product-info {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-title {
  font-size: 13.5px;
  line-height: 1.45;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.product-price {
  font-size: 1.35em;
  font-weight: bold;
  color: #cc0000;
  margin-bottom: 3px;
}

.product-orig-price {
  font-size: 0.88em;
  color: #999;
  text-decoration: line-through;
  margin-bottom: 4px;
}

.product-discount {
  display: inline-block;
  background: #cc0000;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 7px;
}

.product-coupon {
  background: #fff8e1;
  border: 1px solid #ffca28;
  color: #7a5c00;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 12px;
  margin-bottom: 7px;
}

.product-meta {
  font-size: 11.5px;
  color: #888;
  margin-bottom: 8px;
}

.buy-btn {
  display: block;
  text-align: center;
  background: #cc0000;
  color: white;
  padding: 10px;
  border-radius: 7px;
  font-weight: bold;
  font-size: 14px;
  margin-top: auto;
  transition: background 0.2s;
}

.product-card:hover .buy-btn { background: #a80000; }

.loading {
  text-align: center;
  padding: 40px;
  font-size: 1.1em;
  color: #666;
  grid-column: 1 / -1;
}

.spinner {
  display: inline-block;
  width: 26px;
  height: 26px;
  border: 3px solid #eee;
  border-top: 3px solid #cc0000;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  vertical-align: middle;
  margin-left: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error-msg {
  text-align: center;
  color: #cc0000;
  padding: 20px;
  grid-column: 1 / -1;
}

#search-results-section { display: none; }

/* ── Recommendation header ──────────────────────────────── */
.rec-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px 8px;
  background: #f7f8fa;
  border-bottom: 1px solid #eee;
  position: relative;
}

.rec-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 16px;
  flex-shrink: 0;
}

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

.rec-name {
  font-weight: 700;
  font-size: 13.5px;
  color: #1a1a1a;
}

.rec-meta {
  font-size: 11px;
  color: #888;
  margin-top: 1px;
}

.rec-badge {
  font-size: 11.5px;
  color: #1877f2;
  margin-top: 3px;
  font-weight: 600;
}

.fb-follow-btn {
  flex-shrink: 0;
  background: #1877f2;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  align-self: center;
  transition: background 0.15s;
}

.fb-follow-btn:hover {
  background: #1558b0;
  color: white;
}

/* ── "Recommend a product" CTA banner ───────────────────── */
.rec-cta {
  background: linear-gradient(135deg, #1877f2 0%, #42a5f5 100%);
  color: white;
  text-align: center;
  padding: 18px 24px;
  border-radius: 12px;
  margin: 30px 0 10px;
}

.rec-cta p {
  margin: 0 0 10px;
  font-size: 15px;
}

.rec-cta a {
  display: inline-block;
  background: white;
  color: #1877f2;
  padding: 8px 22px;
  border-radius: 20px;
  font-weight: bold;
  text-decoration: none;
  font-size: 14px;
  transition: opacity 0.15s;
}

.rec-cta a:hover { opacity: 0.85; }

a { color: #cc0000; }
