/* css/components/tests.css */
/* Tests section: exam/practice mode cards and grade evolution chart */

/* ── Row 1: Unified Tests card ── */
.bento-top-row--tests {
  grid-template-columns: 1fr;
}

/* ── Row 1: Top row (Summit · Ascent) ── */
.bento-top-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  grid-template-rows: auto;
  gap: 14px;
}

/* ── SUMMIT card (exam mode) ── */
.bento-card-summit {
  background: var(--card-summit);
  color: #5c3a1e;
  cursor: pointer;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.bento-card-summit .bento-card-title {
  color: #80350E;
}

/* Summit PNG illustration */
.bento-card-summit::after {
content: '';
    position: absolute;
    bottom: -30px;
    right: -10px;
    width: 240px;
    height: 300px;
    opacity: 1;
    background-image: url(../../Assets/images/Summit.png);
    background-repeat: no-repeat;
    background-size: contain;
    background-position: bottom right;
    pointer-events: none;
}

/* Ground effect for illustration cards */
.bento-card-summit::before,
.bento-card-ascent::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20%;
    opacity: 0.1;
    background: black;
    border-radius: 0 0 var(--bento-radius) var(--bento-radius);
    pointer-events: none;
    z-index: 0;
}
/* ── ASCENT card (practice mode) ── */
.bento-card-ascent {
  background: var(--card-ascent);
  color: #6b5a10;
  cursor: pointer;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.bento-card-ascent .bento-card-title {
  color: #826900;
}

/* Ascent PNG illustration */
.bento-card-ascent::after {
content: '';
    position: absolute;
    bottom: -80px;
    right: -20px;
    width: 300px;
    height: 300px;
    opacity: 1;
    background-image: url(../../Assets/images/Ascent.png);
    background-repeat: no-repeat;
    background-size: contain;
    background-position: bottom right;
    pointer-events: none;
}


/* ── MIXED (Random Mix) row ── */
.bento-mixed-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.bento-card-mixed {
  background: linear-gradient(135deg, #e0f0ff 0%, #d8e8ff 60%, #ddd8ff 100%);
  color: #2a3a6a;
  cursor: pointer;
  min-height: 80px;
  display: flex;
  align-items: center;
}

.bento-card-mixed .bento-card-title {
  color: #2a3a9a;
  display: flex;
  align-items: center;
}

/* ── Per-card hover: darker text tones ── */
.bento-card-summit:hover .bento-card-title   { color: #6a2508; }
.bento-card-summit:hover                     { color: #4a1a08; }
.bento-card-summit:hover .bento-card-hover-info { color: #7a2a10; }

.bento-card-ascent:hover .bento-card-title   { color: #6a5500; }
.bento-card-ascent:hover                     { color: #4a3a08; }
.bento-card-ascent:hover .bento-card-hover-info { color: #7a6000; }

.bento-card-mixed:hover .bento-card-title    { color: #6878c8; }
.bento-card-mixed:hover                      { color: #6878a0; }
.bento-card-mixed:hover .bento-card-hover-info { color: #7080b8; }

.bento-card-mixed.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .bento-top-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .bento-card-summit,
  .bento-card-ascent {
    min-height: 70px !important;
  }

  .bento-card-summit::before,
  .bento-card-ascent::before,
  .bento-card-summit::after,
  .bento-card-ascent::after {
    display: none !important;
  }
}

/* ── Grade Evolution Section (rendered in main-content) ──────────────── */
.grade-evolution-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  animation: slideDown 0.25s ease-out;
}
.grade-evolution-modal {
  background: linear-gradient(165deg, #ddf4ff 0%, #f0f9ff 38%, #ffffff 100%);
  border: 2px solid #bce7ff;
  border-bottom: 5px solid #8fd4f7;
  border-radius: 24px;
  padding: 28px 22px 22px;
  max-width: 760px;
  width: min(96vw, 760px);
  max-height: min(90vh, 720px);
  overflow: auto;
  position: relative;
  box-shadow: 0 18px 50px rgba(28, 176, 246, 0.18);
  -webkit-overflow-scrolling: touch;
  font-family: 'Nunito', sans-serif;
}
.grade-evolution-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #fff;
  border: 2px solid #e5e5e5;
  border-bottom: 3px solid #d0d0d0;
  color: #777;
  cursor: pointer;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: border-color 0.15s, color 0.15s, transform 0.1s;
}
.grade-evolution-modal-close .material-symbols-outlined {
  font-size: 1.15rem;
  line-height: 1;
}
.grade-evolution-modal-close:hover {
  border-color: #1cb0f6;
  border-bottom-color: #1899d6;
  color: #1cb0f6;
}
.grade-evolution-modal-close:active {
  transform: translateY(1px);
  border-bottom-width: 2px;
}
.grade-evolution-modal-header {
  margin-bottom: 18px;
  padding-right: 44px;
}

.grade-evolution-header-main {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.grade-evolution-header-text {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.grade-evolution-hero-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  margin: 0;
  border-radius: 16px;
  background: linear-gradient(145deg, #1cb0f6, #1899d6);
  border: 2px solid #1899d6;
  box-shadow: 0 4px 0 #1480b8;
  display: flex;
  align-items: center;
  justify-content: center;
}
.grade-evolution-hero-icon .material-symbols-outlined {
  font-size: 1.75rem;
  color: #fff;
  line-height: 1;
}
.grade-evolution-modal-header .subpage-title {
  font-family: 'Nunito', sans-serif;
  font-size: 1.45rem;
  font-weight: 900;
  color: #3c3c3c;
  margin-bottom: 2px;
  line-height: 1.1;
}
.grade-evolution-level-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-start;
  padding: 5px 12px;
  border-radius: 100px;
  background: #fff;
  border: 2px solid #1cb0f6;
  color: #1899d6;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
}
.grade-evolution-modal-header .subpage-subtitle {
  font-family: 'Nunito', sans-serif;
  font-size: 0.86rem;
  font-weight: 600;
  color: #777;
  line-height: 1.3;
}
.grade-evolution-stat-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 0;
}
.grade-evolution-stat {
  min-width: 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #e5e5e5;
  border-bottom: 3px solid #d0d0d0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.grade-evolution-stat-val {
  font-size: 1.35rem;
  font-weight: 900;
  color: #3c3c3c;
  line-height: 1;
}
.grade-evolution-stat-lbl {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #afafaf;
}
@media (max-width: 520px) {
  .grade-evolution-header-main {
    gap: 10px;
  }
  .grade-evolution-hero-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
  }
  .grade-evolution-modal-header .subpage-title {
    font-size: 1.25rem;
  }
}

/* Mobile: grade evolution as bottom sheet */
@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .grade-evolution-modal-overlay {
    align-items: flex-end;
    padding: 0;
    animation: none;
  }

  .grade-evolution-modal {
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    border-radius: 28px 28px 0 0;
    border-bottom: none;
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    animation: duoSheetUp 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
  }

  .grade-evolution-modal::before {
    content: '';
    display: block;
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: rgba(28, 176, 246, 0.25);
    margin: 0 auto 12px;
  }

  .grade-evolution-modal-close {
    top: 16px;
    right: 14px;
  }
}
.grade-evolution-section {
  width: 100%;
}
.grade-evolution-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.grade-evolution-expand-btn {
  order: -1;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 14px;
  border: 2px solid #e5e5e5;
  border-bottom: 3px solid #d0d0d0;
  background: #fff;
  color: #4b4b4b;
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  margin: 0 0 -8px 0;
  transition: border-color 0.15s, color 0.15s, transform 0.1s;
}
.grade-evolution-expand-btn .material-symbols-outlined {
  font-size: 1.1rem;
}
@media (hover: hover) and (pointer: fine) {
  .grade-evolution-expand-btn:hover {
    border-color: #1cb0f6;
    border-bottom-color: #1899d6;
    color: #1899d6;
  }
}
.grade-evolution-expand-btn:active {
  transform: translateY(1px);
  border-bottom-width: 2px;
}
.grade-evolution-body-inner {
  width: 100%;
}
.grade-evolution-section.grade-evolution-expanded .grade-evolution-body-inner {
  position: fixed;
  z-index: 2200;
  inset: max(10px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  background: linear-gradient(165deg, #ddf4ff 0%, #ffffff 100%);
  border: 2px solid #bce7ff;
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.28);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px 18px;
  box-sizing: border-box;
}
.grade-evolution-section.grade-evolution-expanded .grade-evolution-expand-btn {
  position: fixed;
  z-index: 2201;
  top: max(14px, calc(env(safe-area-inset-top, 0px) + 8px));
  right: max(14px, calc(env(safe-area-inset-right, 0px) + 8px));
  margin: 0;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}
.grade-evolution-section.grade-evolution-expanded .ge-chart-svg {
  width: 100%;
  height: auto;
  max-height: min(88vh, 88vw);
}
@media (orientation: landscape) and (max-height: 520px) {
  .grade-evolution-section.grade-evolution-expanded .ge-chart-svg {
    max-height: min(92vh, 96vw);
  }
}
.grade-evo-no-data {
  font-family: 'Nunito', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: #777;
  padding: 36px 16px;
  text-align: center;
}
.grade-evo-no-data i {
  margin-right: 6px;
  opacity: 0.5;
}
/* ── Grade Evolution dot chart ───────────────────────────────────────── */
.ge-chart-card {
  background: #fff;
  border-radius: 20px;
  padding: 16px 14px 14px;
  box-shadow: none;
  border: 2px solid #e5e5e5;
  border-bottom: 4px solid #d0d0d0;
}
.ge-chart-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
  font-family: 'Nunito', sans-serif;
}
.ge-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #eef2f7;
}
.ge-legend-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 2px solid var(--ge-color, #1cb0f6);
  border-bottom: 3px solid color-mix(in srgb, var(--ge-color, #1cb0f6) 70%, #000);
  border-radius: 100px;
  background: #fff;
  color: #4b4b4b;
  font-family: 'Nunito', sans-serif;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  opacity: 0.5;
}
.ge-legend-btn.active {
  background: color-mix(in srgb, var(--ge-color, #1cb0f6) 12%, #fff);
  opacity: 1;
}
.ge-legend-btn:active {
  transform: translateY(1px);
  border-bottom-width: 2px;
}
.ge-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.ge-legend-dash {
  width: 16px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}
/* ── Grade Evolution floating tooltip ───────────────────────────────── */
.ge-tip {
  position: fixed;
  background: #3c3c3c;
  color: #fff;
  padding: 6px 14px;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  pointer-events: none;
  z-index: 9999;
  display: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border-left: 4px solid var(--ge-tip-color, #1cb0f6);
}

@media (max-width: 480px) {
  .ge-tip {
    max-width: calc(100vw - 24px);
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

