﻿/* ============================================
   EQ Ninjas — App UI Kit (visual components)
   - No global page layout here
   - Buttons, Loading, Start/Error UI, Nav, etc.
   ============================================ */

:root {
  --pico-nav-element-spacing-vertical: .5rem;
  --pico-nav-element-spacing-horizontal: .5rem;
  --pico-border-radius: var(--eqn-button-radius-sm);
  --eqn-button-radius: 14px;
  --eqn-button-radius-sm: 12px;
  --eqn-button-radius-pill: 999px;
  --section-background-color: #83a7ef;
  --section-border-color: #526ca1ba;
}

button,
[role="button"],
.btn {
  border-radius: var(--eqn-button-radius);
}

body {
   display: grid;
   grid-template-rows: min-content 1fr min-content;
   max-width: 750px;
}

.container-fluid {
   padding: 0;
}

nav {
    width: inherit;
    margin-left: auto; 
    margin-right: auto;
    padding-left: var(--pico-nav-element-spacing-vertical);
    padding-right: var(--pico-nav-element-spacing-vertical);
    border-bottom: var(--section-border-color) 4px solid;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.3);
}

footer {
    padding-block: initial !important;
    margin-left: auto;
    margin-right: auto;
    width: inherit;
    display: flex;
    align-items: center;
    justify-content: space-around;
    overflow: hidden;
}

.bar {
    border-top: var(--section-border-color) 4px solid;
    box-shadow: 0 -10px 15px rgba(0, 0, 0, 0.5);
}

nav, footer {
    z-index: 1;
    background-color: var(--section-background-color);
}

footer > button {
    border-radius: 0;
    background-color: var(--section-background-color);
    padding: 5px;
    border: none;
}

footer > h4 {
    text-align: center;
    color: var(--pico-code-background-color);
}

footer > div {
    align-content: center;
}

footer > img {
    margin-top: 5px;
    margin-bottom: 5px;
}

footer > button > img {
    max-height: 90px;
}

progress {
    height: 20px;
    margin: 0;
    overflow: hidden;
    box-shadow: 0 0 7px rgba(255, 143, 0, 0.82);
}

progress:indeterminate {
    animation: progress-indeterminate 3s linear infinite;
}

.progress-badge {
    width: 50px;
    border-radius: 50%;
    background: var(--pico-progress-background-color);
    position: relative;
}

.activity-footer {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: .25rem;
    padding: .4rem .7rem !important;
}

.activity-footer .activity-footer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
}

.activity-footer .activity-footer-title {
    margin: 0;
    font-size: .95rem;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-footer .activity-footer-percent {
    font-size: .95rem;
    font-weight: 800;
    color: var(--pico-code-background-color);
    line-height: 1;
}

.activity-footer progress {
    width: 100%;
    height: 8px;
    box-shadow: none;
}

/* ---------- Validation ---------- */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid red; }
.validation-message { color: red; }

/* ---------- Loading UI ---------- */
.eqn-loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.eqn-loading-inline {
  min-height: 100svh;
}

.eqn-loading-logo {
  width: clamp(82px, 24vw, 116px);
  height: clamp(82px, 24vw, 116px);
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(24, 34, 58, .15));
}

.eqn-loading-ring {
  position: relative;
  width: clamp(82px, 23vw, 106px);
  height: 12px;
  margin-top: 8px;
}

.eqn-loading-ring span {
  position: absolute;
  top: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #172033;
  animation: eqnLoadingDot 1.05s ease-in-out infinite;
}

.eqn-loading-ring span:nth-child(1) { left: 0; background: #2a80db; }
.eqn-loading-ring span:nth-child(2) { left: calc(50% - 6px); background: #ffbf00; animation-delay: .14s; }
.eqn-loading-ring span:nth-child(3) { right: 0; background: #1d9a59; animation-delay: .28s; }

.eqn-loading-container h1 {
  margin: 0;
  color: #172033;
  font-family: "Fredoka", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 2.65rem;
  line-height: 1;
  letter-spacing: 0;
}

.eqn-loading-container p {
  margin: 0;
  color: #26324b;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

@keyframes eqnLoadingDot {
  0%, 100% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-10px) scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
  .eqn-loading-ring span { animation: none; }
}

@media (max-width: 420px), (max-height: 620px) {
  .eqn-loading-container h1 { font-size: 2.2rem; }
  .eqn-loading p { font-size: .98rem; }
}

/* ---------- Start Screen ---------- */
.start-overlay {
  position: absolute; inset: 0;
  /* Old gradient background, preserved in case we want to bring it back.
  background: linear-gradient(to bottom right, #f0f8ff, #e0f7fa);
  */
  background: #f9fbff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; font-family: 'Baloo 2', cursive; z-index: 999;
}
.start-message { font-size: 2rem; margin-bottom: 2rem; color: #333; }
.start-button {
  font-size: 1.5rem; padding: 1rem 2rem; border: none; border-radius: 12px;
  background-color: #ff9800; color: #fff; cursor: pointer; transition: background .3s ease;
}
body:not(.is-touch) .start-button:hover { background-color: #fb8c00; }

/* ---------- Error UI ---------- */
#blazor-error-ui {
  background: lightyellow; color: black;
  position: fixed; bottom: 0; left: 0; width: 100%;
  padding: 0.6rem 1.25rem; box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
  z-index: 1000; display: none;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; top: 0.5rem; right: 0.75rem; }
.blazor-error-boundary::after { content: "An error has occurred."; }

/* ---------- Highlighting (component-level overrides can extend) ---------- */
.word-span.highlighted { background-color: #ffe066 !important; border-radius: 4px; position: relative; z-index: 1; color: var(--pico-color) }
.word-group .word-span.highlighted { background-color: #ffe066 !important; border-radius: 4px; color: var(--pico-color) }

/* ---------- Touch mode tweaks ---------- */
body.is-touch .choice-button, body.is-touch .popup-button { transition: none; outline: none; }

/* ---------- Navigation (desktop) ---------- */
.nav-toggler { background-color: rgba(255, 255, 255, 0.1); }
.nav-top-row { min-height: 3.5rem; background-color: rgba(0,0,0,0.4); }
.nav-brand { font-size: 1.1rem; }
.bi { display: inline-block; position: relative; width: 1.25rem; height: 1.25rem; margin-right: 0.75rem; top: -1px; background-size: cover; }
.bi-house-door-fill-nav-menu { background-image: url("data:image/svg+xml,..."); }
.bi-plus-square-fill-nav-menu { background-image: url("data:image/svg+xml,..."); }
.bi-list-nested-nav-menu { background-image: url("data:image/svg+xml,..."); }
.nav-item { font-size: 0.9rem; padding-bottom: 0.5rem; }
.nav-item:first-of-type { padding-top: 1rem; }
.nav-item:last-of-type { padding-bottom: 1rem; }
.nav-item ::deep a {
  color: #d7d7d7; border-radius: 4px; height: 3rem; display: flex; align-items: center; line-height: 3rem;
}
.nav-item ::deep a.active { background-color: rgba(255,255,255,0.37); color: #fff; }
.nav-item ::deep a:hover  { background-color: rgba(255,255,255,0.1);  color: #fff; }

/* Desktop media fixes; .nav-scrollable 100svh now lives in layout.css */
@media (min-width: 641px) {
  .nav-toggler { display: none; }
  .collapse { display: block; }
}

/* ---------- Tiny extras ---------- */
h1:focus { outline: none; }

/* ============================================
   EQ Ninjas — Image Utilities (global, shared)
   - Use a single wrapper: .eqn-img
   - Tune with CSS var: --eqn-img-max-svh
   ============================================ */

/* Sensible defaults; override per screen when needed */
:root {
  --eqn-img-max-svh: 30;   /* % of safe viewport height allowed for image block */
  --eqn-img-radius: 12px;  /* global rounding */
  --eqn-img-gap: 8px;      /* space below image block */
}

/* Image wrapper: consistent rounded corners and sizing */
.eqn-img {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  max-height: clamp(140px, calc(var(--eqn-img-max-svh) * 1svh), 320px);
  margin: 0 0 var(--eqn-img-gap);

  /* remove padding & background */
  border-radius: var(--eqn-img-radius);
  overflow: hidden;
}

.eqn-img > img {
  display: block;
  max-width: 100%;
  max-height: 95%; /*shannan did this*/
  width: auto;
  height: auto;

  object-fit: contain;
  border-radius: var(--eqn-img-radius); /* ensure corners match wrapper */
}


/* Optional modifier: full-bleed hero/banner */
.eqn-img.eqn-img--cover > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Optional: fixed aspect-ratio helpers (use when you need zero layout shift) */
.eqn-img.eqn-img--ratio-16x9 { aspect-ratio: 16 / 9; }
.eqn-img.eqn-img--ratio-4x3  { aspect-ratio: 4 / 3; }
.eqn-img.eqn-img--ratio-1x1  { aspect-ratio: 1 / 1; }

/* Optional size presets (variable override is preferred; these are convenience classes) */
.eqn-img--xs { --eqn-img-max-svh: 20; }
.eqn-img--sm { --eqn-img-max-svh: 26; }
.eqn-img--md { --eqn-img-max-svh: 32; }
.eqn-img--lg { --eqn-img-max-svh: 38; }
.eqn-img--xl { --eqn-img-max-svh: 45; }

/* If images live in PageShell headers, keep a touch more breathing room */
.eqn-page .eqn-header .eqn-img { margin-bottom: 10px; }
