/* Course page – banner, sticky side card, lesson rows (ahmed-tarek.net style) */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--ts-bg); color: var(--ts-ink); font-family: var(--ts-font); direction: rtl; text-align: right; transition: background .3s, color .3s; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

/* notification + buy popup */
.notifi { position: fixed; top: -150px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; min-width: 220px; max-width: calc(100% - 32px); min-height: 56px; padding: 14px 22px; border-radius: 14px; box-shadow: 0 14px 34px rgba(0,0,0,.18); z-index: 200; }
.show-notifi { animation: notifiIn .6s ease-out forwards; }
.hide-notifi { animation: notifiOut .6s ease-in forwards; }
.notifi-message { color: #fff; font-weight: 700; font-size: 15px; text-align: center; }
.notifi.green { background: linear-gradient(135deg, var(--ts-primary-light), var(--ts-primary)); }
.notifi.red { background: linear-gradient(135deg, #ef4444, #dc2626); }
@keyframes notifiIn { from { top: -150px; } to { top: 18px; } }
@keyframes notifiOut { from { top: 18px; } to { top: -150px; } }
.backdrop { position: fixed; inset: 0; background: rgba(8,12,20,.5); backdrop-filter: blur(5px); z-index: 110; }
.popup-message { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); width: min(360px, calc(100% - 32px)); padding: 30px 26px 24px; border-radius: var(--ts-radius-lg); background: var(--ts-surface); color: var(--ts-ink); text-align: center; box-shadow: 0 24px 60px rgba(2,60,64,.28); }
.popup-message h2 { font-size: 19px; line-height: 1.6; }
.popup-message .buttons { display: flex; gap: 12px; margin-top: 22px; }
.popup-message .buttons button { flex: 1; padding: 12px 0; border: none; border-radius: var(--ts-radius); font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit; }
.popup-message .confirm-btn { background: var(--ts-primary); color: #fff; }
.popup-message .cancel-btn { background: var(--ts-surface-2); color: var(--ts-ink); }

/* layout: content on the right, sticky card on the left (RTL) */
.course-page {
  width: min(1480px, calc(100% - 32px));
  margin: 22px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 22px;
  align-items: start;
}
.course-content { display: flex; flex-direction: column; gap: 22px; grid-column: 1; grid-row: 1; }
.course-side { grid-column: 2; grid-row: 1; position: sticky; top: 110px; }

.course-side-card { background: var(--ts-surface); border: 1px solid var(--ts-line); border-radius: var(--ts-radius); overflow: hidden; }
.photo-frame { background: var(--ts-primary-tint); }
.course-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.course-side-body { padding: 20px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.price-row { display: flex; align-items: center; justify-content: space-between; }
.price-label { color: var(--ts-muted); font-weight: 700; }
.course-price { font-family: 'Segoe UI', Arial, sans-serif; font-size: 30px; font-weight: 900; color: var(--ts-primary); }
.course-price span { font-size: 14px; margin-inline-start: 4px; color: var(--ts-muted); }
body.page-dark-mode .course-price { color: #5fd3d6; }
.lessons-label { color: var(--ts-muted); font-size: 14px; }
.course-progress-box { padding: 12px 14px; border-radius: 10px; background: var(--ts-primary-tint); }
.cp-top { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; }
.cp-top strong { color: var(--ts-primary); }
.cp-bar { height: 8px; margin: 8px 0 6px; border-radius: 99px; background: rgba(2,127,133,.15); overflow: hidden; }
.cp-bar span { display: block; height: 100%; background: var(--ts-primary); border-radius: 99px; }
.course-progress-box small { color: var(--ts-muted); }
.course-btn-container { display: flex; flex-direction: column; gap: 10px; }
.course-btn {
  display: block; width: 100%; padding: 13px; border: none; border-radius: 8px;
  font-family: inherit; font-size: 16px; font-weight: 700; text-align: center; text-decoration: none; cursor: pointer;
  transition: background .2s, transform .2s;
}
.course-btn:hover { transform: translateY(-1px); }
.subscribe-btn { background: #d32f3c; color: #fff; }
.subscribe-btn:hover { background: #b9232f; }
.enter-course-btn { background: var(--ts-primary); color: #fff; }
.enter-course-btn:hover { background: var(--ts-primary-dark); }
.anki-course-btn { background: transparent; color: var(--ts-primary); border: 1.6px solid var(--ts-primary); }
.anki-course-btn:hover { background: var(--ts-primary-tint); }

.course-about p { color: var(--ts-ink); line-height: 2; white-space: pre-line; }

/* lessons */
.lessons-title { font-family: var(--ts-font-head); font-size: 30px; font-weight: 800; margin-bottom: 20px; }
.lessons-scroll { display: flex; flex-direction: column; gap: 12px; }
.lessons-empty { color: var(--ts-muted); padding: 10px 0; }
.course-lesson { border-radius: 12px; background: var(--ts-primary); color: #fff; overflow: hidden; }
body.page-dark-mode .course-lesson { background: #036b70; }
.course-lesson.disabledLesson { opacity: .75; }
.course-lesson-header {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 18px 22px;
  background: none; border: none; color: inherit; font-family: inherit; text-align: right; cursor: pointer;
}
.disabledLesson .course-lesson-header { cursor: default; }
.lesson-name-index { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.course-lesson-header .lesson-index {
  flex-shrink: 0; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: rgba(255,255,255,.18); font-weight: 800; font-size: 14px;
}
.lesson-title { font-weight: 700; font-size: 16.5px; }
.lesson-count { font-size: 13px; opacity: .85; white-space: nowrap; }
.lesson-arrow { font-size: 20px; line-height: 1; transition: transform .25s; }
.course-lesson.active .lesson-arrow { transform: rotate(180deg); }
.lesson-soon { padding: 6px 14px; border-radius: 8px; background: rgba(255,255,255,.2); font-size: 13px; font-weight: 700; white-space: nowrap; }
.lock-icon { flex-shrink: 0; opacity: .85; }

.course-lesson-content { display: none; background: var(--ts-surface); color: var(--ts-ink); }
.course-lesson.active .course-lesson-content { display: block; }
.lesson-list { list-style: none; padding: 6px 12px; }
.lesson-list li { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-bottom: 1px solid var(--ts-line); }
.lesson-list li:last-child { border-bottom: none; }
.lesson-list .lesson-index { color: var(--ts-muted); font-weight: 800; font-size: 13px; width: 26px; }
.lesson-name { flex: 1; font-weight: 600; }
.enter-lesson {
  padding: 7px 16px; border-radius: 8px; border: 1.5px solid var(--ts-primary);
  background: transparent; color: var(--ts-primary); font-family: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap;
}
.enter-lesson:hover { background: var(--ts-primary); color: #fff; }
body.page-dark-mode .enter-lesson { color: #5fd3d6; border-color: #5fd3d6; }
body.page-dark-mode .enter-lesson:hover { background: #5fd3d6; color: #080c14; }
.lesson-list .lock-icon { color: var(--ts-muted); }

@media (max-width: 1000px) {
  .course-page { grid-template-columns: 1fr; }
  .course-side { position: static; grid-column: 1; grid-row: 1; }
  .course-content { grid-row: 2; }
  .course-side-card { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .course-page { width: calc(100% - 20px); }
  .course-side-card { display: block; }
  .ts-card { padding: 20px 16px; }
  .course-lesson-header { padding: 14px 14px; }
  .lesson-count { display: none; }
}

/* course of the other track (علمي / أدبي): can't be bought */
.course-btn.track-locked { background: var(--border, #e5e7eb); color: var(--muted, #6b7280); cursor: not-allowed; box-shadow: none; }
.course-btn.track-locked:hover { transform: none; }

/* A4 tests of the course */
.course-tests-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.course-tests-head .lessons-title { margin-bottom: 12px; }
.course-tests-add { padding: 8px 16px; border-radius: 10px; background: var(--ts-primary); color: #fff; font-weight: 800; text-decoration: none; }
.course-tests-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.course-test-item { border: 1px solid var(--border, #e5e7eb); border-radius: 12px; overflow: hidden; }
.course-test-link { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: inherit; text-decoration: none; }
.course-test-link:hover { background: var(--ts-primary-tint); }
.course-test-icon { font-size: 22px; }
.course-test-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.course-test-info strong { font-size: 1.05rem; }
.course-test-info small { color: var(--muted, #6b7280); }
.course-test-state { padding: 3px 12px; border-radius: 999px; font-size: .82rem; font-weight: 800; white-space: nowrap; background: var(--ts-primary-tint); color: var(--ts-primary); }
.course-test-state.is-draft { background: #f3f4f6; color: #6b7280; }
.course-test-state.is-pending { background: #fff7e6; color: #b45309; }
.course-test-state.is-graded { background: #e8f8ee; color: #15803d; direction: ltr; }
.course-test-admin { display: flex; gap: 16px; padding: 8px 16px; border-top: 1px dashed var(--border, #e5e7eb); font-size: .88rem; font-weight: 700; }
.course-test-admin a { color: var(--ts-primary); }
