/* BIG KLASS STUDENT LOGBOOK V2
   Visual-only upgrade. No attendance/API logic changed.
*/

:root {
  --bk-blue: #078cff;
  --bk-electric: #00c8ff;
  --bk-dark: #030a14;
  --bk-chrome: #c8d8ec;
  --bk-glow: 0 0 12px #007bff, 0 0 26px #0055ff88;
}

/* Main Logbook panel */
.lb-chrome,
.lb-live,
.lb-extras {
  color: #f6fbff;
  border: 1px solid #557ba6 !important;
  border-radius: 18px !important;
  background:
    linear-gradient(145deg, #1e2d40, #030912 62%, #16273d) !important;
  box-shadow:
    inset 0 1px 2px #ffffff55,
    inset 0 -2px 5px #000,
    0 5px 18px #0009 !important;
}

/* Diamond plate behind the logbook */
body:has(.lb-live) {
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0 18px,
      #1261a019 19px 21px,
      transparent 22px 40px
    ),
    radial-gradient(ellipse at 50% 0%, #073c78, #030812 65%)
    fixed !important;
}

/* Turn the live activity panel into a dashboard */
.lb-live {
  border: 2px solid #009dff !important;
  padding: 20px !important;
  min-height: 110px;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow:
    inset 0 0 24px #0077ff30,
    0 0 12px #008cff88 !important;
}

.lb-kicker,
.lb-live .small {
  color: #56d8ff !important;
  font-family: Arial, sans-serif !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

#lbCurrent {
  color: white !important;
  font-family: Arial, sans-serif !important;
  font-size: clamp(21px, 5vw, 31px) !important;
  font-weight: 900 !important;
  line-height: 1.2;
  margin: 8px 0 !important;
  text-shadow: 0 2px 9px #000;
}

.lb-clock {
  flex-shrink: 0;
  text-align: right;
}

#lbElapsed {
  font-family: Arial, sans-serif !important;
  font-size: clamp(23px, 5vw, 33px) !important;
  font-weight: 900 !important;
  color: #39cfff !important;
  text-shadow: 0 0 14px #007bff;
  font-variant-numeric: tabular-nums;
}

/* ON DUTY and OFF DUTY */
.lb-attendance {
  display: grid !important;
  grid-template-columns: 1
cd ~/Desktop/klass-logbook-v2/source || exit 1

cp index.html "index.backup-$(date +%Y%m%d-%H%M%S).html"

cat > logbook-v2.css <<'CSS'
/* BIG KLASS STUDENT LOGBOOK V2
   Visual-only upgrade. No attendance/API logic changed.
*/

:root {
  --bk-blue: #078cff;
  --bk-electric: #00c8ff;
  --bk-dark: #030a14;
  --bk-chrome: #c8d8ec;
  --bk-glow: 0 0 12px #007bff, 0 0 26px #0055ff88;
}

/* Main Logbook panel */
.lb-chrome,
.lb-live,
.lb-extras {
  color: #f6fbff;
  border: 1px solid #557ba6 !important;
  border-radius: 18px !important;
  background:
    linear-gradient(145deg, #1e2d40, #030912 62%, #16273d) !important;
  box-shadow:
    inset 0 1px 2px #ffffff55,
    inset 0 -2px 5px #000,
    0 5px 18px #0009 !important;
}

/* Diamond plate behind the logbook */
body:has(.lb-live) {
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0 18px,
      #1261a019 19px 21px,
      transparent 22px 40px
    ),
    radial-gradient(ellipse at 50% 0%, #073c78, #030812 65%)
    fixed !important;
}

/* Turn the live activity panel into a dashboard */
.lb-live {
  border: 2px solid #009dff !important;
  padding: 20px !important;
  min-height: 110px;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow:
    inset 0 0 24px #0077ff30,
    0 0 12px #008cff88 !important;
}

.lb-kicker,
.lb-live .small {
  color: #56d8ff !important;
  font-family: Arial, sans-serif !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

#lbCurrent {
  color: white !important;
  font-family: Arial, sans-serif !important;
  font-size: clamp(21px, 5vw, 31px) !important;
  font-weight: 900 !important;
  line-height: 1.2;
  margin: 8px 0 !important;
  text-shadow: 0 2px 9px #000;
}

.lb-clock {
  flex-shrink: 0;
  text-align: right;
}

#lbElapsed {
  font-family: Arial, sans-serif !important;
  font-size: clamp(23px, 5vw, 33px) !important;
  font-weight: 900 !important;
  color: #39cfff !important;
  text-shadow: 0 0 14px #007bff;
  font-variant-numeric: tabular-nums;
}

/* ON DUTY and OFF DUTY */
.lb-attendance {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 12px !important;
  margin: 16px 0 !important;
}

#lbOnDuty,
#lbOffDuty {
  min-height: 75px !important;
  border-radius: 14px !important;
  font: 900 19px Arial, sans-serif !important;
  letter-spacing: 1px;
  color: white !important;
  text-shadow: 0 2px 5px #000;
  border: 2px solid #8acaff !important;
  background: linear-gradient(
    180deg, #087bdf, #003c83
  ) !important;
  box-shadow:
    inset 0 2px 3px #ffffff55,
    0 0 12px #006fff66 !important;
}

#lbOffDuty {
  border-color: #7d91a6 !important;
  background: linear-gradient(
    180deg, #34475d, #0b1727
  ) !important;
  box-shadow: inset 0 2px 3px #ffffff33 !important;
}

#lbOnDuty span,
#lbOffDuty span {
  display: block;
  margin-top: 5px;
  font: 600 11px Arial, sans-serif !important;
  letter-spacing: 0;
  color: #b8dfff;
}

/* Giant activity buttons */
.train-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
}

.train-btn {
  min-width: 0 !important;
  min-height: 112px !important;
  padding: 17px 12px !important;
  border-radius: 16px !important;
  color: #fff !important;
  border: 2px solid #839bb4 !important;
  background:
    linear-gradient(135deg, #26364a, #030912 75%) !important;
  box-shadow:
    inset 0 2px 3px #ffffff33,
    0 4px 10px #000b !important;
  font: 800 17px Arial, sans-serif !important;
  text-align: center !important;
  transition:
    background .15s ease,
    border-color .15s ease,
    box-shadow .15s ease;
}

.train-btn svg,
.train-btn i {
  color: #54c9ff !important;
}

.train-btn.selected,
.train-btn[aria-pressed="true"] {
  border-color: #b8eeff !important;
  background:
    linear-gradient(145deg, #007cf7, #004bbb) !important;
  box-shadow:
    inset 0 0 15px #9bdfff55,
    0 0 14px #00aaff,
    0 0 25px #006bff66 !important;
}

.train-btn.selected svg,
.train-btn.selected i {
  color: #fff !important;
}

/* More activities / details */
.lb-extras {
  padding: 15px !important;
  margin-top: 14px !important;
}

.lb-extras summary {
  color: #e6f6ff !important;
  font: 800 14px Arial, sans-serif !important;
  cursor: pointer;
}

/* Action buttons */
.lb-save-row {
  display: flex !important;
  gap: 10px !important;
}

#saveDuty,
.save-duty {
  min-height: 62px !important;
  border-radius: 14px !important;
  border: 2px solid #87dfff !important;
  background: linear-gradient(
    180deg, #00baff, #0874ef 55%, #0048bf
  ) !important;
  color: white !important;
  font: 900 17px Arial, sans-serif !important;
  letter-spacing: .5px;
  box-shadow:
    inset 0 2px 3px #ffffff77,
    0 0 17px #007bff99 !important;
}

#refreshDuty {
  border-radius: 12px !important;
  border: 1px solid #278ec9 !important;
  color: #c7eeff !important;
  background: #09243d !important;
}

/* Better readability */
body:has(.lb-live) button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body:has(.lb-live) button:focus-visible {
  outline: 3px solid #65e0ff !important;
  outline-offset: 3px;
}

body:has(.lb-live) h1,
body:has(.lb-live) h2,
body:has(.lb-live) h3 {
  text-shadow: 0 2px 10px #000;
}

/* iPhone and narrow Android screens */
@media (max-width: 420px) {
  .lb-live {
    padding: 13px !important;
  }

  .train-grid {
    gap: 9px !important;
  }

  .train-btn {
    min-height: 100px !important;
    padding: 12px 8px !important;
    font-size: 15px !important;
  }

  #lbOnDuty,
  #lbOffDuty {
    font-size: 15px !important;
    padding: 10px 5px !important;
  }

  #lbElapsed {
    font-size: 22px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .train-btn {
    transition: none !important;
  }
}

/* BIG KLASS CHROME & LIGHTNING HERO */
#screen-logbook .bk-hero {
  position: relative;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end;
  align-items: center;
  min-height: 245px;
  margin: 0 0 18px;
  padding: 22px 12px 18px;
  overflow: hidden;
  isolation: isolate;
  border: 2px solid #6a9fc9;
  border-radius: 20px;
  background:
    linear-gradient(180deg,
      #02081422 0%,
      #05162b88 40%,
      #020610 95%),
    url('/truck.jpeg') center 44% / cover no-repeat,
    #040c18;
  box-shadow:
    inset 0 0 35px #006dff55,
    0 0 22px #007cff77,
    0 8px 24px #000b;
}

#screen-logbook .bk-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(115deg,
      transparent 18%,
      #00baff66 19%,
      transparent 21%,
      transparent 64%,
      #00baff99 65%,
      transparent 67%);
  filter: drop-shadow(0 0 12px #008cff);
  pointer-events: none;
}

#screen-logbook .bk-hero-logo {
  width: min(86%, 295px) !important;
  height: 125px !important;
  object-fit: contain !important;
  filter:
    drop-shadow(0 4px 3px #000)
    drop-shadow(0 0 12px #008cff);
}

#screen-logbook .bk-hero-title {
  margin: 3px 0 0 !important;
  font-family: Impact, "Arial Black", sans-serif !important;
  font-size: clamp(43px, 12vw, 66px) !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  letter-spacing: 4px;
  text-align: center;
  color: #dceeff !important;
  -webkit-text-stroke: 1px #567a9d;
  text-shadow:
    0 2px 0 #8dacc7,
    0 4px 0 #284b70,
    0 6px 0 #07172b,
    0 8px 12px #000,
    0 0 22px #008cff;
}

@media (max-width: 390px) {
  #screen-logbook .bk-hero {
    min-height: 205px;
  }

  #screen-logbook .bk-hero-logo {
    height: 105px !important;
  }
}

/* BIG KLASS LOGBOOK HEADER ARTWORK */
#screen-logbook .bk-hero {
  min-height: 260px !important;
  background: #030914 url('/bigklass_logbook_hero.png')
    center / cover no-repeat !important;
}

#screen-logbook .bk-hero-logo,
#screen-logbook .bk-hero-title,
#screen-logbook .bk-lightning {
  display: none !important;
}
