/* ═══════════════════════════════════════════════════
   Reham Diva — Courses Explorer Widget
   ═══════════════════════════════════════════════════ */

/* ─── Reset ─────────────────────────────────────────── */
.reham-widget *,
.reham-widget *::before,
.reham-widget *::after { box-sizing: border-box; margin: 0; padding: 0; }

#reham-modal-overlay *,
#reham-modal-overlay *::before,
#reham-modal-overlay *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Variables ─────────────────────────────────────── */
.reham-widget {
  direction: rtl;
  font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;

  --rh-pink:        #C4507A;
  --rh-pink-soft:   #FBEAF0;
  --rh-pink-dark:   #72243E;
  --rh-border:      rgba(0,0,0,0.08);
  --rh-bg:          #ffffff;
  --rh-bg-soft:     #faf8f9;
  --rh-text:        #1a1a1a;
  --rh-muted:       #7a6e72;
  --rh-faint:       #b8afb3;
  --rh-radius:      14px;
  --rh-dur:         220ms;
}

/* ─── Tabs ───────────────────────────────────────────── */
.reham-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.reham-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 24px;
  border: 1.5px solid var(--rh-border);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--rh-muted);
  transition: all var(--rh-dur);
  white-space: nowrap;
  line-height: 1;
}
.reham-tab:hover {
  background: var(--rh-pink-soft);
  border-color: rgba(196,80,122,.4);
  color: var(--rh-pink-dark);
}
.reham-tab.active {
  background: var(--rh-pink);
  border-color: var(--rh-pink);
  color: #fff;
}
.reham-tab-count {
  font-size: 11px;
  font-weight: 700;
  opacity: .7;
  background: rgba(255,255,255,.25);
  padding: 1px 6px;
  border-radius: 10px;
}
.reham-tab:not(.active) .reham-tab-count {
  background: rgba(0,0,0,.06);
  color: inherit;
}

/* ─── Section label ──────────────────────────────────── */
.reham-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  color: var(--rh-faint);
  text-transform: uppercase;
  margin-bottom: 14px;
}

/* ─── Grid ───────────────────────────────────────────── */
.reham-courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

/* ─── Card ───────────────────────────────────────────── */
.reham-course-card {
  background: var(--rh-bg);
  border: 1.5px solid var(--rh-border);
  border-radius: var(--rh-radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--rh-dur), box-shadow var(--rh-dur), border-color var(--rh-dur);
  animation: rhFadeUp .35s ease both;
}
.reham-course-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(196,80,122,.12);
  border-color: rgba(196,80,122,.35);
}

/* Thumbnail */
.reham-thumb-wrap {
  position: relative;
  width: 100%;
  padding-top: 58%;
  overflow: hidden;
  background: var(--rh-bg-soft);
}
.reham-thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .45s ease;
}
.reham-course-card:hover .reham-thumb-img { transform: scale(1.06); }

.reham-thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, transparent 40%, rgba(114,36,62,.55));
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--rh-dur);
}
.reham-course-card:hover .reham-thumb-overlay { opacity: 1; }

.reham-play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rh-pink);
  transform: scale(.8);
  transition: transform var(--rh-dur);
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.reham-play-btn svg { width: 18px; height: 18px; margin-right: -2px; }
.reham-course-card:hover .reham-play-btn { transform: scale(1); }

.reham-card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.92);
  color: var(--rh-pink-dark);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(196,80,122,.15);
}

/* Card body */
.reham-card-body {
  padding: 13px 15px;
}
.reham-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--rh-text);
  line-height: 1.45;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
}
.reham-card-instructor {
  font-size: 12px;
  color: var(--rh-muted);
  margin-bottom: 10px;
}
.reham-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.reham-card-dur {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--rh-muted);
}
.reham-card-dur svg { width: 12px; height: 12px; opacity: .6; }
.reham-card-rating {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 700;
  color: #b07d10;
}
.reham-card-rating svg { width: 12px; height: 12px; color: #f0a500; }

/* ─── Loading / Empty ─────────────────────────────────── */
.reham-loading-grid,
.reham-empty {
  grid-column: 1 / -1;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--rh-faint);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.reham-spin svg {
  width: 28px; height: 28px;
  animation: rhSpin .7s linear infinite;
  color: var(--rh-pink);
}

/* ═══════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════ */
#reham-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  direction: rtl;
  font-family: 'Tajawal','Segoe UI',Tahoma,sans-serif;

  --rh-pink:      #C4507A;
  --rh-pink-soft: #FBEAF0;
  --rh-pink-dark: #72243E;
  --rh-border:    rgba(0,0,0,0.1);
  --rh-bg:        #ffffff;
  --rh-text:      #1a1a1a;
  --rh-muted:     #7a6e72;
}
#reham-modal-overlay.active { display: block; }

.reham-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 8, 14, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: rhFadeIn .25s ease both;
}

.reham-modal-box {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
}

.reham-modal-inner {
  pointer-events: all;
  width: 100%;
  max-width: 1100px;
  height: calc(100vh - 40px);
  background: var(--rh-bg);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 80px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.08);
  transform: translateY(30px) scale(.97);
  opacity: 0;
  transition: transform .28s cubic-bezier(.22,.68,0,1.2), opacity .25s ease;
}
.reham-modal-box.in .reham-modal-inner {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Topbar */
.reham-modal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rh-border);
  background: #faf8f9;
  flex-shrink: 0;
}

.reham-modal-course-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.reham-modal-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--rh-border);
  background: #f0ecee;
}

.reham-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--rh-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
  margin-bottom: 4px;
}

.reham-modal-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--rh-muted);
  flex-wrap: wrap;
}
.reham-modal-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.reham-modal-meta svg { width: 13px; height: 13px; opacity: .55; }

.reham-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.reham-modal-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--rh-pink-soft);
  color: var(--rh-pink-dark);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  border: 1px solid rgba(196,80,122,.2);
  transition: all .2s;
  white-space: nowrap;
}
.reham-modal-open-btn svg { width: 14px; height: 14px; }
.reham-modal-open-btn:hover {
  background: var(--rh-pink);
  color: #fff;
  border-color: var(--rh-pink);
}

.reham-modal-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--rh-border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rh-muted);
  transition: all .2s;
  flex-shrink: 0;
}
.reham-modal-close svg { width: 16px; height: 16px; }
.reham-modal-close:hover {
  background: var(--rh-pink-soft);
  border-color: rgba(196,80,122,.3);
  color: var(--rh-pink-dark);
}

/* Frame area */
.reham-modal-frame-wrap {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  background: #f7f5f6;
}

.reham-modal-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #a09098;
  font-size: 14px;
  z-index: 2;
  background: #f7f5f6;
}
.reham-modal-loading .reham-spin svg {
  width: 32px;
  height: 32px;
}

.reham-modal-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  opacity: 0;
  transition: opacity .3s ease;
  z-index: 1;
}

/* ─── Animations ─────────────────────────────────────── */
@keyframes rhFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes rhFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes rhSpin {
  to { transform: rotate(360deg); }
}

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 640px) {
  .reham-courses-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .reham-modal-box { padding: 0; align-items: flex-end; }
  .reham-modal-inner {
    height: 94vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }
  .reham-modal-box.in .reham-modal-inner { transform: translateY(0); }
  .reham-modal-title { max-width: 180px; font-size: 13px; }
  .reham-modal-open-btn span { display: none; }
  .reham-modal-open-btn { padding: 8px 10px; }
}
@media (max-width: 380px) {
  .reham-courses-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}
