/**
 * FLAZZA — صفحة تفاصيل مسابقة عامة (quiz-detail.php)
 * يعتمد على متغيرات home-discover.css
 */

:root {
  --qd-accent: var(--hd-purple);
}

.qd-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 16px 56px;
}

/* ─── بطاقة المحتوى ─── */
.qd-hero {
  position: relative;
  border-radius: var(--hd-radius-lg);
  overflow: hidden;
  border: 1px solid var(--hd-line);
  background: var(--hd-surface);
  box-shadow: var(--hd-shadow);
  margin-bottom: 24px;
}

.qd-hero::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--qd-accent, var(--hd-purple));
  z-index: 1;
  pointer-events: none;
}

/**
 * الإطار يكتسب ارتفاعه من الصورة الفعلية (لا aspect-ratio ولا max-height يكسرها)
 * مع حد أدنى وأقصى لطيف. الصورة تُعرض بنسبتها الأصلية بدون أي اقتطاع.
 */
.qd-cover {
  position: relative;
  overflow: hidden;
  background-color: var(--hd-surface, #f6f7fb);
}

/**
 * وضع الصورة الفعلية: نعرض الصورة كاملة بدون أي اقتطاع.
 * الإطار يأخذ ارتفاع الصورة عند العرض 100%، مع حد أعلى لطيف للشاشات الكبيرة.
 * نضع طبقة مموَّهة من نفس الصورة خلفها لملء الجوانب لو كانت الصورة مربعة.
 */
.qd-cover--photo {
  display: block;
}

.qd-cover--photo .qd-cover__bg {
  position: absolute;
  inset: 0;
  background-image: var(--qd-cover-url);
  background-size: cover;
  background-position: center;
  filter: blur(28px) saturate(1.05) brightness(0.85);
  transform: scale(1.15);
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}

.qd-cover--photo .qd-cover__img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  max-height: clamp(220px, 64vw, 520px);
  object-fit: contain;
  object-position: center;
  margin: 0 auto;
}

/* وضع الشعار الافتراضي: شعار FLAZZA في وسط حوض ثابت بأبعاد لطيفة */
.qd-cover--default-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: 280px;
  background-color: #ffffff !important;
  background-image: none;
  border-bottom: 1px solid var(--hd-line, #e7e9f1);
}

.qd-cover__img--logo {
  width: auto;
  height: auto;
  max-width: min(260px, 56%);
  max-height: min(146px, 58%);
  object-fit: contain;
  margin: auto;
  filter: drop-shadow(0 14px 36px rgba(22, 22, 42, 0.12));
}

/* تظليل سفلي خفيف فقط للأغلفة الفعلية (ليس على الشعار) */
.qd-cover__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.28) 100%);
}

.qd-body {
  padding: 26px 22px 30px;
}

.qd-body h1 {
  margin: 0 0 16px;
  font-size: clamp(1.25rem, 4vw, 1.55rem);
  font-weight: 800;
  color: var(--hd-text);
  letter-spacing: -0.02em;
  line-height: 1.35;
}

/* شارات المعلومات */
.qd-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

.qd-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--hd-text);
  background: linear-gradient(180deg, #f8f9fc 0%, #eef1f8 100%);
  border: 1px solid var(--hd-line);
  border-radius: 999px;
}

.qd-badge--accent {
  background: rgba(61, 29, 107, 0.06);
  border-color: rgba(61, 29, 107, 0.18);
  color: var(--hd-purple-deep);
}

/* الوصف */
.qd-desc-block {
  margin: 0 0 24px;
}

.qd-desc {
  margin: 0;
  color: var(--hd-text);
  font-size: 0.98rem;
  line-height: 1.8;
  white-space: pre-wrap;
}

.qd-desc--muted {
  color: var(--hd-muted);
}

.qd-desc-more {
  margin-top: 10px;
  border: 1px dashed var(--hd-line);
  border-radius: var(--hd-radius);
  padding: 0;
  background: #fafbfe;
}

.qd-desc-more summary {
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--hd-sky);
  list-style: none;
}

.qd-desc-more summary::-webkit-details-marker {
  display: none;
}

.qd-desc-more[open] summary {
  border-bottom: 1px solid var(--hd-line);
}

.qd-desc-more .qd-desc {
  padding: 14px 16px 16px;
}

/* أزرار */
.qd-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qd-actions__row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.qd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  border-radius: var(--hd-radius);
  border: 2px solid transparent;
  text-decoration: none;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.qd-btn:active {
  transform: scale(0.98);
}

.qd-btn--primary {
  background: linear-gradient(135deg, var(--hd-mint) 0%, var(--hd-mint-dark) 100%);
  color: #fff;
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.28);
}

.qd-btn--primary:hover {
  box-shadow: 0 10px 28px rgba(5, 150, 105, 0.35);
}

.qd-btn--secondary {
  background: var(--hd-surface);
  color: var(--hd-purple-deep);
  border-color: var(--hd-line);
  box-shadow: 0 2px 10px rgba(22, 22, 42, 0.06);
}

.qd-btn--secondary:hover {
  border-color: #c4b8dc;
  background: #faf9ff;
}

.qd-btn--session {
  background: linear-gradient(135deg, var(--hd-purple) 0%, var(--hd-purple-deep) 100%);
  color: #fff;
  box-shadow: 0 6px 22px rgba(61, 29, 107, 0.35);
}

.qd-btn--session:hover {
  box-shadow: 0 10px 28px rgba(61, 29, 107, 0.42);
}

.qd-actions__pin {
  padding: 12px 0 4px;
  border-top: 1px solid var(--hd-line);
}

.qd-actions__pin-label {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--hd-muted);
}

.qd-link-muted {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--hd-sky);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.qd-link-muted:hover {
  color: var(--hd-purple);
}

.qd-note {
  margin: 20px 0 0;
  padding: 12px 14px;
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--hd-muted);
  background: rgba(92, 92, 118, 0.06);
  border-radius: var(--hd-radius);
  border: 1px solid rgba(216, 220, 232, 0.85);
}

/* خطأ / فارغ */
.qd-error {
  text-align: center;
  padding: 40px 24px 48px;
  background: var(--hd-surface);
  border-radius: var(--hd-radius-lg);
  border: 1px solid var(--hd-line);
  box-shadow: var(--hd-shadow);
  max-width: 440px;
  margin: 0 auto;
}

.qd-error__icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 16px;
  opacity: 0.9;
}

.qd-error__title {
  margin: 0 0 10px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--hd-text);
}

.qd-error__msg {
  margin: 0 0 22px;
  color: var(--hd-muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

.qd-error__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  font-weight: 800;
  font-size: 0.92rem;
  color: #fff;
  background: linear-gradient(135deg, var(--hd-purple) 0%, var(--hd-purple-deep) 100%);
  border-radius: var(--hd-radius);
  box-shadow: 0 8px 24px rgba(61, 29, 107, 0.3);
}

.qd-back {
  text-align: center;
  margin-top: 24px;
}

.qd-back a {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--hd-sky);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.qd-back a:hover {
  color: var(--hd-purple);
}

@media (max-width: 480px) {
  .qd-body {
    padding: 22px 16px 26px;
  }

  .qd-actions__row {
    flex-direction: column;
    align-items: stretch;
  }

  .qd-btn {
    width: 100%;
  }
}
