/* =========================================================
   1. DESIGN TOKENS
   ========================================================= */
:root {
  /* Colors */
  --purple-700: #4b0082;
  --purple-500: #a855f7;
  --purple-300: #d8b4fe;
  --blue-500: #3b82f6;
  --red-500: #ef4444;
  --green-500: #84cc16;
  --yellow-400: #fbbf24;

  --gray-900: #111827;
  --gray-700: #1f2937;
  --gray-500: #6b7280;
  --gray-200: #e5e7eb;

  --bg-page: #f4f6fb;
  --bg-card: #ffffff;

  --color-accent-green: var(--green-500);
  --color-accent-red: var(--red-500);
  --color-accent-yellow: var(--yellow-400);


  /* Radius */
  --radius-pill: 999px;
  --radius-card: 18px;
  --radius-soft: 12px;

  /* Shadows */
  --shadow-sm: 0 6px 20px rgba(0,0,0,0.06);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.08);

  /* Spacing */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;

  /* Typography */
  --font-base: Inter, system-ui, sans-serif;
}

/* =========================================================
   2. RESET + BASE
   ========================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow-x: hidden;
  background: linear-gradient(var(--bg-page), #eef1f8);
}

body {
  font-family: var(--font-base);
  background: linear-gradient(var(--bg-page), #eef1f8);
  color: var(--gray-700);
}

small {
  display: block;
  margin-top: var(--space-2);
  color: var(--gray-500);
}

.muted {
  color: var(--gray-500);
}

.text-accent-green { color: var(--color-accent-green); }
.text-accent-red   { color: var(--color-accent-red); }
.text-accent-yellow{ color: var(--color-accent-yellow); }
.text-accent-purple { color: var(--purple-500); }
.text-accent-deep-purple { color: var(--purple-700)}


.card > .stack > .stack {
  gap: var(--space-2);
}


/* =========================================================
   3. LAYOUT PRIMITIVES
   ========================================================= */
.container {
  max-width: 1200px;
  margin: 3rem auto;
  padding: 0 var(--space-4);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.inline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* =========================================================
   4. TOPBAR
   ========================================================= */
.topbar {
  background: linear-gradient(135deg, var(--purple-300), var(--purple-700));
  padding: var(--space-2) 0;
}

.topbar-inner {
  max-width: 1200px;
  margin: auto;
  padding: 0 var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.topbar .brand img {
    height: 32px;          /* or 24px / 40px — your call */
    width: auto;           /* keep aspect ratio */
    max-height: 100%;
    display: block;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.2rem;
  color: white;
}

.brand img {
  height: 32px;
}

.topbar-search {
  flex: 1;
  display: flex;
}

.topbar-search input {
  flex: 1;
  padding: 0.6rem 1rem;
  border-radius: 6px 0 0 6px;
  border: none;
}

.topbar-search button {
  background: #44165a;
  color: white;
  border: none;
  padding: 0 1.2rem;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
}

.topbar-nav a {
  color: #dbeafe;
  text-decoration: none;
  margin-left: 1rem;
}

/* =========================================================
   5. COMPONENTS
   ========================================================= */

/* Card */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  box-shadow: var(--shadow-lg);
}

.card h2 {
  font-size: 1.2rem;
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card h3 {
  margin: var(--space-3) 0 var(--space-1);
}

.card h4 {
  margin-top: var(--space-2);
  color: var(--gray-500);
}

/* Card variants */
.card--locked {
  text-align: center;
}

.card--featured {
  position: relative;          /* for pseudo-element positioning */
  border-radius: var(--radius-card);
  background: var(--bg-card);  /* keeps the inner card white */
  z-index: 1;                  /* ensure card content sits above pseudo-element */
}

.card--featured::before {
  content: "";
  position: absolute;
  inset: 0;                     /* covers the full card */
  padding: 2px;                 /* thickness of the border */
  border-radius: inherit;
  background: linear-gradient(135deg, var(--yellow-400), var(--purple-500));
  -webkit-mask: 
    linear-gradient(#fff 0 0) content-box, 
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
          mask-composite: exclude; /* cut out the inner content */
  pointer-events: none;         /* allow clicks through */
  z-index: -1;                  /* behind the card content */
}

/* Stat pill */
.stat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  width: 100%;      /* ensures it uses full width of parent */
  justify-content: space-between; /* optional: spread the pills evenly */
}


.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
  cursor: help;
  position: relative;
}

.stat-pill strong {
  margin-left: 0.3rem;
}

.dashboard-header {
  width: 100%;
  max-width: 1200px; /* optional, match container */
  margin: 0 auto;
  padding: 0 var(--space-4); /* match your container */
}

/* Generic tooltip for any element with data-tip */
[data-tip] {
  position: relative;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;

  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);

  background: var(--gray-900);
  color: white;
  padding: 0.6rem 0.75rem;

  font-size: 0.75rem;
  line-height: 1.4;

  /* ✅ Width control */
  max-width: 320px;
  min-width: 220px;          /* 👈 this stops the “thin column” */
  width: max-content;        /* 👈 expands naturally */
  white-space: normal;
  word-wrap: break-word;

  text-align: left;

  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 9999;
}


[data-tip]:hover::after {
  opacity: 1;
}


.modal-tooltip {
  position: absolute;
  max-width: 320px;
  background: var(--gray-900);
  color: white;
  padding: 0.6rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1.4;
  border-radius: 6px;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}


.modal-content [data-tip]::after {
  display: none;
}

/* Buttons */
.btn {
  background: var(--purple-700);
  border: none;
  color: white;
  padding: 0.9rem 2rem;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.btn--cta {
  background: linear-gradient(135deg, var(--yellow-400), #f59e0b);
}

.btn--small{
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Lock box */
.lock-box {
  background: rgba(255,255,255,0.6);
  padding: var(--space-3);
  border-radius: var(--radius-soft);
}

.pagination-controls{
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* =========================================================
   6. BARS
   ========================================================= */
.bar {
  display: grid;
  grid-template-columns: 120px 1fr 50px;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.track {
  background: var(--gray-200);
  height: 10px;
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.fill {
  height: 100%;
  width: 0;
  animation: grow-bar 0.8s ease-out forwards;
}

@keyframes grow-bar {
  to { width: var(--target-width); }
}

.fill--blue   { background: var(--blue-500); }
.fill--purple { background: var(--purple-700); }
.fill--red    { background: var(--red-500); }
.fill--green  { background: var(--green-500); }
.fill--yellow { background: var(--yellow-400); }

/* =========================================================
   7. DASHBOARD GRID
   ========================================================= */
.dashboard-grid {
  margin-top: var(--space-4);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "openings mode"
    "blunder phase"
    "coaching coaching";
  gap: var(--space-4);
}

.dashboard-grid > * {
  min-width: 0;
}

.openings { grid-area: openings; }
.mode     { grid-area: mode; }
.coaching { grid-area: coaching; }
.blunder  { grid-area: blunder; }
.phase    { grid-area: phase; }

/* =========================================================
   8. HERO
   ========================================================= */
.hero {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 70vh;
}

.hero-inner {
    text-align: center;
}

.hero-logo {
    display: block;
    margin: 0 auto 1.5rem;
    height: clamp(120px, 30vw, 300px);
    width: auto;
}


/* =========================================================
   9. board modal
   ========================================================= */
  
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;

  background-color: rgba(0,0,0,0.6);

  display: none;
  align-items: center;
  justify-content: center;
  overflow: auto; /* scroll if modal taller than viewport */
}

.modal-content {
  background-color: #fff;
  border-radius: 8px;
  width: 90vw;
  max-width: 800px;    /* max width for desktop */
  max-height: 90vh;
  padding: 20px;
  box-sizing: border-box;

  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-body {
  display: flex;
  gap: 20px;
  flex: 1;
  overflow: hidden;
}

.modal-board {
  flex: 0 0 350px;      /* fixed board width */
  max-width: 100%;
}

.modal-details {
  flex: 1;               /* takes remaining space */
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;      /* scroll inside if content too tall */
}

.move-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--gray-500);
}

.move-details span {
  background: var(--gray-200);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 500;
  margin-bottom: 4px;
}

.example-labels {
  margin-top: 8px;
  padding: 8px 10px;
  background-color: #f9fafb;
  border-left: 4px solid var(--red-500);
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.35;
  text-align: left;
}

.modal-controls {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}



.close {
  float: right;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
}
.btn-example {
  margin: 4px 4px 4px 0;
}

#board {
  width: 100%;
  max-width: 330px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}


.arrow {
  pointer-events: none;
}

.board-b72b1 {
  position: relative;
}

#coachStack {
  position: relative;
  min-height: 150px; /* ensures space for tallest issue */
  margin: 0.6rem 0;  /* slightly more breathing room */
  font-family: var(--font-base);
  color: var(--gray-700);
}

#coachStack .issue {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-soft);
  background: var(--bg-page);        /* subtle contrast with card */
  box-shadow: var(--shadow-sm);
}

#coachStack .issue.active {
  opacity: 1;
  position: relative;
  transform: translateY(0);
}

.examples-container {
  display: flex;
  justify-content: flex-end; /* pushes button to the right */
  margin-top: 0.75rem;
}

.issue {
  background: var(--bg-card);
  border-radius: var(--radius-soft);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Header */
.issue-header h3 {
  font-size: 1rem;          /* consistent size */
  font-weight: 600;         /* slightly bolder */
  margin-bottom: 0.25rem;
  color: var(--gray-900);
}

.issue-header .muted {
  font-size: 0.85rem;
  color: var(--gray-500);   /* consistent muted color */
  margin-top: 0;
}

/* Body */
.issue-body p {
  font-size: 0.9rem;
  line-height: 1.5;           /* slightly more readable */
  color: var(--gray-700);
  margin: 0;
}

/* Footer: recommendation + button */
.issue-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-2);
  border-top: 1px solid var(--gray-200); /* subtle separation */
  padding-top: var(--space-2);
}

.btn-open-examples {
  font-size: 0.875rem;
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
  background-color: var(--purple-700);
  color: white;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.btn-open-examples:hover {
  background-color: var(--purple-800);
  transform: translateY(-1px);
}

.btn-open-examples:hover {
  background-color: var(--purple-700);
  transform: translateY(-1px);
}


.btn-open-examples {
  background-color: var(--purple-700);
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  margin: 0.4rem 0;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}


.example-labels {
  margin-top: 8px;
  padding: 8px 10px;
  background-color: #f9fafb;
  border-left: 4px solid var(--red-500);
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.35;
  text-align: left;
}

.example-labels p {
  margin: 4px 0;
}


/* =========================================================
   9. loading bar
   ========================================================= */

/* Fullscreen layout */
.progress-layout {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* Center the container */
#progress-container {
  width: 420px;
  margin: 40px auto;
  font-family: system-ui, sans-serif;
  text-align: center;
}

/* Progress bar wrapper */
.progress-bar-wrapper {
  width: 100%;
  height: 20px;
  background-color: #e5e7eb; /* light gray background */
  border-radius: 999px; /* fully rounded */
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  margin: 16px 0;
}

/* Progress fill */
#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--purple-300), var(--purple-700));
  transition: width 0.25s ease;
  border-radius: 999px 0 0 999px; /* round only left side */
}

/* Progress message text */
#progress-message {
  font-size: 14px;
  color: #374151; /* dark gray */
  opacity: 0.9;
  margin-top: 6px;
}


/* =========================================================
   10. RESPONSIVE BREAKPOINTS
   ========================================================= */

/* Tablet */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "openings mode"
      "blunder phase"
      "coaching coaching";
  }

  .dashboard-header {
    padding: 0 var(--space-2);
  }

  .stat-strip {
    flex-direction: column;
    gap: var(--space-2);
  }

}

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
    margin: 2rem auto;
  }
}

/* Mobile */
@media (max-width: 768px) {

  .topbar-inner {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }

  .brand {
    justify-content: center;
  }

  .topbar-search {
    width: 100%;
  }

  .topbar-search input {
    width: 100%;
    font-size: 16px;
  }

  .topbar-nav {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    width: 100%;
    flex-wrap: wrap;
  }

  .topbar-nav a {
    margin: 0;
  }
}

@media (max-width: 600px) {
  .bar {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .bar span,
  .bar strong {
    font-size: 0.85rem;
  }

  .track {
    height: 8px;
  }
}

@media (max-width: 768px) {

  .modal-content {
    width: 95vw;
    max-height: 95vh;
    padding: 16px;
  }

  .modal-body {
    flex-direction: column;
    overflow-y: auto;
  }

  .modal-board {
    flex: none;
    width: 100%;
    max-width: 100%;
  }

  #board {
    max-width: 100%;
  }

  .modal-controls {
    justify-content: space-between;
  }

  .move-details {
    font-size: 0.75rem;
  }
}

@media (max-width: 768px) {
  .hero {
    height: auto;
    padding: 4rem 1rem;
  }

  .hero-logo {
    height: clamp(100px, 40vw, 200px);
  }

  .hero-inner h1 {
    font-size: 1.2rem;
  }
}

@media (max-width: 600px) {
  #progress-container {
    width: 100%;
    padding: 0 var(--space-2);
  }
}

body {
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}