/* All theme variables are in themes.css */
/* All animations are in animations.css, with the logic being in ./src/scripts/canvas-animatinos.js */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family:
    "IBM Plex Sans Arabic",
    "Tajawal",
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Display",
    "Segoe UI",
    Roboto,
    sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  /*
   * DO NOT use padding shorthand here — it would override padding-right set by
   * side-menu.css (80px for collapsed sidebar) regardless of stylesheet load order.
   * Set only the three sides that index.css owns; side-menu.css owns padding-right.
   */
  padding-top: 40px;
  padding-bottom: 40px;
  padding-left: 24px; /* physical left — the non-sidebar side */
  position: relative;
  overflow-x: hidden;
}

/* Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Breadcrumb */
#breadcrumb {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--color-surface, #ffffff);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid var(--color-border, #e0e0e0);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  width: fit-content;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-primary, #1a1a1a);
  /* Sidebar is on the RIGHT — breadcrumb anchors to the left freely */
  position: fixed;
  z-index: 100;
  top: 24px;
  left: 16px;
  right: auto;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#breadcrumb:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  border-color: var(--color-primary, #0088cc);
}

#breadcrumb.show {
  display: inline-flex;
}

.breadcrumb-text {
  font-size: 0.9375rem;
  font-weight: 600;
}

/* ============================================================================
   share-quiz-link-button
   ============================================================================ */
.share-quiz-link-button {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--color-background-secondary);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 2;
}

@media (max-width: 768px) {
  .share-quiz-link-button {
    top: 7px;
    left: 7px;
    width: 27px;
    height: 27px;
  }
}

/* ============================================================================
   BREADCRUMB MOBILE RESPONSIVE FIXES
   ============================================================================ */

/* Tablet styles */
@media (max-width: 768px) {
  #breadcrumb {
    font-size: 0.85rem;
    padding: 8px 12px;
    top: 20px;
    left: 20px;
    max-width: calc(100vw - 40px);
  }

  .breadcrumb-text {
    font-size: 0.85rem;
  }
}

/* Mobile styles */
@media (max-width: 640px) {
  #breadcrumb {
    font-size: 0.8rem;
    padding: 8px 14px;
    top: 16px;
    left: 16px;
    max-width: calc(100vw - 32px);
    gap: 6px;
  }

  .breadcrumb-text {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100vw - 80px);
  }
}

/* Very small screens */
@media (max-width: 380px) {
  #breadcrumb {
    font-size: 0.75rem;
    padding: 7px 12px;
    top: 12px;
    left: 12px;
    max-width: calc(100vw - 24px);
  }

  .breadcrumb-text {
    font-size: 0.75rem;
    max-width: calc(100vw - 60px);
  }
}

/* Premium Header */
.header {
  border-radius: 24px;
  box-shadow:
    var(--shadow-xl),
    0 0 0 1px rgba(99, 102, 241, 0.06);
  padding: 40px 48px 36px;
  margin-bottom: 28px;
  border: 1px solid var(--color-border-light);
  text-align: center;
  position: relative;
  overflow: hidden;
  /* Subtle noise-like background depth */
  background: var(--color-surface);
}

/* Two-tone top accent bar: thicker, gradient-glow effect */
.header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--gradient-accent);
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.35);
}

/* Subtle radial glow centred behind the title */
.header::after {
  content: "";
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 480px;
  height: 220px;
  background: radial-gradient(
    ellipse at center,
    rgba(99, 102, 241, 0.08) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

.header-content {
  position: relative;
  z-index: 1;
}

.header h1 {
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-bottom: 14px;
  line-height: 1.1;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* Subtle text-shadow glow on supported browsers */
  filter: drop-shadow(0 1px 2px rgba(99, 102, 241, 0.18));
}

.header p {
  font-size: 1rem;
  max-width: 680px;
  margin: 0 auto;
  font-weight: 500;
  color: var(--color-text-secondary);
  line-height: 1.65;
}

/* ============================================================================
HEADER BADGE – GAMIFIED WELCOME
============================================================================ */

.header-badge {
  position: relative;
  display: inline-flex;
  gap: 10px;

  flex-wrap: wrap; /* Allows text to go to a second line if needed */
  align-items: center;
  justify-content: center;
  text-align: center; /* Keeps text centered if it wraps */

  padding: 10px 18px;
  border-radius: 999px;

  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;

  margin-bottom: 24px;

  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.6);

  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35);

  will-change: transform, box-shadow;
}
[data-animations="enabled"] .header-badge {
  animation:
    badgePopIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    badgeFloat 6s ease-in-out infinite;
}

/* Emoji / icon before text */
.header-badge::before {
  font-size: 1.05rem;
  opacity: 0.9;
}

/* Make the USERNAME pop */
.header-badge .user-name {
  position: relative;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 2px 6px;
  border-radius: 6px;
  margin-inline: 0; /* logical: replaces margin-right: 0; margin-left: 0 */
}
[data-animations="enabled"] .header-badge .user-name {
  animation: namePulse 3s ease-in-out infinite;
}

.header-badge::after {
  content: "";
  position: absolute;

  /* 1. Make the width smaller */
  width: 30%;
  height: 55%;

  /* 2. Narrow the white light in the gradient */
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.6) 50%,
    transparent 100%
  );

  /* Start off-screen */
  transform: translateX(-150%);

  border-radius: inherit;
  pointer-events: none;
}
.header-badge::after {
  animation: nameShimmer 5s ease-in-out infinite;
}

/* ============================================================================
ANIMATIONS
============================================================================ */

@keyframes badgePopIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes badgeFloat {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes namePulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@keyframes nameShimmer {
  0% {
    transform: translateX(-110%);
  }
  40% {
    transform: translateX(110%);
  }
  100% {
    transform: translateX(-110%);
  }
}

/* ============================================================================
#Subjects-text — Contextual Section Label
============================================================================ */

/* ============================================================================
   #Subjects-text — Contextual Section Label
   Placement: inside .header-content, below the subtitle <p>
   Theme: Frosted-glass pill with gradient border ring + accent text
   RTL: direction: rtl ensures icon flows after the text (left side in Arabic)
   ============================================================================ */

/* ── Base element ─────────────────────────────────────────────────────────── */
#Subjects-text {
  /* Layout */
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  direction: rtl; /* Arabic RTL: icon ends up on the visual left */

  /* Spacing */
  margin-top: 28px;
  padding: 9px 22px 9px 18px;
  border-radius: 999px;

  /* Typography */
  font-size: 0.9375rem; /* 15px — matches .breadcrumb-text for scale harmony */
  font-weight: 700;
  letter-spacing: 0.25px;
  line-height: 1;
  color: var(--color-accent);

  /* Frosted glass fill */
  background: rgba(99, 102, 241, 0.07);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  /* Depth */
  box-shadow:
    0 4px 16px rgba(99, 102, 241, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);

  /* Entrance animation (fires once on load / re-render) */

  /* Hover lift */
  transition:
    transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.25s ease;
}
[data-animations="enabled"] #Subjects-text {
  animation: subjectsReveal 0.5s 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

#Subjects-text:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 24px rgba(99, 102, 241, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

/* ── Gradient border ring ─────────────────────────────────────────────────── */
/* Technique: set padding on the pseudo-element equal to border width,        */
/* then mask out the content-box so only the ring is painted.                 */
#Subjects-text::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: var(--gradient-accent);

  /* Punch a hole in the middle — only the ring shows */
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;

  /* Standard properties for compatibility */
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;

  pointer-events: none;
  z-index: 0;
}

/* ── Emoji icon (RTL: rendered on visual-left after the text) ─────────────── */
#Subjects-text::after {
  content: "📚";
  font-size: 0.85rem;
  line-height: 1;
  /* Reset any inherited text effects that could apply to emoji */
  -webkit-text-fill-color: initial;
  color: initial;
  opacity: 0.85;
  position: relative;
  z-index: 1;
}

/* ── Entrance keyframe ────────────────────────────────────────────────────── */
@keyframes subjectsReveal {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Dark-theme awareness ─────────────────────────────────────────────────── */

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #Subjects-text {
    font-size: 0.875rem;
    padding: 8px 18px 8px 14px;
    margin-top: 22px;
  }
}

/* ============================================================================
Container
============================================================================ */

/* Premium Grid */
/* Premium Grid — 4 columns desktop → 2 tablet → stacked list mobile */
.grid-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 48px;
}

@media (max-width: 1280px) {
  .grid-container {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
}

@media (max-width: 960px) {
  .grid-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

/* Mobile: full-width flex column handled in the mobile list-row block below */

/* ── Tablet card padding ── Obj 2B */
@media (max-width: 960px) {
  .card,
  .category-card,
  .exam-card {
    padding: 14px 16px;
  }
}

/* ── .card-text wrapper: transparent on desktop, flex column on mobile ─────── */
/* display:contents makes it invisible to layout — children behave as if     */
/* they are direct children of the card. Perfect for desktop card centering. */
.card-text {
  display: contents;
}

/* ── Obj 1: Mobile List-Row Design (≤640px) ─────────────────────────────── */
@media (max-width: 640px) {
  /* ── Grid becomes a flex column with border wrapping the whole list ──────── */
  .grid-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 100%;
    overflow-x: hidden;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    overflow: hidden; /* clip children to the border-radius */
  }

  /* ── Each card becomes a compact horizontal list-row ─────────────────────── */
  .card,
  .category-card,
  .exam-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    min-height: 58px;
    width: 100%;
    box-sizing: border-box;
    border-radius: 0;
    box-shadow: none;
    border: none;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    transition: background-color 0.12s ease;
    overflow: hidden;
    /* LTR physical layout so icon is on the visual left and text flows left→right */
    direction: ltr;
    text-align: left;
  }

  /* First card has no top border */
  .card:first-child,
  .category-card:first-child,
  .exam-card:first-child {
    border-top: none;
  }

  /* Remove the decorative top-accent strip */
  .card::before,
  .category-card::before,
  .exam-card::before {
    display: none;
  }

  /* Subtle hover — no lift on mobile */
  .card:hover,
  .category-card:hover,
  .exam-card:hover {
    transform: none;
    box-shadow: none;
    background: var(--color-background-secondary, #f5f5f5);
  }

  /* ── .card-text: takes up remaining middle space ─────────────────────────── */
  .card-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0; /* allows text-overflow: ellipsis */
  }

  /* ── Category card icon: compact emoji on the left ───────────────────────── */
  .category-card .icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    text-align: center;
    margin-bottom: 0;
    filter: none;
    transform: none !important;
    transition: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-background-secondary);
    border-radius: 8px;
  }

  /* ── Title line: LTR, left-aligned, English friendly ────────────────────── */
  .card-text h3,
  .card h3,
  .category-card h3,
  .exam-card h3 {
    font-size: 0.83rem;
    font-weight: 600;
    margin-bottom: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: ltr;
    text-align: left;
  }

  /* ── Subtext (question count, types): muted, compact, left-aligned ───────── */
  .card-text p,
  .card p,
  .category-card p,
  .exam-card p {
    font-size: 0.7rem;
    color: var(--color-text-tertiary, #888);
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    text-align: left;
    direction: ltr;
    font-weight: 400;
  }

  /* ── Exam meta wrapper: row with types · count, pushed to right ─────────── */
  .exam-card-meta {
    position: static !important; /* reset desktop absolute */
    display: flex;
    flex-direction: row; /* side-by-side (was column) */
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
    margin-right: 4px;
    white-space: nowrap;
  }

  /* ── Exam types and count: same row, muted, right-aligned ───────────────── */
  .exam-types-subtext {
    display: block !important;
    font-size: 0.65rem !important;
    color: var(--color-text-tertiary, #888);
    margin-bottom: 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
    text-align: right;
    order: 1 !important; /* reset desktop order */
  }

  .exam-question-count:not(.exam-types-subtext) {
    display: block !important;
    font-size: 0.65rem !important;
    color: var(--color-text-tertiary, #888);
    margin-bottom: 0;
    text-align: right;
    order: 2 !important; /* count after types in mobile row */
    direction: rtl;
  }

  /* ── Share button: HIDDEN on mobile ─────────────────────────────────────── */
  .share-quiz-link-button {
    display: none !important;
  }

  /* ── Exam card: reset min-height for compact rows ────────────────────────── */
  .exam-card {
    min-height: 52px !important;
  }

  /* ── Start button: compact play icon pill ────────────────────────────────── */
  .exam-card .start-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    padding: 0;
    font-size: 0; /* hide text */
    flex: 0 0 32px;
    min-width: 0 !important;
  }

  /* Show a ▶ play icon via ::before instead of the Arabic text */
  .exam-card .start-btn::after {
    content: "▶";
    font-size: 0.75rem;
    color: white;
  }

  /* Download button — also compact */
  .exam-card .start-btn:last-of-type {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3) !important;
  }

  .exam-card .start-btn:last-of-type::after {
    content: "↓";
    font-size: 0.85rem;
  }

  /* ── Skeleton adapts to list rows ────────────────────────────────────────── */
  .skeleton-card {
    flex-direction: row;
    align-items: center;
    padding: 0 14px;
    min-height: 52px;
    border-radius: 0;
    gap: 12px;
    border-bottom: none;
    border-top: 1px solid var(--color-border);
    box-shadow: none;
    direction: ltr;
  }

  .skeleton-card:first-child {
    border-top: none;
  }

  .skeleton-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
    margin: 0;
  }

  .skeleton-title {
    height: 11px;
    width: 50%;
    border-radius: 6px;
    flex-shrink: 0;
  }

  .skeleton-text {
    height: 9px;
    width: 30%;
    border-radius: 6px;
    flex-shrink: 0;
  }
}

.user-quizzes-drop-zone {
  position: relative;
  transition:
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.user-quizzes-drop-zone.user-quizzes-drag-over {
  border: 2px dashed var(--color-primary);
  border-radius: 20px;
  background: rgba(59, 130, 246, 0.06);
  box-shadow: 0 0 0 1px var(--color-primary-light);
}

/* Premium Card Design */
.card,
.category-card,
.exam-card {
  border-radius: 20px;
  padding: 20px 22px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border-light);
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  text-align: center;
  /* Slight inset highlight at top edge */
  background: var(--color-surface);
}

/* Accent strip — starts hidden, animates in on hover */
.card::before,
.category-card::before,
.exam-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-accent);
  border-radius: 20px 20px 0 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover,
.category-card:hover,
.exam-card:hover {
  transform: translateY(-6px) scale(1.015);
  box-shadow:
    var(--shadow-xl),
    0 0 0 1px rgba(99, 102, 241, 0.08),
    var(--shadow-glow, 0 8px 32px rgba(99, 102, 241, 0.12));
  border-color: rgba(99, 102, 241, 0.2);
}

.card:hover::before,
.category-card:hover::before,
.exam-card:hover::before {
  transform: scaleX(1);
}

.card:active,
.category-card:active,
.exam-card:active {
  transform: translateY(-2px) scale(1.005);
  transition-duration: 0.1s;
}

.category-card {
  text-align: center;
  padding-bottom: 10px;
}

.category-card .icon {
  font-size: 3.5rem;
  margin-bottom: 20px;
  display: inline-block;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.category-card:hover .icon {
  transform: scale(1.1) rotate(5deg);
}

.card h3,
.category-card h3,
.exam-card h3 {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  direction: ltr;
}

.card p,
.category-card p,
.exam-card p {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.exam-question-count {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  direction: rtl;
}

/*
 * Desktop exam card meta bar: absolutely positioned above the action buttons.
 * direction:ltr + space-between → count anchored left, types anchored right.
 * CSS order properties ensure correct sides regardless of DOM insertion order.
 */
.exam-card-meta {
  position: absolute;
  bottom: 68px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  direction: ltr;
  gap: 8px;
  margin: 0;
  /* Prevent text from bleeding into the share button area at top-left */
  padding: 0;
}

/* Count always on the LEFT side */
.exam-card-meta .exam-question-count:not(.exam-types-subtext) {
  order: 1;
  text-align: left;
  flex-shrink: 0;
}

/* Types always on the RIGHT side */
.exam-card-meta .exam-types-subtext {
  order: 2;
  text-align: right;
  flex: 1;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/*
 * Desktop exam card: min-height ensures room for the absolute-positioned
 * meta bar and button row below the heading.
 */
.exam-card {
  min-height: 200px;
}

/*
 * Desktop btnWrap: flex row of action buttons with top margin, full-width.
 * Absolutely anchored to the bottom of the card on desktop.
 * EXCLUDE .user-quiz-card — those use normal flow layout.
 */
.exam-card:not(.user-quiz-card) .exam-card-actions-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
  width: 100%;
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  width: calc(100% - 32px);
}

/* Mobile: restore to normal flex flow so btnWrap sits on the RIGHT */
@media (max-width: 640px) {
  .exam-card:not(.user-quiz-card) .exam-card-actions-wrap {
    position: static;
    width: auto;
    bottom: auto;
    left: auto;
    right: auto;
    margin-top: 0;
    margin-left: auto; /* push to the right end of the flex row */
    flex-shrink: 0;
    flex-wrap: nowrap;
    gap: 4px;
  }
}

/* ── user-quiz-card btnWrap: inline flex row, pushes to bottom of column ──── */
/* display/gap/width were previously set as inline styles in JS — now in CSS. */
.exam-card.user-quiz-card .exam-card-actions-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto; /* push buttons to bottom of the flex-column card */
  width: 100%;
}

/* ── User-quiz cards: full flex-column layout ────────────────────────────── */
/*
 * Ensure the grid does not stretch the card height to match its tallest
 * sibling (e.g. the tall "create new quiz" card).  align-self: start lets
 * the card shrink-wrap its own content while the action buttons still pin
 * to the bottom via margin-top: auto on the actions div.
 */
.exam-card.user-quiz-card {
  align-self: start;
  overflow: visible !important; /* accent bar corners are rounded; no clip needed */
  text-align: start;
}

.exam-types-subtext {
  font-size: 0.85rem;
  color: var(--color-text-tertiary, #888);
  letter-spacing: 0.2px;
}

/*
 * ============================================================================
 * MOBILE CARD OVERRIDE — MUST come AFTER the base card styles above.
 *
 * CSS cascade ordering problem: The mobile @media (max-width: 640px) block
 * that sets up the compact list-row layout lives at an earlier position in
 * this file (~line 522). The base .card / .category-card / .exam-card rules
 * directly above (font-size: 3.5rem, padding: 20px 22px, text-align: center,
 * etc.) are in the normal flow and appear AFTER that mobile block. Since both
 * blocks have equal specificity, source order wins — the base styles override
 * the mobile styles on small screens, producing the "ginormous card" bug.
 *
 * Solution: re-declare only the conflicting overrides here, later in the
 * file, so cascade ordering now works in our favour. No !important needed.
 * ============================================================================
 */
@media (max-width: 640px) {
  /* ── Card shell: compact horizontal row ─────────────────────────────────── */
  .card,
  .category-card,
  .exam-card {
    padding: 0 10px;
    border-radius: 0;
    box-shadow: none;
    border: none;
    border-top: 1px solid var(--color-border);
    text-align: left;
    direction: ltr;
    /* Suppress desktop hover lift */
    transform: none !important;
  }

  .card:first-child,
  .category-card:first-child,
  .exam-card:first-child {
    border-top: none;
  }

  /* Also kill the tablet override padding that fires at ≤960px */
  .category-card {
    padding: 0 10px;
    padding-bottom: 0;
    text-align: left;
  }

  /* ── Category icon: small pill on the left ───────────────────────────────── */
  .category-card .icon,
  .phone-only-emoji {
    font-size: 1.25rem;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    /* Suppress the desktop hover spin */
    transform: none !important;
    transition: none;
    filter: none;
    /* Pill background */
    background: inherit;
    border-radius: 8px;
  }

  /* Suppress desktop hover icon animation */
  .category-card:hover .icon {
    transform: none !important;
  }

  /* ── Heading: small, LTR, left-aligned ──────────────────────────────────── */
  .card h3,
  .category-card h3,
  .exam-card h3 {
    font-size: 0.83rem;
    margin-bottom: 0;
    text-align: left;
    direction: ltr;
  }

  /* ── Paragraph / subtext: tiny muted label ───────────────────────────────── */
  .card p,
  .category-card p,
  .exam-card p {
    font-size: 0.7rem;
    margin-bottom: 0;
    line-height: 1.2;
  }
}

.user-create-quiz-card {
  border-style: dashed;
  background: var(--color-surface);
}

.user-create-quiz-card .icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

/* Premium Button */
.start-btn {
  background: var(--gradient-success);
  color: white;
  border: none;
  padding: 13px 24px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  width: 100%;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.start-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.2) 0%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.start-btn:hover::before {
  opacity: 1;
}

.start-btn:active {
  transform: translateY(0);
}

/* Mobile: shrink .start-btn into a compact 32px icon button.
 * The base rule (width: 100%) comes before this in the file, so we need
 * this block after it to win the cascade at ≤640px. */
@media (max-width: 640px) {
  .exam-card .start-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 0 !important;
    flex: 0 0 32px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    font-size: 0 !important; /* hide Arabic text */
    line-height: 1 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
  }

  /* ▶ play icon for the start button */
  .exam-card .start-btn::after {
    content: "▶";
    font-size: 0.75rem;
    color: white;
  }

  /* ↓ download icon for the (red) download button */
  .exam-card .start-btn[style*="dc2626"]::after,
  .exam-card .start-btn[style*="b91c1c"]::after {
    content: "↓";
    font-size: 0.85rem;
  }

  /* Suppress the hover lift on mobile buttons */
  .exam-card .start-btn:hover {
    transform: none !important;
  }

  /* The btnWrap div: reset absolute, keep it flex inline in the row */
  .exam-card div[style*="margin-top"] {
    position: static !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    margin-top: 0 !important;
    gap: 4px !important;
    width: auto !important;
    flex-shrink: 0;
  }

  /* Reset exam-card min-height and meta absolute positioning */
  .exam-card {
    min-height: 52px !important;
  }

  .exam-card-meta {
    position: static !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-card {
  padding: 32px;
  border-radius: 20px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border);
}

.modal-card p {
  direction: rtl;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
}

.mode-btn {
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: none;
}

.mode-btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}

.mode-btn .icon {
  font-size: 2rem;

  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
}

.close-modal {
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 16px;
}

/* =============================================================================
   DB-sourced quiz card — accent border
   ============================================================================= */

/* ── Accent border on the whole card ──────────────────────────────────────── */
.exam-card--db {
  border-inline-start: 3px solid var(--color-primary); /* RTL-aware left border */
  position: relative; /* already set in JS, but safe to repeat */
}

/* ============================================================================
   WATERMARK
   ============================================================================ */
.watermark {
  text-align: center;
  margin-top: 80px;
  padding-top: 40px;
  border-top: 1px solid var(--color-border-light);
  font-size: 0.9375rem;
  font-weight: 500;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.watermark p {
  margin: 0;
}

.watermark a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.watermark a:hover {
  text-decoration: underline;
}

.watermark::before {
  content: "✨";
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
}

/* Loading State */
.loading {
  text-align: center;
  padding: 80px 32px;
  font-size: 1.125rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 80px 32px;
}

.empty-state-icon {
  font-size: 5rem;
  margin-bottom: 24px;
  opacity: 0.3;
  filter: grayscale(1);
}

/* ============================================================================
   ERROR STATE
   ============================================================================ */
.error-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 32px;
  background: rgba(220, 38, 38, 0.05);
  border: 1px solid rgba(220, 38, 38, 0.18);
  border-radius: 20px;
  color: var(--color-text-primary);
  position: relative;
  overflow: hidden;
}

.error-state::before {
  content: "⚠️";
  display: block;
  font-size: 3.5rem;
  margin-bottom: 20px;
  opacity: 0.7;
}

.error-state p {
  color: #dc2626;
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 20px;
  line-height: 1.6;
}

.error-state button {
  display: inline-block;
  padding: 11px 28px;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.error-state button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.4);
}

.empty-state h3 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

@media (max-width: 768px) {
  body {
    /*
     * Same load-order safety as the base body rule: don't set padding-right.
     * side-menu.css owns it and sets padding-right: 0 !important for mobile.
     */
    padding-top: 24px;
    padding-bottom: 24px;
    padding-left: 16px;
  }

  .header {
    padding: 28px 20px;
    border-radius: 18px;
  }

  .header h1 {
    font-size: 1.75rem;
  }

  .header p {
    font-size: 0.9rem;
  }

  #breadcrumb {
    top: 16px;
    left: 16px;
    padding: 8px 14px;
    gap: 6px;
  }
}

/*
 * Tablet-only card/grid overrides — MUST be scoped to min-width: 641px.
 *
 * WHY: The mobile list-row layout lives in @media (max-width: 640px) at an
 * earlier position in this file. Without the min-width guard, a plain
 * @media (max-width: 768px) block here (later in the cascade) would override
 * the 640px block's display:flex, padding:0 16px, etc. — completely breaking
 * the mobile UI. The guard ensures these tablet styles only apply between
 * 641px and 768px, never below 641px.
 */
@media (min-width: 641px) and (max-width: 768px) {
  .grid-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .card,
  .category-card,
  .exam-card {
    padding: 24px;
  }

  .category-card {
    padding: 15px;
  }

  .card p,
  .category-card p,
  .exam-card p {
    margin-bottom: 5px;
  }

  .category-card .icon {
    font-size: 2.5rem;
    margin-bottom: 0;
  }
}

/*
 * 480px: only header/controls adjustments — all card rules removed.
 * Rationale: the @media (max-width: 640px) mobile list-row block handles every
 * card at ≤640px (including ≤480px). Any card overrides here (padding:15px,
 * font-size:2.5rem, margin-bottom:5px) would reverse the compact list layout
 * since this block appears later in the file and has higher cascade priority.
 */
@media (max-width: 480px) {
  .header {
    padding: 24px 20px;
  }

  .header h1 {
    font-size: 1.6rem;
  }

  .header p {
    font-size: 0.92rem;
  }

  .mode-btn {
    padding: 5px;
  }

  .mode-btn .icon {
    max-width: 40px;
    max-height: 40px;
  }

  #breadcrumb {
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    font-size: 0.8rem;
    gap: 4px;
    border-radius: 8px;
  }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========== Course Data styles ========== */
.course-meta {
  display: flex;
  gap: 8px;
  margin: 8px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.course-meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Light mode colors */
.course-meta-badge.faculty {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.course-meta-badge.year {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.course-meta-badge.term {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
}

/* Dark mode adjustments */
[data-theme="dark"] .course-meta-badge,
[data-theme="dark-slate"] .course-meta-badge {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .course-meta-badge.faculty,
[data-theme="dark-slate"] .course-meta-badge.faculty {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

[data-theme="dark"] .course-meta-badge.year,
[data-theme="dark-slate"] .course-meta-badge.year {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

[data-theme="dark"] .course-meta-badge.term,
[data-theme="dark-slate"] .course-meta-badge.term {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

/* Empty state for no options */
.no-options-message {
  text-align: center;
  padding: 32px;
  opacity: 0.7;
  font-style: italic;
}

.ltr {
  direction: ltr;
}

/* ============================================================================
   SHIMMER SKELETON LOADER
   ============================================================================ */
@keyframes shimmer {
  0% {
    background-position: -1200px 0;
  }
  100% {
    background-position: 1200px 0;
  }
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  margin-bottom: 48px;
}

@media (max-width: 1280px) {
  .skeleton-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 960px) {
  .skeleton-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}
@media (max-width: 640px) {
  .skeleton-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
}

.skeleton-card {
  border-radius: 20px;
  padding: 32px;
  border: 1px solid var(--color-border-light, #e5e7eb);
  background: var(--color-surface, #ffffff);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-height: 180px;
}

.skeleton-block {
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    var(--color-border, #e5e7eb) 0%,
    var(--color-border-light, #f3f4f6) 40%,
    var(--color-border, #e5e7eb) 80%
  );
  background-size: 1200px 100%;
}
[data-animations="enabled"] .skeleton-block {
  animation: shimmer 1.6s ease-in-out infinite;
}

.skeleton-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  flex-shrink: 0;
}

.skeleton-title {
  height: 20px;
  width: 70%;
}

.skeleton-text {
  height: 13px;
  width: 45%;
}

/*
 * Mobile skeleton re-override — placed AFTER the base skeleton rules above.
 * The base .skeleton-card (flex-direction: column, padding: 32px, etc.) sits
 * later in the file than the @media (max-width: 640px) block at line ~521,
 * so the base rules would override the mobile ones without this block.
 * Cascade rule: later source order wins at equal specificity — so this
 * block, placed after the base rules, correctly wins at ≤640px.
 */
@media (max-width: 640px) {
  .skeleton-grid {
    /* Wrap skeleton rows in the same grouped container as real cards */
    border: 1px solid var(--color-border);
    border-radius: 14px;
    overflow: hidden;
  }

  .skeleton-card {
    flex-direction: row;
    align-items: center;
    padding: 0 14px;
    min-height: 52px;
    border-radius: 0;
    gap: 12px;
    border: none;
    border-top: 1px solid var(--color-border);
    box-shadow: none;
  }

  .skeleton-card:first-child {
    border-top: none;
  }

  .skeleton-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
    margin: 0;
  }

  .skeleton-title {
    height: 11px;
    width: 50%;
    border-radius: 6px;
    flex-shrink: 0;
  }

  .skeleton-text {
    height: 9px;
    width: 30%;
    border-radius: 6px;
    flex-shrink: 0;
  }
}

/* ============================================================================
   USER QUIZ CARD
   ============================================================================ */

/* Card shell */
.exam-card.user-quiz-card {
  background: var(--color-surface);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  border: 2px solid var(--color-border);
  position: relative;
  overflow: visible;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
}

.exam-card.user-quiz-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Gradient accent bar at the top of the card */
.user-quiz-accent-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-accent);
  border-radius: 10px 10px 0 0;
}

/* "Your Quiz" badge */
.user-quiz-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 12px;
  margin-left: 50px;
  margin-right: 50px;
}

/* Quiz title */
.user-quiz-title {
  margin: 0 0 8px 0;
  color: var(--color-text-primary);
  font-size: 1.1rem;
}

/* Quiz description */
.user-quiz-desc {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  margin: 0 0 12px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  direction: ltr;
}

/* Metadata row (question count + date) */
.user-quiz-metadata {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--color-border);
}

/* Question count span */
.user-quiz-count {
  color: var(--color-text-secondary);
  font-size: 0.85rem;
}

/* Created date span */
.user-quiz-date {
  color: var(--color-text-tertiary);
  font-size: 0.85rem;
}

/* Question type chips row */
.user-quiz-types-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

/* Action buttons container */
.user-quiz-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 15px;
}

/* Play / primary action button inside actions */
.user-quiz-actions .btn-primary {
  flex: 1;
  padding: 10px 16px;
  background: var(--gradient-accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

/* Delete button */
.user-quiz-delete-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-error-light);
  color: var(--color-error);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 2;
}

.user-quiz-delete-btn:hover {
  background: var(--color-error);
  color: white;
  transform: scale(1.05);
}

/* Edit button */
.user-quiz-edit-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 2;
}

.user-quiz-edit-btn:hover {
  background: var(--color-primary);
  color: white;
  transform: scale(1.05);
}

/* Download button */
.user-quiz-download-btn {
  flex: 1;
  padding: 10px 16px;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

/* ============================================================================
   SUBSCRIBE BUTTON
   ============================================================================ */

.subscribe-btn-container {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.subscribe-btn {
  width: 100%;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.subscribe-btn--add {
  background: var(--gradient-accent);
  color: white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.subscribe-btn--add:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.subscribe-btn--subscribed {
  background: var(--color-success-light, #d1fae5);
  color: var(--color-success, #059669);
  cursor: default;
}

/* ============================================================================
   USER QUIZ SEARCH / CREATE ACTIONS BAR
   ============================================================================ */

.user-quiz-search-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.user-quiz-create-btn {
  display: inline-block;
  padding: 12px 24px;
  background: var(--gradient-success);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s;
  margin-left: auto;
}

.user-quiz-create-btn:hover {
  transform: translateY(-2px);
}

/* ============================================================================
   QUESTION TYPE BADGES (exam cards)
   ============================================================================ */
.exam-question-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 10px 0 4px;
}

.question-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
  transition: transform 0.15s ease;
}

.question-type-badge:hover {
  transform: scale(1.05);
}

.question-type-badge[data-type="MCQ"] {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border-color: rgba(59, 130, 246, 0.25);
}

.question-type-badge[data-type="Essay"] {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.25);
}

.question-type-badge[data-type="True/False"] {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.25);
}

/* Fallback for any other type */
.question-type-badge:not([data-type="MCQ"]):not([data-type="Essay"]):not(
    [data-type="True/False"]
  ) {
  background: rgba(99, 102, 241, 0.08);
  color: var(--color-accent, #6366f1);
  border-color: rgba(99, 102, 241, 0.2);
}

/* ============================================================================
   Responsive adjustments
   ============================================================================ */
@media (max-width: 768px) {
  .faculty-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .faculty-option {
    padding: 20px 12px;
  }

  .faculty-option .faculty-icon {
    font-size: 2rem;
  }

  .year-pill {
    padding: 14px 24px;
    font-size: 1rem;
  }

  .term-btn {
    padding: 16px 20px;
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .faculty-grid {
    grid-template-columns: 1fr 1fr;
  }

  .faculty-option .faculty-name {
    font-size: 0.85rem;
  }

  .year-pills {
    gap: 8px;
  }

  .year-pill {
    padding: 12px 20px;
    font-size: 0.95rem;
  }

  .term-toggle {
    gap: 12px;
  }

  .term-btn {
    padding: 14px 16px;
  }
}

/* ============================================================================
   Custom utility classes for responsive visibility & Mobile Layout Fixes
   ============================================================================ */
.phone-only-emoji {
  display: none;
}

@media (max-width: 640px) {
  .phone-only-emoji {
    display: inline;
  }

  .start-btn.desktop-download-btn {
    display: none !important;
  }

  .desktop-share-btn {
    display: none !important;
  }

  .mobile-more-btn {
    display: flex;
    width: 15px;
    height: 32px;
    max-width: 10px;
    flex: 0 0 32px;
    background: inherit;
    border: none;
    box-shadow: none;
    align-items: center;
    justify-content: end;
    color: #0088cc;
  }

  .course-meta,
  .new-badge {
    display: none;
  }

  /* User Quizzes Mobile Layout Fixes */
  .grid-container.user-quizzes-drop-zone {
    border: none !important;
    border-radius: 0 !important;
    gap: 16px !important;
    background: transparent !important;
  }

  .exam-card.user-quiz-card {
    border-radius: 12px !important;
    border: 1px solid var(--color-border) !important;
    padding: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    box-shadow: var(--shadow-sm) !important;
    align-items: stretch !important;
  }

  .user-create-quiz-card {
    border-radius: 12px !important;
    border: 1px dashed var(--color-primary) !important;
    padding: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    text-align: center;
    align-items: center !important;
  }
}

@media (min-width: 641px) {
  .mobile-more-btn {
    display: none !important;
  }
}

/* ============================================================================
   NEW BADGE — recently added content indicator
   ============================================================================ */
.new-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 4px;
  border-radius: var(--radius-full, 9999px);
  background: var(
    --gradient-accent,
    linear-gradient(135deg, #dc2626 0%, #b91c1c 100%)
  );
  color: #fff;
  font-size: var(--font-size-xs, 0.72rem);
  font-weight: 700;
  letter-spacing: 0.3px;
  pointer-events: none;
  z-index: 3;
  box-shadow: var(--shadow-sm);
}

/* Ensure the card has relative positioning for the badge anchor */
.card,
.category-card,
.exam-card {
  position: relative;
}

/* ============================================================================
   SHORTCUTS OVERLAY
   ============================================================================ */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-lg);
}

.shortcuts-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-2xl);
  box-shadow: var(--shadow-xl);
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.shortcuts-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
}

.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.shortcuts-table td {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

.shortcuts-table tr:last-child td {
  border-bottom: none;
}

.shortcuts-table td:first-child {
  width: 55%;
  font-family: monospace;
}

kbd {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-background-secondary);
  color: var(--color-text-primary);
  font-size: 0.78rem;
  font-family: inherit;
  box-shadow: 0 1px 0 var(--color-border);
  line-height: 1.4;
}

.shortcuts-close {
  align-self: flex-end;
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  font-size: var(--font-size-sm);
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.shortcuts-close:hover {
  background: var(--color-primary-hover);
}

/* ============================================================================
   INLINE CREATE QUIZ MODAL
   ============================================================================ */
.create-quiz-inline-modal {
  padding: 28px;
  border-radius: 20px;
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  max-width: 550px;
  width: 90%;
  transform: translateY(20px);
  opacity: 0;
  animation: modalPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.inline-quiz-textarea {
  flex-shrink: 1;
  min-height: 100px;
}

.create-quiz-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

.create-quiz-actions .main-actions {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  width: 100%;
}

.inline-quiz-btn {
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
}

#inlineQuizCancel {
  font-size: 0.85rem !important;
  background: inherit !important;
  color: var(--color-text-secondary);
  text-decoration: underline;
  padding: 8px !important;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: color 0.2s;
  align-self: center;
}

#inlineQuizCancel:hover {
  background-color: transparent !important;
  color: var(--color-text-primary) !important;
}

@media (max-width: 480px) {
  .create-quiz-inline-modal {
    padding: 16px;
  }
  .inline-quiz-textarea {
    height: 15vh !important;
    min-height: 120px;
  }

  .inline-quiz-btn {
    width: 100%;
    padding: 9px 15px;
  }
}
