/* Harvard-like full background, centered search and trending floating chips */
:root{
  --harvard-crimson:#A51C30;
  --bg-overlay: rgba(0,0,0,0.36);
  --white: #ffffff;
  --gap:10px;
  --radius:12px;
  --card-opacity: 0.96;

  /* --- Crimson-themed scrollbars (global + element fallbacks) --- */
  /* Firefox */
  --scr-thumb: #A51C30;         /* primary crimson */
  --scr-thumb-2: #7B0F22;       /* darker stop */
  --scr-track: rgba(0,0,0,0.16); /* track */
  --scr-border: rgba(0,0,0,0.12);
}

/* add GT America — place GTAmerica-Regular.ttf in public/fonts/ */
@font-face{
  font-family: 'GT America';
  src: local('GT America'), url('/fonts/GTAmerica-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* use GT America everywhere */
html,body{height:100%;margin:0;font-family:'GT America', Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial;color:var(--white);}

/* parallax background layer */
.bg-parallax{
  position:fixed;
  inset:0;
  z-index:-2;
  background-image: url('/assets/autumn-harvard.webp');
  background-size: cover;
  background-position: center;
  transform: translateY(0);
  will-change: transform;
  filter: saturate(1.04) contrast(1.04);
}

/* subtle dark overlay so text remains readable (not too transparent) */
body::before{
  content:'';
  position:fixed;
  inset:0;
  z-index:-1;
  background: linear-gradient(180deg, rgba(0,0,0,0.28), rgba(0,0,0,0.40));
}

/* header: centered Harvardium, auth in top-right */
.site-header{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px 0 8px;
  gap: 8px;
}
.brand-center { text-align: center; z-index: 5; }
.brand-link{ display:inline-block; }
.site-title{ font-family:'GT America', 'Merriweather', serif; font-size:28px; font-weight:900; color:var(--white); letter-spacing:0.6px; text-shadow:0 8px 30px rgba(0,0,0,0.45); margin-top:6px; }

/* auth in top-right corner */
.auth-corner{ position:absolute; right:18px; top:10px; z-index:60; display:flex; gap:10px; align-items:center; }
.auth-corner .btn{ border-radius:10px; padding:.6rem .9rem; font-weight:800; }

/* search - always white background and dark text for clarity */
.search-input{
  margin: 8px auto 0;
  display: block;
  max-width: 760px;
  width: 78vw;
  text-align: center;
  border-radius:999px;
  text-align: center;
  padding:.72rem 1rem;
  background:#ffffff;        /* always white */
  color:#0b0b0b;             /* dark text */
  border:1px solid rgba(0,0,0,0.08);
  box-shadow:0 12px 36px rgba(0,0,0,0.08);
  caret-color: var(--harvard-crimson);
}

/* page background: Annenberg image + slight crimson tint overlay */
body {
  background-image:
    linear-gradient(rgba(165,28,48,0.36), rgba(165,28,48,0.36)),
    url('/images/annenberg.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: #fff;
}

/* page spacing: add top margin so header is not flush */
body { margin-top:28px; }

/* flat single-column layout so each course spans full width and players scroll vertically */
#classesGrid .category-grid,
.classes-grid .category-grid {
  display: grid;
  grid-template-columns: 1fr; /* single column */
  gap: 14px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 6px 12px;
  box-sizing: border-box;
}

/* category section spacing reduced */
.category-section { margin: 12px auto; padding: 0 10px; }

/* stacked category layout: each category section spans page width, cards are full-width */
.category-section {
  width: 100%;
  max-width: 1100px;
  margin: 18px auto;
  padding: 0 12px;
  box-sizing: border-box;
}
.category-header h3 {
  margin: 4px 0 8px 0;
  font-size: 18px;
  color: rgba(255,255,255,0.95);
}

/* list ensures vertical stacking */
.category-list { width:100%; display:flex; flex-direction:column; gap:8px; }

/* Base card (slightly transparent so background shows through) */
.class-card {
  position: relative;
  overflow: visible;
  width: 100% !important;
  height: 84px !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px !important;
  border-radius: 10px;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0,0,0,0.22);
  /* crimson but slightly transparent so background shows through */
  background: linear-gradient(180deg, rgba(165,28,48,0.95), rgba(123,15,34,0.88));
  cursor: pointer;
  transition: transform .12s ease, box-shadow .18s ease;
}

/* make the left content avoid the area where the badge sits */
.class-card .card-content { padding-right: 140px; min-width:0; }

/* grade badge pops out in the middle-right and doesn't overlap the comment badge */
.grade-badge {
  position: absolute;
  right: 78px;                  /* moved left from extreme right */
  top: 50%;
  transform: translateY(-50%); /* stable position */
  min-width:56px;
  height:56px;
  border-radius:999px;
  font-weight:900;
  font-size:18px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:#fff;
  box-shadow: 0 14px 36px rgba(0,0,0,0.38);
  transition: box-shadow .18s ease, background .12s ease; /* no transform transition */
  z-index: 3;
}

/* on hover/focus only change shadow/color — do NOT change transform/position */
.class-card:hover .grade-badge,
.class-card:focus-within .grade-badge {
  box-shadow: 0 22px 48px rgba(0,0,0,0.44);
}

/* animated glow outline implemented with ::after; color driven by med-* classes */
.class-card::after{
  content: "";
  pointer-events: none;
  position: absolute;
  inset: -8px;
  border-radius: inherit;
  z-index: -1;
  filter: blur(22px) saturate(1.2);
  opacity: 0;
  transform: scale(0.98);
  transition: opacity .22s ease, transform .22s ease;
  background-size: 300% 300%;
  animation: glowShift 5s linear infinite;
}
.class-card:hover::after { opacity: 1; transform: scale(1.02); }

/* glow motion */
@keyframes glowShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* glow colors by median bucket (outline only) */
.class-card.med-A::after { background: linear-gradient(90deg, rgba(120,255,140,0.18), rgba(20,220,60,0.24)); }
.class-card.med-B::after { background: linear-gradient(90deg, rgba(135,180,255,0.14), rgba(40,120,255,0.22)); }
.class-card.med-C::after { background: linear-gradient(90deg, rgba(255,220,120,0.12), rgba(255,150,30,0.16)); }
.class-card.med-D::after { background: linear-gradient(90deg, rgba(255,110,110,0.12), rgba(220,40,40,0.18)); }
.class-card.med-F::after { background: linear-gradient(90deg, rgba(200,80,80,0.09), rgba(120,30,30,0.12)); }

/* grid: two cards per row inside category-list */
.category-list {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  box-sizing: border-box;
}

/* responsive -> 3, 2, then 1 column */
@media (max-width: 1200px) {
  .category-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .category-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .category-list { grid-template-columns: 1fr; }
}

/* grade badge: distinct colors and grow on hover; shown on right of card */
.grade-badge {
  min-width:52px;
  height:52px;
  border-radius:999px;
  font-weight:900;
  font-size:16px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:#fff;
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

/* badge colors (A green, B blue, C amber, D red, F dark) */
.grade-badge.med-A { background: linear-gradient(180deg,#c8ffd0,#00d130); color:#042000; }
.grade-badge.med-B { background: linear-gradient(180deg,#bcd9ff,#1e7bff); color:#00173a; }
.grade-badge.med-C { background: linear-gradient(180deg,#fff3c2,#ffb34d); color:#2b1600; }
.grade-badge.med-D { background: linear-gradient(180deg,#ffb3b3,#ff4b4b); color:#3a0000; }
.grade-badge.med-F { background: linear-gradient(180deg,#d7b0b0,#a83b3b); color:#2b0000; }

/* badge scales up when card hovered/focused */
.class-card:hover .grade-badge,
.class-card:focus-within .grade-badge { box-shadow: 0 18px 40px rgba(0,0,0,0.32); }

/* remove the absolute top-right median (hide old .meta container if present) */
.course-modal .meta { display: none !important; }

/* inline header: median placed next to course title */
.course-modal .modal-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.course-modal .modal-header h2 { margin:0; font-size:26px; padding-right:0; }

/* adjust inline median styling (next to title) */
.course-modal .modal-median-raw {
  background: rgba(123,15,34,0.95); /* dark crimson background */
  color: #fff;                       /* default (overridden per grade) */
  font-size: 2.2rem !important;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: none;
}

/* Text color indicates the bucket (keeps background constant) */
.course-modal.med-A .modal-median-raw { color: #0a5b00; }   /* green for A */
.course-modal.med-B .modal-median-raw { color: #00307a; }   /* blue for B */
.course-modal.med-C .modal-median-raw { color: #8a4b00; }   /* amber for C */
.course-modal.med-D .modal-median-raw { color: #7a0000; }   /* red for D */
.course-modal.med-F .modal-median-raw { color: #2b0000; }   /* dark maroon for F */

/* backdrop and modal animations */
.course-modal-backdrop{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.46);
  z-index: 1100;
  animation: backdropIn .16s ease both;
}
.course-modal-backdrop.closing{
  animation: backdropOut .16s ease both;
}
@keyframes backdropIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes backdropOut { from { opacity: 1 } to { opacity: 0 } }

/* modal open/close from center */
.course-modal{
  width: min(880px, 96vw);
  max-height: 72vh;
  padding: 16px;
  border-radius: 12px;
  /* background: linear-gradient(180deg, rgba(6,6,6,0.86), rgba(12,12,12,0.94)); */
  background: linear-gradient(180deg, rgba(165,28,48,0.95), rgba(123,15,34,0.88));
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  transform-origin: center center;
  animation: modalIn .22s cubic-bezier(.2,.9,.2,1) both;
  overflow: auto;
  position: relative;
}
.course-modal.closing{
  animation: modalOut .18s ease both;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.96); filter: blur(1px); }
  to   { opacity: 1; transform: scale(1); filter: blur(0); }
}
@keyframes modalOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(.96); }
}

/* close button styling (ensure visible and consistent) */
.course-modal .close-btn{
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 60;
  background: rgba(255,255,255,0.06);
  color: #fff;
  border: none;
  font-size: 20px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s ease, transform .08s ease;
}
.course-modal .close-btn:hover{ background: rgba(255,255,255,0.10); transform: translateY(-1px); }

/* comments: compact vertical layout with likes on the right, and no hover transform */
.comments-grid { display: grid; gap: 10px; grid-auto-rows: min-content; margin-top:6px; max-height:40vh; overflow:auto; padding-right:6px; }
.comment-row {
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  padding: 10px;
  display: flex;                 /* row: body | likes */
  flex-direction: row;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  color: #fff; /* comment text white */
  line-height: 1.4;
  border: 1px solid rgba(255,255,255,0.03);
  transition: background .12s ease; /* subtle only */
}

/* disable the previous hover transform; keep only subtle bg highlight */
.comment-row:hover { background: rgba(255,255,255,0.035); transform: none; }

/* left side body */
.comment-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }

/* name + timestamp header */
.comment-header { display:flex; justify-content:space-between; gap:12px; align-items:center; }
.comment-author {
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  opacity: 0.98;
}
.comment-time {
  font-size: 12px;
  color: rgba(255,255,255,0.72);
  font-weight: 600;
}

/* comment text: white and slightly larger for readability */
.comment-text {
  font-size: 14px;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  white-space: normal;
}

/* likes area on the right */
.comment-likes {
  width: 72px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.like-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.92);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background .12s ease, transform .08s ease;
}
.like-btn:hover { background: rgba(255,255,255,0.03); transform: translateY(-1px); }
.like-btn .heart { font-size: 16px; line-height:1; color: inherit; }
.like-btn .like-count { font-size: 13px; color: rgba(255,255,255,0.95); }
.like-btn.liked { color: #ff0025; }

/* modal category label (restored) */
.course-modal .category-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.92);
  background: rgba(0,0,0,0.32);
  padding: 4px 8px;
  border-radius: 6px;
  margin-left: 8px;
}

/* Make modal grade background a dark crimson, text color indicates the grade */
.course-modal .modal-median-raw {
  background: rgba(123,15,34,0.95); /* dark crimson background */
  color: #fff;                       /* default (overridden per grade) */
  font-size: 2.2rem !important;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: none;
}

/* Text color indicates the bucket (keeps background constant) */
.course-modal.med-A .modal-median-raw { color: #0a5b00; }   /* green for A */
.course-modal.med-B .modal-median-raw { color: #00307a; }   /* blue for B */
.course-modal.med-C .modal-median-raw { color: #8a4b00; }   /* amber for C */
.course-modal.med-D .modal-median-raw { color: #7a0000; }   /* red for D */
.course-modal.med-F .modal-median-raw { color: #2b0000; }   /* dark maroon for F */

/* Course modal: stylish crimson inputs for name + comment */
.course-modal input#modalAuthor,
.course-modal input#modalContent,
.course-modal textarea#modalContent {
  background: linear-gradient(180deg, rgba(165,28,48,0.95), rgba(120,15,30,0.88));
  color: #fff;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 10px 12px;
  border-radius: 10px;
  outline: none;
  box-shadow: 0 6px 18px rgba(165,28,48,0.12), inset 0 -2px 8px rgba(0,0,0,0.18);
  transition: box-shadow .12s ease, transform .08s ease;
}

/* slightly bigger input text for comment area */
.course-modal input#modalContent { font-size: 15px; }
.course-modal input#modalAuthor { font-weight: 700; }

/* placeholder styling */
.course-modal input::placeholder,
.course-modal textarea::placeholder {
  color: rgba(255,255,255,0.76);
  opacity: 1;
}

/* focus affordance */
.course-modal input:focus,
.course-modal textarea:focus {
  box-shadow: 0 10px 30px rgba(165,28,48,0.18), 0 0 0 4px rgba(165,28,48,0.06);
  transform: translateY(-1px);
}

/* make inputs blend with modal: remove default chrome inner shadow */
.course-modal input,
.course-modal textarea { -webkit-appearance: none; }

/* small responsive tweak so inputs don't overflow modal on small screens */
@media (max-width:720px) {
  .course-modal input#modalContent,
  .course-modal textarea#modalContent {
    font-size: 14px;
    padding: 8px 10px;
  }
}

/* --- Crimson-themed scrollbars (global + element fallbacks) --- */
/* Firefox */
:root {
  --scr-thumb: #A51C30;    /* primary crimson */
  --scr-thumb-2: #7B0F22;  /* darker stop */
  --scr-track: rgba(0,0,0,0.14);
  --scr-border: rgba(0,0,0,0.10);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scr-thumb) var(--scr-track);
}

/* WebKit (Chrome, Edge, Safari) - global */
*::-webkit-scrollbar { width: 12px; height: 12px; }
*::-webkit-scrollbar-track {
  background: var(--scr-track);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--scr-thumb), var(--scr-thumb-2));
  border-radius: 999px;
  border: 3px solid var(--scr-border);
  min-height: 28px;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #B72636, #8D1528);
  box-shadow: 0 4px 14px rgba(167,28,44,0.16);
}
*::-webkit-scrollbar-corner { background: transparent; }

/* Ensure important scrollable components have the same styling */
.course-modal,
.comments-grid,
.category-list,
.classes-grid,
textarea,
input[type="search"],
input,
select {
  scrollbar-width: thin;
  scrollbar-color: var(--scr-thumb) var(--scr-track);
}
.course-modal::-webkit-scrollbar,
.comments-list::-webkit-scrollbar,
.comments-grid::-webkit-scrollbar,
.category-list::-webkit-scrollbar,
.classes-grid::-webkit-scrollbar,
.class-card::-webkit-scrollbar,
textarea::-webkit-scrollbar,
input[type="search"]::-webkit-scrollbar,
input::-webkit-scrollbar,
select::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

/* Optional subtle inset track for large scroll containers */
.category-list::-webkit-scrollbar-track,
.classes-grid::-webkit-scrollbar-track,
.course-modal::-webkit-scrollbar-track {
  background: linear-gradient(180deg, rgba(0,0,0,0.12), rgba(0,0,0,0.06));
}