/* css/components/main-nav.css — Duolingo-style main navigation */

/* ── Left sidebar navigation ── */
.main-nav-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.main-nav-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 8px 20px;
  text-decoration: none;
  cursor: pointer;
}

.main-nav-logo {
  height: 56px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.main-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.main-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #4b4b4b;
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-align: left;
}

.main-nav-item:hover {
  background: #f7f7f7;
}

.main-nav-item.active {
  background: #ddf4ff;
  border-color: #84d8ff;
  color: #1899d6;
}

.main-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--nav-color, #1cb0f6) 18%, white);
  flex-shrink: 0;
}

.main-nav-icon .material-symbols-outlined {
  font-size: 1.2rem;
  color: var(--nav-color, #1cb0f6);
}

.main-nav-item.active .main-nav-icon {
  background: color-mix(in srgb, #1899d6 18%, white);
}

.main-nav-item.active .main-nav-icon .material-symbols-outlined {
  color: #1899d6;
}

.main-nav-label {
  flex: 1;
  min-width: 0;
}

/* ── Right sidebar stats bar (Duolingo-style top row) ── */
.main-nav-stats-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: 100%;
  padding: 0 0 16px;
  flex-wrap: wrap;
  box-sizing: border-box;
}

.stats-bar-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  border: none;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  color: #4b4b4b;
  cursor: default;
  min-height: 40px;
  box-sizing: border-box;
}

button.stats-bar-item {
  cursor: pointer;
  transition: background 0.15s;
}

button.stats-bar-item:hover,
button.stats-bar-item.is-active {
  background: #f0f0f0;
}

.stats-bar-item .material-symbols-outlined {
  font-size: 1.35rem;
}

.stats-bar-streak .material-symbols-outlined {
  color: #ff9600;
}

.stats-bar-streak-inactive .material-symbols-outlined,
.stats-bar-streak-inactive strong {
  color: #afafaf;
}

.stats-bar-xp .material-symbols-outlined,
.stats-bar-xp strong {
  color: #1cb0f6;
}

.stats-bar-level {
  font-weight: 900;
}

/* ── Streak popover (Duolingo-style) ── */
.stats-bar-streak-wrap {
  position: relative;
  display: inline-flex;
}

.streak-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.streak-popover.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.streak-popover::before {
  content: '';
  position: absolute;
  top: -8px;
  right: 28px;
  width: 16px;
  height: 16px;
  background: #fff8e6;
  border-left: 2px solid #f0e0b8;
  border-top: 2px solid #f0e0b8;
  transform: rotate(45deg);
  border-radius: 2px 0 0 0;
}

.streak-popover-inner {
  background: #fff8e6;
  border: 2px solid #f0e0b8;
  border-radius: 16px;
  padding: 20px 18px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.streak-popover-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  position: relative;
}

.streak-popover-count {
  font-family: 'Nunito', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  color: #ce7c3a;
  margin-bottom: 6px;
  line-height: 1.2;
}

.streak-popover-desc {
  font-family: 'Nunito', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: #5c5c5c;
  line-height: 1.35;
  max-width: 200px;
}

.streak-popover-flame-bg {
  font-size: 4.5rem !important;
  color: rgba(206, 124, 58, 0.18);
  flex-shrink: 0;
  line-height: 1;
  user-select: none;
}

.streak-popover-week {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  background: #fff;
  border-radius: 14px;
  padding: 14px 12px 12px;
  border: 2px solid #ebebeb;
}

.streak-week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.streak-week-label {
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  color: #afafaf;
  text-transform: uppercase;
}

.streak-week-today .streak-week-label {
  color: #ff9600;
}

.streak-week-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e5e5e5;
  display: block;
}

.streak-week-done .streak-week-circle {
  background: #1cb0f6;
  position: relative;
}

.streak-week-done .streak-week-circle::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
}

.streak-week-today.streak-week-done .streak-week-circle {
  background: #ff9600;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
}

.streak-week-today.streak-week-done .streak-week-circle::after {
  transform: rotate(45deg);
}

/* ── Desktop mode cards (Duolingo-style center content) ── */
.desktop-mode-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mode-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 4px 16px;
  padding: 22px 24px;
  background-color: #fff;
  background-image: repeating-linear-gradient(
    -45deg,
    #fff,
    #fff 12px,
    #f5f5f5 12px,
    #f5f5f5 24px
  );
  border: 2px solid #e5e5e5;
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.mode-card:hover {
  border-color: #d0d0d0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.mode-card-icon {
  display: none;
}

.mode-card-body {
  grid-column: 1;
  grid-row: 1 / span 2;
  min-width: 0;
}

.mode-card-kicker {
  font-family: 'Nunito', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.mode-card-kicker-text {
  color: #afafaf;
}

.mode-card-kicker-link {
  color: #1cb0f6;
}

.mode-card-title {
  font-family: 'Nunito', sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  color: #3c3c3c;
  margin-bottom: 8px;
  line-height: 1.15;
}

.mode-card-status {
  font-family: 'Nunito', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: #777;
}

.mode-card-status-done {
  color: #58cc02;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.82rem;
}

.mode-card-status-done::before {
  content: '✓ ';
  font-weight: 800;
}

.mode-card-action {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  flex-shrink: 0;
  padding: 11px 18px;
  border: 2px solid #e5e5e5;
  border-bottom-width: 4px;
  border-radius: 14px;
  background: #58cc02;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s, background 0.15s;
  white-space: nowrap;
}

.mode-card-action:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.mode-card-action-outline {
  background: #fff;
  color: #1cb0f6;
  border-color: #e5e5e5;
  border-bottom-color: #d0d0d0;
}

.mode-card-action-outline:hover {
  background: #f7f7f7;
  filter: none;
}

/* ── Desktop layout: hide old bento cards, show mode cards ── */
@media (min-width: 769px) {
  .desktop-mode-cards {
    display: flex;
  }

  .bento-top-row,
  .bento-learning-row,
  .bento-progress-row,
  .bento-mixed-row,
  .bento-grade-row {
    display: none !important;
  }

  body:has(.dashboard-layout) .main-header,
  body:has(.dashboard-layout) .main-footer {
    display: none;
  }

  body:has(.dashboard-layout) .app-container {
    max-width: none;
    margin: 0;
    padding: 0 0 0 var(--dashboard-left-sidebar-width);
    background: #f7f7f7;
    min-height: 100vh;
    box-sizing: border-box;
  }

  .dashboard-layout {
    max-width: none;
    grid-template-columns: minmax(0, 1fr) var(--dashboard-right-sidebar-width);
    gap: 32px;
    padding: 24px 32px 0 24px;
    margin: 0;
  }

  .dashboard-layout > .dashboard-left-sidebar.dashboard-sidebar-shell {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100vh;
    width: var(--dashboard-left-sidebar-width);
    z-index: 50;
    padding: 16px 12px;
    background: #fff;
    border-right: 2px solid #e5e5e5;
    box-sizing: border-box;
    overflow-y: auto;
    align-self: stretch;
    max-height: none;
  }

  .dashboard-left-sidebar {
    border-right: none;
    padding-right: 0;
    position: static;
    top: auto;
    align-self: auto;
    max-height: none;
    overflow-y: visible;
  }

  .dashboard-center {
    min-width: 0;
    padding-top: 8px;
  }

  .dashboard-center .bento-center-wrapper {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
  }

  .dashboard-right-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow-y: auto;
    padding-top: 8px;
  }
}

@media (max-width: 768px) {
  body:has(.dashboard-layout) .app-container {
    padding-left: 0;
    background: var(--bg-light, #F4F7FF);
  }

  .main-nav-sidebar,
  .main-nav-stats-bar,
  .desktop-mode-cards {
    display: none !important;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  :root {
    --dashboard-right-sidebar-width: 300px;
  }

  .dashboard-layout {
    grid-template-columns: minmax(0, 1fr) var(--dashboard-right-sidebar-width);
    gap: 20px;
    padding: 20px 20px 0 16px;
  }

  .dashboard-layout > .dashboard-left-sidebar.dashboard-sidebar-shell {
    padding: 12px 10px;
  }

  .mode-card {
    padding: 18px 20px;
    gap: 4px 12px;
  }

  .mode-card-title {
    font-size: 1.4rem;
  }

  .mode-card-action {
    padding: 10px 14px;
    font-size: 0.72rem;
  }
}
