:root {
  --brand: #0f766e;
  --brand-dark: #0b524d;
  --brand-light: #e6f4f2;
  --accent: #f5a623;
}

body {
  background-color: #fffdf8;
}

.bg-brand {
  background-color: var(--brand) !important;
}

a {
  color: var(--brand);
}

.btn-primary {
  background-color: var(--brand);
  border-color: var(--brand);
}

.btn-primary:hover, .btn-primary:focus {
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
}

.text-brand { color: var(--brand); }

/* Dashboard layout: sidebar + main content */
.app-layout {
  display: flex;
  min-height: calc(100vh - 56px - 90px);
}

.sidebar {
  width: 230px;
  flex-shrink: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  border-radius: 0.4rem;
  color: #333;
  text-decoration: none;
  margin-bottom: 0.15rem;
}

.sidebar-link:hover {
  background-color: var(--brand-light);
  color: var(--brand);
}

.sidebar-link.active {
  background-color: var(--brand);
  color: #fff;
}

.main-content {
  flex-grow: 1;
  padding: 1.75rem;
  min-width: 0;
}

.stat-card {
  border-radius: 0.6rem;
  border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-card .stat-number {
  font-size: 2rem;
  font-weight: 700;
}

.course-thumb {
  height: 150px;
  object-fit: cover;
  background-color: var(--brand-light);
}

.progress {
  height: 0.6rem;
}

.hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  padding: 4.5rem 0;
}

.rating-star {
  cursor: pointer;
  font-size: 1.5rem;
  color: #ccc;
}

.rating-star.selected,
.rating-star:hover {
  color: #f5a623;
}

.certificate-box {
  border: 10px solid var(--brand);
  padding: 3rem;
  text-align: center;
  background: #fff;
}

/* Dashboard tables: darker header, zebra-striped rows (applies to every
   admin/learner table — none of them opt into Bootstrap's table-striped) */
.main-content table thead th {
  background-color: #33404a;
  color: #fff;
  border-color: #33404a;
  font-weight: 600;
}

.main-content table tbody tr:nth-child(odd) {
  background-color: #ffffff;
}

.main-content table tbody tr:nth-child(even) {
  background-color: #f2f4f6;
}

.main-content table tbody tr:hover {
  background-color: var(--brand-light);
}

.protected-content {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.protected-content img {
  pointer-events: none;
  -webkit-user-drag: none;
}

.infographic-frame {
  position: relative;
  height: 90vh;
  max-height: 900px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--brand-light);
  cursor: zoom-in;
  pointer-events: auto; /* click still reaches this frame despite .protected-content img being pointer-events:none */
}

.infographic-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.infographic-zoom-hint {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
  border-radius: 2rem;
  pointer-events: none;
}

.img-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(10, 12, 10, 0.94);
  display: none;
  flex-direction: column;
}

.img-zoom-overlay.open {
  display: flex;
}

.img-zoom-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.img-zoom-viewport img {
  max-width: 90vw;
  max-height: 85vh;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.05s linear;
}

.img-zoom-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  z-index: 1;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  font-size: 1rem;
}

.img-zoom-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

.img-zoom-hint {
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.82rem;
  padding: 0.75rem 0 1.25rem;
}

.lesson-text table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}

.lesson-text table td,
.lesson-text table th {
  border: 1px solid #d5dbe0;
  padding: 0.5rem 0.75rem;
}

.lesson-text table th {
  background-color: var(--brand-light);
}

.course-filter-tabs .nav-link {
  color: var(--brand-dark);
  border-radius: 2rem;
  padding: 0.5rem 1.25rem;
  font-weight: 500;
}

.course-filter-tabs .nav-link.active {
  background-color: var(--brand);
  color: #fff;
}

@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; display: flex; flex-wrap: wrap; gap: 0.25rem; }
}

/* ---- Reveal cards (lesson type "cards") ---- */
.cards-deck { outline: none; }
.cards-topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.cards-counter { color: #5b6770; font-size: 0.9rem; }
.cards-dots { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.cards-dot { width: 0.7rem; height: 0.7rem; padding: 0; border: 2px solid var(--brand); border-radius: 50%; background: transparent; transition: background-color .25s, transform .25s; }
.cards-dot.seen { background: var(--brand-light); }
.cards-dot.active { background: var(--brand); transform: scale(1.25); }
.cards-dot:focus-visible, .reveal-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.cards-stage { min-height: 12rem; }
.reveal-card { border: 1px solid #d5dbe0; border-radius: 0.75rem; background: #fff; padding: 1.5rem 1.5rem 1.25rem; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.reveal-card.active { animation: card-enter .4s ease both; }
@keyframes card-enter { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.reveal-card-title { color: var(--brand-dark); margin-bottom: 1rem; }
.reveal-card-front { margin-bottom: 1.25rem; }
.reveal-btn.revealed { opacity: .75; }

/* the answer expands smoothly (grid 0fr -> 1fr) while fading and sliding in */
.reveal-back { display: grid; grid-template-rows: 0fr; opacity: 0; transform: translateY(-8px);
  transition: grid-template-rows .55s cubic-bezier(.22,.8,.3,1), opacity .45s ease .08s, transform .55s cubic-bezier(.22,.8,.3,1); }
.reveal-back.open { grid-template-rows: 1fr; opacity: 1; transform: none; }
.reveal-back-inner { overflow: hidden; min-height: 0; }
.reveal-back-panel { margin-top: 1.25rem; padding: 1rem 1.25rem; border-left: 4px solid var(--brand); background: var(--brand-light); border-radius: 0 0.5rem 0.5rem 0; }
.reveal-back-label { font-weight: 600; color: var(--brand-dark); margin-bottom: .5rem; }

.cards-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; }
.cards-done-note { color: var(--brand-dark); font-size: .9rem; }

@media (prefers-reduced-motion: reduce) {
  .reveal-card.active { animation: none; }
  .reveal-back { transition: none; }
  .cards-dot { transition: none; }
}

/* ---- per-card animation: flip / flip vertical / fade ---- */
.anim-flip, .anim-flipv { padding: 0; background: transparent; border: 0; box-shadow: none; }
.flip-scene { perspective: 1400px; }
.flip-inner { display: grid; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.4, .2, .2, 1); }
.flip-face { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 1px solid #d5dbe0; border-radius: 0.75rem; padding: 1.5rem 1.5rem 1.25rem; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.flip-back-face { background: var(--brand-light); border-color: var(--brand); border-left-width: 4px; }
.anim-flip .flip-back-face { transform: rotateY(180deg); }
.anim-flip.flipped .flip-inner { transform: rotateY(180deg); }
.anim-flipv .flip-back-face { transform: rotateX(180deg); }
.anim-flipv.flipped .flip-inner { transform: rotateX(180deg); }
.flip-back-face .reveal-card-front { margin-bottom: 1.25rem; }

.anim-fade .reveal-back { display: none; grid-template-rows: 1fr; transform: none; opacity: 1; transition: none; }
.anim-fade .reveal-back.open { display: grid; animation: card-fade-in .7s ease both; }
@keyframes card-fade-in { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .flip-inner { transition: none; }
  .anim-fade .reveal-back.open { animation: none; }
}

/* ---- Course mode sidebar ---- */
.sidebar { overflow-y: auto; }
.course-menu { margin-top: .5rem; }
.course-menu-module { margin-bottom: .15rem; }
.course-menu-module > summary { cursor: pointer; padding: .5rem .6rem; border-radius: .4rem; font-weight: 600; font-size: .9rem; color: var(--brand-dark); }
.course-menu-module > summary:hover { background: var(--brand-light); }
.course-menu-module > summary.current { background: var(--brand-light); }
.course-menu-lesson { font-size: .85rem; padding: .4rem .6rem .4rem 1.1rem; align-items: flex-start; }
.course-menu-lesson i { margin-top: .15rem; }
.course-menu-lesson.done:not(.active) { color: #157347; }
.course-menu-lesson.done:not(.active):hover { color: #0f5132; }
.course-menu-lesson.active i.text-success { color: #fff !important; }

/* ---- quoted text sits in a box ---- */
.lesson-text blockquote, .reveal-card blockquote {
  margin: 1rem 0; padding: .85rem 1.15rem; background: var(--brand-light);
  border: 1px solid #b9dcd7; border-left: 5px solid var(--brand); border-radius: .5rem;
  color: #1f3d3a; font-style: italic;
}
.lesson-text blockquote p:last-child, .reveal-card blockquote p:last-child { margin-bottom: 0; }

/* ---- course progress bar ---- */
.course-progress { margin: .5rem 0 1rem; }
.cp-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .25rem .75rem; margin-bottom: .4rem; }
.cp-pct { font-weight: 700; color: var(--brand-dark); }
.cp-meta { font-size: .85rem; color: #5b6770; }
.cp-track { display: flex; gap: 3px; height: .85rem; }
.cp-seg { position: relative; background: #e3e8eb; border-radius: .35rem; overflow: hidden; min-width: 4px; }
.cp-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--brand) 0%, #2fa393 100%); border-radius: .35rem; transition: width .9s cubic-bezier(.22,.8,.3,1); box-shadow: inset 0 -2px 0 rgba(0,0,0,.08); }
.cp-seg.complete .cp-fill { background: linear-gradient(90deg, #198754, #2fb878); }
.course-progress.compact { margin: .4rem 0 .75rem; }
.course-progress.compact .cp-track { height: .55rem; }
.course-progress.compact .cp-pct { font-size: .85rem; }
@media (prefers-reduced-motion: reduce) { .cp-fill { transition: none; } }
