/* ===================== RESET / BASE ===================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root{
  --navy: #0f2a4d;
  --navy-dark: #0a1e3a;
  --blue: #123a6b;
  --blue-light: #e8edf5;
  --green: #1b8a5a;
  --gray-bg: #f4f6fa;
  --gray-line: #e3e7ee;
  --text: #1c2530;
  --text-mute: #8792a2;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(15,42,77,0.06);
  --shadow-md: 0 8px 30px rgba(15,42,77,0.14);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: #fff;
  overflow: hidden;
}

#appStatus {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #fff;
  color: var(--navy);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ===================== APP LAYOUT ===================== */
.app {
  display: grid;
  grid-template-columns: 230px 300px 1fr;
  height: 100vh;
  width: 100vw;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  background: var(--gray-bg);
  border-right: 1px solid var(--gray-line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 28px; }
.brand-mark { display: block; width: 80%; max-width: 120px; height: auto; flex-shrink: 0; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; font-size: 17px; color: var(--green); }
.brand-sub { font-weight: 700; font-size: 15px; color: var(--navy); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-gap { height: 18px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-item:hover { background: #e6eaf1; }
.nav-item.active {
  background: var(--navy-dark);
  color: #fff;
}
.nav-item-disabled {
  color: var(--text-mute);
  cursor: not-allowed;
  opacity: .55;
  pointer-events: none;
}

/* Radiate the primary section links (AI scribe, Upload, Patients) on hover. */
#navScribe,
#navUpload,
#navPatients,
#navSettings {
  position: relative;
  z-index: 1;
}
#navScribe:hover,
#navUpload:hover,
#navPatients:hover,
#navSettings:hover {
  background: var(--navy-dark);
  color: #fff;
  animation: navRadiatePulse 1.8s ease-in-out infinite;
}
#navScribe:hover svg,
#navUpload:hover svg,
#navPatients:hover svg,
#navSettings:hover svg {
  color: #fff;
}
#navScribe:hover::after,
#navUpload:hover::after,
#navPatients:hover::after,
#navSettings:hover::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  pointer-events: none;
  animation: navRadiateRing 1.8s ease-out infinite;
}
@keyframes navRadiatePulse {
  50% { box-shadow: 0 0 0 7px rgba(15, 42, 77, 0.16); }
}
@keyframes navRadiateRing {
  0% { box-shadow: 0 0 0 0 rgba(15, 42, 77, 0.35); opacity: .8; }
  100% { box-shadow: 0 0 0 10px rgba(15, 42, 77, 0); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  #navScribe:hover,
  #navUpload:hover,
  #navPatients:hover,
  #navSettings:hover,
  #navScribe:hover::after,
  #navUpload:hover::after,
  #navPatients:hover::after,
  #navSettings:hover::after {
    animation: none;
  }
}

/* ===================== SESSION COLUMN ===================== */
.session-col {
  border-right: 1px solid var(--gray-line);
  padding: 22px 20px 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

/* generic mode panel (scribe vs upload) filling its column */
.panel {
  display: none;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  width: 100%;
}
.panel.active { display: flex; }
.session-col .panel { flex: 1; min-height: 0; }
.main-col .panel { flex: 1; min-height: 0; }
.session-title { font-size: 26px; font-weight: 800; margin-bottom: 16px; }
.btn {
  font-size: 14.5px;
  font-weight: 600;
  border-radius: 8px;
  padding: 12px 18px;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--blue); box-shadow: var(--shadow); }
.btn-secondary { background: #fff; color: var(--navy); border: 1px solid var(--gray-line); }
.btn-secondary:hover { background: var(--blue-light); }

.search-box {
  margin-top: 14px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-box input {
  width: 100%;
  padding: 10px 38px 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--gray-line);
  background: var(--gray-bg);
  font-size: 14px;
  outline: none;
}
.search-box input:focus { border-color: var(--navy); }
.search-box svg { position: absolute; right: 12px; width: 17px; height: 17px; color: var(--text-mute); }

.session-list {
  margin-top: 18px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 2px;
}
.session-date-label {
  font-size: 12.5px;
  color: var(--text-mute);
  margin: 14px 0 8px;
  font-weight: 600;
}
.session-date-label:first-child { margin-top: 0; }
.session-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 8px;
  cursor: default;
  animation: fadeSlideIn .35s ease;
}
.session-card input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--navy); flex-shrink: 0; }
.session-card:hover { background: var(--gray-bg); }
.session-name { font-size: 14.5px; font-weight: 700; color: var(--blue); }
.session-meta { font-size: 12.5px; color: var(--text-mute); margin-top: 1px; }
.session-time { margin-left: auto; font-size: 12px; color: var(--text-mute); }
.session-card.highlight { background: var(--blue-light); }

.session-actions {
  display: flex;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--gray-line);
  margin-top: 10px;
}
.icon-btn {
  width: 34px; height: 34px;
  border-radius: 7px;
  background: var(--navy);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.danger { background: #fdece9; color: #d1452b; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===================== MAIN COLUMN ===================== */
.main-col {
  padding: 22px 28px 22px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
}
.main-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
}
.patient-input-wrap {
  flex: 1;
  max-width: 480px;
  background: var(--gray-bg);
  border-radius: 8px;
  padding: 8px 16px;
  position: relative;
}
.patient-input-wrap label {
  display: block;
  font-size: 10.5px;
  color: var(--text-mute);
  margin-bottom: 1px;
}
.patient-input-wrap input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 15px;
  width: 100%;
  color: var(--text);
  font-weight: 500;
}
.patient-input-wrap input::placeholder { color: #b7bfcb; }

.mins-left {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--green) 130%);
  color: #fff;
  font-weight: 700;
  font-size: 14.5px;
  padding: 11px 20px;
  border-radius: 24px;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.mins-left svg { width: 16px; height: 16px; fill: #ffd93d; stroke: none; }

.main-stage {
  flex: 1;
  min-height: 0;
  border-radius: 14px;
  border: 1px solid var(--gray-line);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  background: #fff;
}

/* generic screen wrapper */
.screen {
  position: absolute;
  inset: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .35s ease, transform .35s ease;
  overflow-y: auto;
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}


/* ===================== TOAST / BOTTOM MESSAGE BAR ===================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%) translateY(20px);
  min-width: 220px;
  max-width: 90vw;
  background: var(--navy-dark);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 13px 22px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.toast.success { background: var(--green); }
.toast.error   { background: #d1452b; }
.toast .toast-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}

/* ===================== PERSISTENT GUIDE BAR ===================== */
.guide-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: linear-gradient(90deg, #083a64 0%, #0f2a4d 55%, #1b8a5a 140%);
  color: #ffffff;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 -8px 30px rgba(6, 24, 40, 0.18);
  transform: translateY(100%);
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
  z-index: 180;
}
.guide-bar.show {
  transform: translateY(0);
  opacity: 1;
}

.guide-bar__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.guide-bar__step {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  opacity: .7;
}

.guide-bar__step:empty,
.guide-bar__flow:empty {
  display: none;
}

.guide-bar__flow {
  font-size: 12.5px;
  font-weight: 700;
  opacity: .92;
}

.guide-bar__text {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.82);
}

.guide-bar__buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.guide-bar__back,
.guide-bar__action,
.guide-bar__close {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: transparent;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  transition: background .18s ease, border-color .18s ease;
}

.guide-bar__back:hover,
.guide-bar__action:hover,
.guide-bar__close:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.45);
}

.guide-reopen-btn {
  position: fixed;
  right: 16px;
  bottom: 14px;
  z-index: 190;
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--navy-dark);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: var(--shadow-md);
  transition: background .18s ease;
}

.guide-reopen-btn:hover {
  background: var(--blue);
}

@media (max-width: 760px) {
  .toast {
    bottom: 102px;
  }

  .guide-bar {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px 14px;
  }

  .guide-bar__buttons {
    width: 100%;
  }

  .guide-bar__back,
  .guide-bar__action,
  .guide-bar__close {
    flex: 1;
  }

  .guide-reopen-btn {
    right: 12px;
    bottom: 10px;
  }
}