/* ═══════════════════════════════════════════════════════════════
   COURSES PAGE — Premium Redesign
   SGR NexZen Academy
═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --primary:        #003E94;
  --primary-dark:   #002d6e;
  --primary-glow:   rgba(0,62,148,0.15);
  --accent:         #FFA600;
  --accent-dark:    #e69500;
  --text-dark:      #00132d;
  --text-mid:       #3d5068;
  --text-gray:      #7a8fa6;
  --bg:             #f0f4fa;
  --white:          #ffffff;
  --border:         #e0e8f4;
  --success:        #10b981;
  --card-radius:    16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-dark);
}

/* ─── HERO BANNER ─────────────────────────────────────────── */
.courses-hero {
  position: relative;
  background: linear-gradient(135deg, #00132d 0%, #003E94 55%, #00132d 100%);
  padding: 130px 0 100px;
  text-align: center;
  overflow: hidden;
}

/* animated blob decorations */
.courses-hero::before,
.courses-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.courses-hero::before {
  width: 420px; height: 420px;
  top: -140px; right: -100px;
  background: radial-gradient(circle, rgba(255,166,0,0.18) 0%, transparent 70%);
}
.courses-hero::after {
  width: 300px; height: 300px;
  bottom: -80px; left: -60px;
  background: radial-gradient(circle, rgba(0,62,148,0.5) 0%, transparent 70%);
}

.courses-hero .container {
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,166,0,0.15);
  border: 1px solid rgba(255,166,0,0.3);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 20px;
}

.courses-hero h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 900;
  color: #fff;
  margin: 0 0 14px;
  letter-spacing: -0.5px;
  line-height: 1.15;
}

.courses-hero h1 span {
  color: var(--accent);
  position: relative;
}

.courses-hero p {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.7);
  max-width: 560px;
  margin: 0 auto 32px;
  line-height: 1.8;
}

/* Stats row in hero */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 36px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.hero-stat {
  text-align: center;
}
.hero-stat .val {
  display: block;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}
.hero-stat .lbl {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* ─── TOOLBAR (search + filter) ────────────────────────────── */
.courses-toolbar {
  max-width: 1200px;
  margin: -28px auto 0;
  padding: 0 20px;
  position: relative;
  z-index: 5;
}
.toolbar-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 32px rgba(0,62,148,0.1);
  padding: 18px 24px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar-search {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  transition: border 0.2s;
}
.toolbar-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.toolbar-search i { color: var(--text-gray); font-size: 0.9rem; }
.toolbar-search input {
  border: none; outline: none; background: none;
  font-size: 0.9rem; color: var(--text-dark); width: 100%;
}
.toolbar-count {
  font-size: 0.82rem;
  color: var(--text-gray);
  white-space: nowrap;
  font-weight: 600;
}

/* ─── COURSES GRID ─────────────────────────────────────────── */
.courses-container {
  max-width: 1200px;
  margin: 32px auto 80px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px;
}

/* ─── COURSE CARD ──────────────────────────────────────────── */
.course-card {
  background: var(--white);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0,62,148,0.07);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.3s cubic-bezier(.22,.68,0,1.2), box-shadow 0.3s ease;
  cursor: pointer;
}

.course-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 48px rgba(0,62,148,0.14);
}

/* top accent stripe */
.course-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity 0.3s;
}
.course-card:hover::before { opacity: 1; }

/* ── Thumbnail ── */
.course-thumb-wrap {
  position: relative;
  overflow: hidden;
}

.course-thumb {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}
.course-card:hover .course-thumb { transform: scale(1.04); }

/* gradient overlay on real image */
.course-thumb-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,19,45,0.35) 0%, transparent 60%);
}

/* animated gradient placeholder (when no thumbnail) */
.course-thumb-placeholder {
  width: 100%;
  height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #003E94 0%, #0052c2 50%, #00132d 100%);
  background-size: 200% 200%;
  animation: gradShift 6s ease infinite;
  color: white;
  text-align: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.course-thumb-placeholder::before {
  content: '';
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle at 70% 30%, rgba(255,166,0,0.2) 0%, transparent 60%);
}
@keyframes gradShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.course-thumb-placeholder i {
  font-size: 3rem;
  margin-bottom: 10px;
  opacity: 0.9;
  position: relative;
}
.course-thumb-placeholder span {
  font-weight: 700;
  font-size: 1rem;
  opacity: 0.85;
  position: relative;
  max-width: 200px;
  line-height: 1.4;
}

/* price badge floating on thumbnail */
.price-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: var(--accent);
  color: #00132d;
  font-weight: 900;
  font-size: 1rem;
  padding: 5px 14px;
  border-radius: 6px;
  z-index: 2;
  letter-spacing: -0.2px;
  box-shadow: 0 2px 10px rgba(255,166,0,0.4);
}

/* ── Card Body ── */
.course-content {
  padding: 22px 24px 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.course-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary-glow);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
  width: fit-content;
}

.course-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--text-dark);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-instructor {
  font-size: 0.85rem;
  color: var(--text-gray);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.course-instructor i { color: var(--accent); }

/* rating row */
.course-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.stars { color: var(--accent); font-size: 0.78rem; letter-spacing: 1px; }
.rating-text { font-size: 0.75rem; color: var(--text-gray); }

.course-desc {
  font-size: 0.88rem;
  color: var(--text-mid);
  line-height: 1.65;
  margin-bottom: 18px;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* meta chips */
.course-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f4f7fc;
  color: var(--text-mid);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}
.meta-chip i { color: var(--primary); }

/* ── Card Footer ── */
.course-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  gap: 10px;
}

.course-price {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.btn-enroll {
  background: linear-gradient(135deg, var(--primary) 0%, #0052c2 100%);
  color: var(--white);
  border: none;
  padding: 10px 22px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,62,148,0.25);
}

.btn-enroll:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,62,148,0.35);
}

/* ─── EMPTY / LOADING STATE ────────────────────────────────── */
.courses-loading {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-gray);
}
.courses-loading .spin-icon {
  width: 52px; height: 52px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.courses-empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-gray);
}
.courses-empty i { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }
.courses-empty p { font-size: 1rem; }

/* ─── MODAL (checkout / referral) ─────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,19,45,0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.checkout-modal {
  background: var(--white);
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
  overflow: hidden;
  transform: scale(0.94) translateY(16px);
  transition: transform 0.3s cubic-bezier(.22,.68,0,1.1);
}
.modal-overlay.active .checkout-modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #003E94, #002d6e);
  color: white;
}
.modal-header h3 { margin: 0; font-size: 1.1rem; font-weight: 700; color: white; }
.close-btn { background: none; border: none; font-size: 1.5rem; color: rgba(255,255,255,0.7); cursor: pointer; }
.close-btn:hover { color: white; }
.modal-body { padding: 24px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-mid); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 0.92rem; box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

.referral-box { display: flex; gap: 8px; }
.btn-apply {
  background: #f4f7fc; border: 1.5px solid var(--border);
  padding: 0 16px; border-radius: 8px; font-weight: 700; cursor: pointer;
  font-size: 0.85rem; white-space: nowrap; color: var(--primary);
  transition: all 0.2s;
}
.btn-apply:hover { background: var(--primary-glow); border-color: var(--primary); }

.price-summary {
  background: #f8faff; border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  padding: 16px 18px; border-radius: 8px; margin: 20px 0;
}
.price-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.92rem; }
.price-row.total {
  font-weight: 900; font-size: 1.15rem;
  border-top: 1px solid var(--border); padding-top: 10px;
  margin-top: 8px; margin-bottom: 0; color: var(--primary);
}
.discount-tag { color: var(--success); font-weight: 700; }

.btn-pay {
  width: 100%; background: linear-gradient(135deg, var(--accent) 0%, #ff8c00 100%);
  color: #00132d; border: none; padding: 15px;
  border-radius: 10px; font-size: 1rem; font-weight: 800;
  cursor: pointer; transition: all 0.25s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 16px rgba(255,166,0,0.3);
}
.btn-pay:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(255,166,0,0.4); }
.btn-pay:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.loader {
  border: 3px solid rgba(0,0,0,0.1); border-top: 3px solid #00132d;
  border-radius: 50%; width: 20px; height: 20px;
  animation: spin 0.8s linear infinite; display: none;
}

/* ─── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .courses-hero { padding: 110px 0 80px; }
  .courses-hero h1 { font-size: 2.2rem; }
  .courses-container { grid-template-columns: 1fr; margin-top: 24px; }
  .hero-stats { gap: 24px; }
  .toolbar-card { flex-direction: column; align-items: stretch; }
}
@media (max-width: 480px) {
  .courses-hero h1 { font-size: 1.8rem; }
  .course-footer { flex-direction: column; align-items: stretch; }
  .btn-enroll { justify-content: center; }
}
