/* ════════════════════════════════════════════════════════════════════
   Dashboard Bento Grid — schoolclaude PWA/TWA only
   ALL rules scoped under html[data-app-mode="true"] so the regular
   website dashboard is completely unaffected.
   2026 modern: Apple-style asymmetric tiles, dark+gold brand,
   stagger-reveal animation, mobile-first.
   ════════════════════════════════════════════════════════════════════ */

/* ── Activate bento layout only in app mode ─────────────────────── */
html[data-app-mode="true"] .dashboard-main {
  display: grid;
  gap: 12px;
  padding: 0.85rem 0.85rem calc(96px + env(safe-area-inset-bottom, 0));
  grid-template-columns: 1fr;
  max-width: 1100px;
  margin: 0 auto;
  background: var(--bg, #050508);
}

/* Hide legacy hero, banner uses bento style */
html[data-app-mode="true"] .dash-hero { display: none !important; }

/* Hide legacy library header (we recreate the visuals in bento style) */
html[data-app-mode="true"] .lesson-library .lib-header { display: none !important; }

/* Hide the entire dashboard top-nav in app mode — bento-header + bottom-nav
   replace it; this also removes the duplicate "Skills" link in the top bar. */
html[data-app-mode="true"] .dashboard-nav { display: none !important; }
html[data-app-mode="true"] .skip-link { display: none; }

/* Tablet+: 2 columns; hero spans full width */
@media (min-width: 600px) {
  html[data-app-mode="true"] .dashboard-main {
    grid-template-columns: repeat(2, 1fr);
    padding: 1.5rem;
    gap: 16px;
  }
  html[data-app-mode="true"] .bento-header,
  html[data-app-mode="true"] .bento-hero,
  html[data-app-mode="true"] .lesson-library,
  html[data-app-mode="true"] #weak-areas-mount,
  html[data-app-mode="true"] .dash-access-banner,
  html[data-app-mode="true"] .bento-row-3 {
    grid-column: 1 / -1;
  }
}

/* ── Header bar (compact greeting) ──────────────────────────────── */
html[data-app-mode="true"] .bento-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.25rem;
}
html[data-app-mode="true"] .bento-greet-time {
  display: block;
  font-size: 0.78rem;
  color: rgba(240, 240, 255, 0.55);
  font-weight: 600;
  letter-spacing: 0.02em;
}
html[data-app-mode="true"] .bento-greet-name {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0.15rem 0 0;
  background: linear-gradient(135deg, #F5C040 0%, #E8A020 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}
html[data-app-mode="true"] .bento-tier-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
html[data-app-mode="true"] .bento-tier-pill.tier-paid {
  background: rgba(232, 160, 32, 0.16);
  color: #F5C040;
  border: 1px solid rgba(232, 160, 32, 0.4);
}
html[data-app-mode="true"] .bento-tier-pill.tier-free {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(240, 240, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ── Base tile ──────────────────────────────────────────────────── */
html[data-app-mode="true"] .bento-tile {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 1.1rem 1.15rem;
  transition: transform 200ms ease, border-color 200ms ease, background 200ms ease;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}
html[data-app-mode="true"] a.bento-tile {
  text-decoration: none;
  color: inherit;
}
html[data-app-mode="true"] a.bento-tile:active,
html[data-app-mode="true"] button.bento-tile:active {
  transform: scale(0.98);
}

/* ── Hero CTA — gold gradient, glow ─────────────────────────────── */
html[data-app-mode="true"] .bento-hero {
  background:
    radial-gradient(circle at 100% 0%, rgba(245, 192, 64, 0.25) 0%, transparent 50%),
    linear-gradient(135deg, rgba(232, 160, 32, 0.18) 0%, rgba(245, 192, 64, 0.06) 100%);
  border: 1px solid rgba(232, 160, 32, 0.32);
  box-shadow: 0 8px 32px rgba(232, 160, 32, 0.14);
  padding: 1.4rem 1.25rem;
  gap: 0.75rem;
}
html[data-app-mode="true"] .bento-hero-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(245, 192, 64, 0.85);
}
html[data-app-mode="true"] .bento-hero-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
  color: #F0F0FF;
  line-height: 1.35;
}
html[data-app-mode="true"] .bento-hero-meta {
  font-size: 0.82rem;
  color: rgba(240, 240, 255, 0.6);
  font-weight: 500;
}
html[data-app-mode="true"] .bento-hero-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.4rem;
}
html[data-app-mode="true"] .bento-hero-progress-track {
  flex: 1;
  height: 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  overflow: hidden;
}
html[data-app-mode="true"] .bento-hero-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #E8A020, #F5C040);
  border-radius: 999px;
  transition: width 600ms ease;
}
html[data-app-mode="true"] .bento-hero-progress-pct {
  font-size: 0.78rem;
  font-weight: 700;
  color: #F5C040;
  min-width: 36px;
  text-align: end;
}
html[data-app-mode="true"] .bento-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  padding: 0.65rem 1.1rem;
  background: linear-gradient(135deg, #E8A020, #F5C040);
  color: #050508;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 700;
  align-self: flex-start;
  box-shadow: 0 4px 16px rgba(232, 160, 32, 0.35);
}
html[data-app-mode="true"] .bento-hero-cta svg { width: 14px; height: 14px; }

/* ── Stats trio — 3 columns ─────────────────────────────────────── */
html[data-app-mode="true"] .bento-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
html[data-app-mode="true"] .bento-stat {
  text-align: center;
  padding: 1.05rem 0.5rem;
  align-items: center;
  gap: 0.25rem;
}
html[data-app-mode="true"] .bento-stat-icon {
  font-size: 1.1rem;
  margin-bottom: 0.15rem;
  opacity: 0.85;
}
html[data-app-mode="true"] .bento-stat-val {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, #F5C040, #E8A020);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
html[data-app-mode="true"] .bento-stat-lbl {
  font-size: 0.72rem;
  color: rgba(240, 240, 255, 0.55);
  font-weight: 600;
}
html[data-app-mode="true"] .bento-stat-streak .bento-stat-val {
  background: linear-gradient(135deg, #FB923C, #F97316);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Progress arc tile ──────────────────────────────────────────── */
html[data-app-mode="true"] .bento-progress-tile {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem;
}
html[data-app-mode="true"] .bento-arc-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}
html[data-app-mode="true"] .bento-arc-pct {
  position: absolute;
  font-size: 1.4rem;
  font-weight: 800;
  color: #F5C040;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
html[data-app-mode="true"] .bento-progress-text h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
  color: #F0F0FF;
}
html[data-app-mode="true"] .bento-week-stat {
  font-size: 0.85rem;
  color: rgba(240, 240, 255, 0.7);
  margin: 0.15rem 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ── Admin tile (purple, only when body.is-admin) ──────────────── */
html[data-app-mode="true"] .bento-admin { display: none; }
html[data-app-mode="true"] body.is-admin .bento-admin {
  display: grid;
  grid-template-columns: 48px 1fr 24px;
  align-items: center;
  gap: 0.85rem;
  background:
    radial-gradient(circle at 0% 100%, rgba(167, 139, 250, 0.18) 0%, transparent 60%),
    linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.05) 100%);
  border: 1px solid rgba(139, 92, 246, 0.32);
  text-decoration: none;
  color: inherit;
}
html[data-app-mode="true"] .bento-admin-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
html[data-app-mode="true"] .bento-admin-text h3 {
  font-size: 0.98rem;
  font-weight: 700;
  margin: 0 0 0.15rem;
  color: #F0F0FF;
}
html[data-app-mode="true"] .bento-admin-text p {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(240, 240, 255, 0.6);
}
html[data-app-mode="true"] .bento-admin-arrow {
  color: rgba(240, 240, 255, 0.5);
  font-size: 1.2rem;
}

/* ── Kids tile (pink/purple, always visible) ───────────────────── */
html[data-app-mode="true"] .bento-kids {
  display: grid;
  grid-template-columns: 48px 1fr 24px;
  align-items: center;
  gap: 0.85rem;
  background:
    radial-gradient(circle at 0% 100%, rgba(236, 72, 153, 0.22) 0%, transparent 60%),
    linear-gradient(135deg, rgba(236, 72, 153, 0.18) 0%, rgba(168, 85, 247, 0.06) 100%);
  border: 1px solid rgba(236, 72, 153, 0.32);
  text-decoration: none;
  color: inherit;
}
html[data-app-mode="true"] .bento-kids-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, #EC4899, #A855F7);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
html[data-app-mode="true"] .bento-kids-text h3 {
  font-size: 0.98rem;
  font-weight: 700;
  margin: 0 0 0.15rem;
  color: #F0F0FF;
}
html[data-app-mode="true"] .bento-kids-text p {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(240, 240, 255, 0.6);
}
html[data-app-mode="true"] .bento-kids-arrow {
  color: rgba(240, 240, 255, 0.5);
  font-size: 1.2rem;
}

/* ── Tip tile (paid users) ──────────────────────────────────────── */
html[data-app-mode="true"] .bento-tip {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.02) 100%);
  border: 1px solid rgba(34, 197, 94, 0.22);
}
html[data-app-mode="true"] .bento-tip-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4ADE80;
}
html[data-app-mode="true"] .bento-tip-text {
  font-size: 0.92rem;
  color: rgba(240, 240, 255, 0.85);
  line-height: 1.55;
  margin: 0;
}

/* ── Library tile wrapper ───────────────────────────────────────── */
html[data-app-mode="true"] .lesson-library {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 1.1rem;
}
html[data-app-mode="true"] .bento-lib-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}
html[data-app-mode="true"] .bento-lib-header h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: #F0F0FF;
}
html[data-app-mode="true"] .bento-lib-header .bento-lib-count {
  font-size: 0.78rem;
  color: rgba(240, 240, 255, 0.55);
  margin-inline-start: auto;
}
html[data-app-mode="true"] .lib-search {
  background: rgba(0, 0, 0, 0.4) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  padding: 0.7rem 0.95rem !important;
  color: #F0F0FF !important;
  width: 100%;
  font-size: 0.92rem;
  transition: border-color 150ms ease;
}
html[data-app-mode="true"] .lib-search:focus {
  outline: none;
  border-color: rgba(232, 160, 32, 0.6) !important;
}
html[data-app-mode="true"] .lib-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
}
html[data-app-mode="true"] .lib-filter-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(240, 240, 255, 0.75);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 180ms ease;
  -webkit-tap-highlight-color: transparent;
}
html[data-app-mode="true"] .lib-filter-pill.active {
  background: linear-gradient(135deg, #E8A020, #F5C040);
  color: #050508;
  border-color: transparent;
}

/* ── Access banner restyle ─────────────────────────────────────── */
/* Respect the hidden attribute set by dashboard.html JS (admin + paid
   users have it set; only free users / soon-to-expire paid users see it). */
html[data-app-mode="true"] .dash-access-banner[hidden] { display: none !important; }
html[data-app-mode="true"] .dash-access-banner {
  background:
    radial-gradient(circle at 100% 0%, rgba(245, 192, 64, 0.2) 0%, transparent 60%),
    linear-gradient(135deg, rgba(232, 160, 32, 0.18) 0%, rgba(245, 192, 64, 0.04) 100%);
  border: 1px solid rgba(232, 160, 32, 0.3);
  border-radius: 20px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
}
html[data-app-mode="true"] .dash-banner-title {
  color: #F5C040;
  font-weight: 800;
  font-size: 1rem;
}
html[data-app-mode="true"] .dash-banner-text p {
  color: rgba(240, 240, 255, 0.75);
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0.2rem 0 0;
}
html[data-app-mode="true"] .dash-banner-cta {
  background: linear-gradient(135deg, #E8A020, #F5C040) !important;
  color: #050508 !important;
  padding: 0.65rem 1.2rem !important;
  border-radius: 12px !important;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
}

/* ── Weak areas wrap ───────────────────────────────────────────── */
html[data-app-mode="true"] #weak-areas-mount {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 1.1rem;
  margin: 0;
}

/* ── Stagger reveal ────────────────────────────────────────────── */
html[data-app-mode="true"] .bento-tile,
html[data-app-mode="true"] .bento-row-3,
html[data-app-mode="true"] .bento-header,
html[data-app-mode="true"] .lesson-library,
html[data-app-mode="true"] #weak-areas-mount,
html[data-app-mode="true"] .dash-access-banner {
  animation: bentoFadeIn 380ms cubic-bezier(.2,.8,.2,1) backwards;
}
html[data-app-mode="true"] .dashboard-main > *:nth-child(1) { animation-delay: 0ms; }
html[data-app-mode="true"] .dashboard-main > *:nth-child(2) { animation-delay: 50ms; }
html[data-app-mode="true"] .dashboard-main > *:nth-child(3) { animation-delay: 100ms; }
html[data-app-mode="true"] .dashboard-main > *:nth-child(4) { animation-delay: 150ms; }
html[data-app-mode="true"] .dashboard-main > *:nth-child(5) { animation-delay: 200ms; }
html[data-app-mode="true"] .dashboard-main > *:nth-child(6) { animation-delay: 250ms; }
html[data-app-mode="true"] .dashboard-main > *:nth-child(7) { animation-delay: 300ms; }
html[data-app-mode="true"] .dashboard-main > *:nth-child(8) { animation-delay: 350ms; }
@keyframes bentoFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  html[data-app-mode="true"] .bento-tile,
  html[data-app-mode="true"] .bento-row-3,
  html[data-app-mode="true"] .bento-header,
  html[data-app-mode="true"] .lesson-library,
  html[data-app-mode="true"] #weak-areas-mount,
  html[data-app-mode="true"] .dash-access-banner {
    animation: none;
  }
}

/* ── Reduced shadow flicker on press ───────────────────────────── */
html[data-app-mode="true"] .bento-tile:focus-visible {
  outline: 2px solid rgba(232, 160, 32, 0.6);
  outline-offset: 2px;
}
