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

* { box-sizing: border-box; }

:root {
  --ink: #16273F;
  --body: #5B6675;
  --muted: #8791A0;
  --muted3: #98A2B0;
  --axis: #A2ABBA;
  --card-border: #EAEDF3;
  --input-border: #E4E9F1;
  --btn-border: #E4E8EF;
  --red: #E8402A;
  --link: #2F6FE0;
  --link-hover: #1E56C0;
}

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: "Mulish", system-ui, sans-serif;
  color: var(--body);
  background: linear-gradient(180deg, #F5F3FB 0%, #F1F6F6 100%);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
input::placeholder { color: var(--axis); }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
body.auth-pending .app-shell { display: none; }

.app-shell .rm-header-inner,
.app-shell .rm-footer-inner { max-width: 90%; }

@keyframes rsFadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ------------------------------- Hero ------------------------------- */
.rs-hero-inner { max-width: 90%; margin: 0 auto; padding: 32px 32px 8px; }
.rs-title {
  font-family: "Lexend", sans-serif;
  font-weight: 700;
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: -0.5px;
  color: var(--ink);
  margin: 0 0 6px;
}
.rs-subtitle { font-size: 15.5px; color: var(--muted); margin: 0; }

/* ------------------------------- Filter bar ------------------------------- */
.rs-filterbar-inner {
  max-width: 90%;
  width: 100%;
  margin: 0 auto;
  padding: 24px 32px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.rs-cats {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--btn-border);
  border-radius: 12px;
  padding: 5px;
  box-shadow: 0 1px 2px rgba(18, 38, 63, 0.05);
}
.rs-cat {
  appearance: none;
  background: transparent;
  border: none;
  border-radius: 9px;
  font-family: "Lexend", sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--body);
  padding: 10px 20px;
}
.rs-cat.active { color: #fff; background: var(--ink); }
.rs-cat:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.rs-filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rs-search-wrap { position: relative; }
.rs-search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); display: flex; pointer-events: none; }
.rs-search {
  width: 260px;
  height: 46px;
  padding: 0 16px 0 40px;
  font-family: "Mulish", sans-serif;
  font-size: 14.5px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--input-border);
  border-radius: 11px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.rs-search:focus { border-color: var(--link); box-shadow: 0 0 0 4px rgba(47, 111, 224, 0.12); }
.rs-select-wrap { position: relative; }
.rs-select {
  height: 46px;
  padding: 0 40px 0 16px;
  font-family: "Mulish", sans-serif;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--input-border);
  border-radius: 11px;
  outline: none;
  appearance: none;
  cursor: pointer;
}
.rs-select:focus { border-color: var(--link); box-shadow: 0 0 0 4px rgba(47, 111, 224, 0.12); }
.rs-select-caret { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; display: flex; }

/* ------------------------------- Main / grid ------------------------------- */
.rs-main { flex: 1; max-width: 90%; width: 100%; margin: 0 auto; padding: 22px 32px 56px; }
.rs-count { font-size: 13.5px; color: var(--muted); margin-bottom: 18px; }
.rs-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }

/* ------------------------------- Card ------------------------------- */
.rs-card {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(18, 38, 63, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  animation: rsFadeUp 0.28s ease both;
  transition: box-shadow .15s, transform .15s;
}
.rs-card:hover { box-shadow: 0 10px 26px rgba(18, 38, 63, 0.10); transform: translateY(-2px); }
.rs-card:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.rs-thumb { position: relative; height: 150px; display: flex; align-items: center; justify-content: center; }
.rs-thumb-glyph { width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.rs-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: "Lexend", sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #fff;
  border-radius: 7px;
  padding: 4px 10px;
}

.rs-cardbody { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.rs-meta-row { display: flex; align-items: center; gap: 8px; }
.rs-cat-label { font-family: "Lexend", sans-serif; font-weight: 700; font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted3); }
.rs-dot { width: 3px; height: 3px; border-radius: 50%; background: #C2CBD8; flex: 0 0 auto; }
.rs-product { font-family: "Lexend", sans-serif; font-weight: 600; font-size: 12px; }
.rs-card-title { font-family: "Lexend", sans-serif; font-weight: 700; font-size: 16.5px; color: var(--ink); margin: 9px 0 0; line-height: 1.3; letter-spacing: -0.2px; }
.rs-card-desc { font-family: "Mulish", sans-serif; font-size: 13.5px; line-height: 1.55; color: var(--body); margin: 9px 0 0; flex: 1; }
.rs-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.rs-card-meta { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.rs-cta { display: inline-flex; align-items: center; gap: 6px; font-family: "Lexend", sans-serif; font-weight: 700; font-size: 13px; color: var(--link); }
.rs-cta svg { stroke: var(--link); }

/* ------------------------------- Empty ------------------------------- */
.rs-empty { background: #fff; border: 1px dashed #D5DDE8; border-radius: 18px; padding: 56px; text-align: center; }
.rs-empty-title { font-family: "Lexend", sans-serif; font-weight: 700; font-size: 17px; color: var(--ink); }
.rs-empty-sub { font-size: 14px; color: var(--muted); margin-top: 6px; }

/* ------------------------------- Detail view ------------------------------- */
.rs-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  font-family: "Lexend", sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  padding: 0;
  margin-bottom: 18px;
}
.rs-back:hover { color: var(--ink); }
.rs-detail {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(18, 38, 63, 0.05);
  padding: 34px 40px 40px;
  animation: rsFadeUp 0.3s ease both;
}
.rs-detail .detail-head { margin-bottom: 20px; }
.rs-detail .res-product { font-family: "Lexend", sans-serif; font-weight: 600; font-size: 12.5px; color: var(--muted3); text-transform: uppercase; letter-spacing: 0.4px; }
.rs-detail h1 { font-family: "Lexend", sans-serif; font-weight: 700; font-size: 30px; color: var(--ink); margin: 8px 0 4px; letter-spacing: -0.4px; }
.rs-detail .detail-meta { font-size: 14px; color: var(--muted); margin: 0; }
.rs-detail .detail-actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.rs-detail .primary-button {
  display: inline-flex; align-items: center; font-family: "Lexend", sans-serif; font-weight: 700; font-size: 14px;
  color: #fff; background: var(--link); border: none; border-radius: 11px; padding: 11px 20px; text-decoration: none;
}
.rs-detail .primary-button:hover { background: var(--link-hover); }
.rs-detail .secondary-button {
  display: inline-flex; align-items: center; font-family: "Lexend", sans-serif; font-weight: 600; font-size: 14px;
  color: var(--ink); background: #fff; border: 1px solid var(--btn-border); border-radius: 11px; padding: 11px 20px; text-decoration: none;
}
.rs-detail .secondary-button:hover { border-color: var(--link); color: var(--link); }

.rs-detail .reader { max-width: 760px; }
.rs-detail .reader p, .rs-detail .reader li { font-size: 15.5px; line-height: 1.75; color: #3A4757; }
.rs-detail .reader h2 { font-family: "Lexend", sans-serif; font-weight: 700; font-size: 19px; color: var(--ink); margin: 26px 0 10px; }
.rs-detail .reader ul, .rs-detail .reader ol { padding-left: 22px; }
.rs-detail .reader code { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 13.5px; background: #F1F4F9; border-radius: 5px; padding: 1px 6px; color: #2B3644; }
.rs-detail .reader blockquote { margin: 18px 0; padding: 12px 18px; border-left: 3px solid var(--link); background: #F5F9FF; border-radius: 0 10px 10px 0; color: #3A4757; }
.rs-detail .reader .course-lead { font-size: 16px; color: var(--body); }
.rs-detail .reader .lesson-list li { margin-bottom: 8px; }

.rs-detail .pdf-frame { margin-top: 20px; border: 1px solid var(--card-border); border-radius: 14px; overflow: hidden; }
.rs-detail .pdf-frame iframe { display: block; width: 100%; height: 640px; border: 0; }
.rs-detail .video-frame { margin-top: 8px; border-radius: 14px; overflow: hidden; background: #0E1B2A; }
.rs-detail .video-frame video { display: block; width: 100%; max-height: 560px; }
.rs-detail .transcript { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--card-border); }
.rs-detail .transcript h2 { font-family: "Lexend", sans-serif; font-weight: 700; font-size: 17px; color: var(--ink); margin: 0 0 10px; }
.rs-detail .transcript p { font-size: 15px; line-height: 1.7; color: #3A4757; margin: 0; }

/* ------------------------------- Responsive ------------------------------- */
@media (max-width: 1100px) { .rs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .rs-grid { grid-template-columns: 1fr; }
  .rs-search { width: 100%; }
  .rs-filters { width: 100%; }
  .rs-search-wrap { flex: 1; }
  .rs-hero-inner, .rs-filterbar-inner, .rs-main { padding-left: 20px; padding-right: 20px; }
  .rs-detail { padding: 24px 22px 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .rs-card, .rs-detail { animation: none; }
  .rs-card:hover { transform: none; }
}
