/* Study sessions (web/sessions.js) and the tools menu: the same rounded white surfaces, soft blue and
   lilac, and reading font as the rest of the website. */

/* ---------------------------------------------------------------- ☰ the tools menu */

.tools-menu {
  position: fixed;
  z-index: 1000;
  width: min(300px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  padding: 10px;
  display: grid;
  gap: 10px;
  background: #ffffff;
  border: 1px solid var(--line, #e3e9f0);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(30, 50, 80, 0.18);
  font-family: var(--global-font-family, 'StudyBuddy Lexend', sans-serif);
  color: var(--ink, #1f2a37);
  animation: tools-pop 0.14s ease-out;
}
.tools-menu[hidden] {
  display: none;
}
@keyframes tools-pop {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}
.tools-menu-title {
  padding: 4px 8px 0;
  font-size: 15px;
  font-weight: 800;
  color: #2e4057;
}
.tools-menu .nav-group + .nav-group {
  padding-top: 8px;
  border-top: 1px solid #eef2f7;
}
.tools-menu .nav-item {
  min-height: 40px;
}
.tools-menu .nav-item.is-current {
  background: linear-gradient(90deg, #e3f0ff, #f1e8fb);
  color: #2b4a7e;
}
.tools-menu .nav-item:focus-visible {
  outline: 3px solid #b4c8f0;
  outline-offset: -1px;
}

/* ☰ at the start of the document bar (over the tools that aren't the Reader) */
.doc-bar-tools {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line, #e3e9f0);
  border-radius: 10px;
  background: #ffffff;
  color: #2e4057;
  font: inherit;
  font-size: 17px;
  cursor: pointer;
}
.doc-bar-tools:hover,
.doc-bar-tools[aria-expanded='true'] {
  background: #eef4ff;
  border-color: #c9d8f2;
}

/* ---------------------------------------------------------------- the menu on the left: your sessions */

.sessions-nav {
  /* A column: the head and the list at the top, Home and the extension always at the bottom. */
  display: flex !important;
  flex-direction: column;
  gap: 8px !important;
}
/* ☰ closes it on a wide screen (the flex above must not bring it back across the page). */
@media (min-width: 901px) {
  .workspace.nav-hidden .sessions-nav {
    display: none !important;
  }
}
.sessions-nav > .sn-list {
  flex: 1 1 auto;
}
.sessions-nav > .sn-foot {
  margin-top: auto;
}
.sn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 4px 2px 8px;
}
.sn-head[hidden] {
  display: none;
}
.sn-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5a6f86;
}
.sn-new {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px 6px 10px;
  background: linear-gradient(90deg, #5aa6e8, #b07cd8);
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(122, 130, 220, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.sn-new:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(122, 130, 220, 0.32);
}
.sn-new:focus-visible {
  outline: 3px solid #b4c8f0;
  outline-offset: 2px;
}
.sn-status {
  margin: 0 4px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
  background: #f2f6fb;
  color: #5a6f86;
}
.sn-status[hidden] {
  display: none;
}
.sn-status[data-kind='saved'] {
  background: #eef8f2;
  color: #367254;
}
.sn-status[data-kind='saved']::before {
  content: '✓ ';
}
.sn-status[data-kind='saving']::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: #8fb4e8;
  animation: sn-pulse 1s ease-in-out infinite;
}
.sn-status[data-kind='error'] {
  background: #fff1f0;
  color: #a54949;
}
@keyframes sn-pulse {
  50% {
    opacity: 0.3;
  }
}
.sn-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  align-content: start;
  gap: 2px;
  min-height: 0;
  overflow-y: auto;
}
.sn-list[hidden] {
  display: none;
}
.sn-item {
  display: grid;
  gap: 2px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 10px;
  background: transparent;
  font: inherit;
  text-align: left;
  color: var(--ink, #1f2a37);
  cursor: pointer;
}
.sn-item:hover {
  background: #f0f6ff;
}
.sn-item:focus-visible {
  outline: 3px solid #b4c8f0;
  outline-offset: -1px;
}
.sn-item.is-current {
  background: linear-gradient(90deg, #e3f0ff, #f1e8fb);
  border-color: #d6e2f6;
}
.sn-name {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sn-meta {
  font-size: 12px;
  color: #74859a;
}
.sn-item.is-current .sn-meta {
  color: #5a68b5;
  font-weight: 700;
}
.sn-empty {
  padding: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: #74859a;
}
.sn-guest {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 4px;
  padding: 18px 14px;
  border-radius: 18px;
  background: linear-gradient(160deg, #f0f7ff, #faf4ff);
  border: 1px solid #e3e6f6;
  text-align: center;
}
.sn-guest[hidden] {
  display: none;
}
.sn-guest-img {
  width: 92px;
  height: auto;
}
.sn-guest strong {
  font-size: 15px;
}
.sn-guest p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #5f7186;
}
.sn-guest-btn {
  width: 100%;
  margin-top: 4px;
}
.sn-foot {
  display: grid;
  gap: 2px;
  padding-top: 8px;
  border-top: 1px solid #eef2f7;
}

/* ---------------------------------------------------------------- Get started (logged in): your sessions */

.lp-sessions {
  flex: 1;
  overflow-y: auto;
  padding-block: 40px 56px;
}
.lp-sessions .lp-wrap {
  display: grid;
  gap: 22px;
  justify-items: center;
}
.ss-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 22px;
  animation: lp-pop 0.35s ease;
}
.ss-mascot {
  flex: 0 0 auto;
  width: 132px;
  height: auto;
  animation: lp-float 4s ease-in-out infinite;
}
.ss-head h1 {
  margin: 4px 0 8px;
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 900;
  line-height: 1.2;
}
.ss-head p {
  margin: 0;
  max-width: 60ch;
  color: var(--lp-ink-soft, #5f7186);
  line-height: 1.7;
}
.ss-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}
.ss-grid[aria-busy='true'] {
  opacity: 0.6;
}
.ss-card {
  position: relative;
  display: flex;
  min-height: 168px;
  border-radius: 22px;
  background: var(--lp-paper, #ffffff);
  border: 1px solid #e6ecf3;
  box-shadow: 0 8px 24px rgba(44, 62, 80, 0.07);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  animation: lp-pop 0.35s ease both;
}
.ss-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(44, 62, 80, 0.12);
  border-color: #d3dff0;
}
.ss-card.is-current {
  border-color: #b9c9ef;
}
.ss-open,
.ss-new {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 20px 20px 18px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  color: var(--ink, #1f2a37);
  cursor: pointer;
}
.ss-open:focus-visible,
.ss-new:focus-visible,
.ss-more:focus-visible {
  outline: 3px solid #b4c8f0;
  outline-offset: 2px;
}
.ss-new {
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 2.5px dashed #b9d4f2;
  background: linear-gradient(160deg, #f4f9ff, #fbf5ff);
}
.ss-card.ss-new {
  padding: 20px;
}
.ss-new:hover {
  border-color: var(--lp-lilac, #b07cd8);
}
.ss-new-plus {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5aa6e8, #b07cd8);
  color: #ffffff;
  font-size: 28px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(122, 130, 220, 0.35);
}
.ss-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #e0efff, #efe0fa);
  font-size: 20px;
}
.ss-title {
  max-width: 100%;
  margin-top: 4px;
  padding-right: 28px;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.ss-new .ss-title {
  padding-right: 0;
}
.ss-files {
  max-width: 100%;
  font-size: 13px;
  color: #6b7d92;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ss-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.ss-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1f5fb;
  font-size: 12px;
  font-weight: 700;
  color: #48607e;
}
.ss-when {
  margin-top: auto;
  padding-top: 8px;
  font-size: 12px;
  color: #8a98aa;
}
.ss-rename {
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
  padding: 6px 10px;
  border: 1px solid #8c9de2;
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 0 0 3px #dfe8ff;
  outline: none;
}
.ss-more {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #5a6f86;
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}
.ss-more:hover,
.ss-more[aria-expanded='true'] {
  background: #eef3fa;
}
.ss-menu {
  position: absolute;
  top: 50px;
  right: 12px;
  z-index: 5;
  display: grid;
  min-width: 150px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid var(--line, #e3e9f0);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(38, 60, 96, 0.16);
}
.ss-menu[hidden] {
  display: none;
}
.ss-menu button {
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  font-size: 14px;
  text-align: left;
  color: #40566d;
  cursor: pointer;
}
.ss-menu button:hover {
  background: #edf4ff;
}
.ss-menu .is-danger {
  color: #a75767;
}
.ss-empty,
.ss-storage {
  margin: 0;
  color: var(--lp-ink-soft, #5f7186);
  text-align: center;
  line-height: 1.7;
}
.ss-storage {
  font-size: 13px;
}
.lp-start-saved {
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: #eef4ff;
  color: #38527a;
  font-size: 14px;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- opening a session */

.session-opening {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(234, 241, 247, 0.86);
  backdrop-filter: blur(6px);
}
.session-opening[hidden] {
  display: none;
}
.session-opening-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(380px, 100%);
  padding: 28px 24px;
  border-radius: 26px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(36, 62, 100, 0.18);
  text-align: center;
  font-family: var(--global-font-family, 'StudyBuddy Lexend', sans-serif);
}
.session-opening-card strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}
.session-opening-card span {
  color: #5f7186;
  font-size: 14px;
}

@media (max-width: 700px) {
  .lp-sessions {
    padding-block: 22px 40px;
  }
  .ss-head {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
  .ss-head p {
    margin-inline: auto;
  }
  .ss-mascot {
    width: 104px;
  }
  .ss-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .ss-card {
    min-height: 0;
  }
  .ss-card.ss-new {
    min-height: 120px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tools-menu,
  .ss-card,
  .ss-head,
  .ss-mascot {
    animation: none;
  }
  .ss-card,
  .sn-new {
    transition: none;
  }
}

/* ---------------------------------------------------------------- Get started: the water fills the page */

.water-fill {
  position: fixed;
  inset: 0;
  z-index: 3000;
  overflow: hidden;
  pointer-events: none;
}
.water-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 112%;
  background: linear-gradient(180deg, #7db8ee 0%, #6f9de6 45%, #8a7fd6 100%);
  transform: translateY(100%);
  animation: water-rise 760ms cubic-bezier(0.55, 0, 0.25, 1) forwards;
}
.water-fill.is-leaving .water-body {
  animation: water-leave 520ms cubic-bezier(0.5, 0, 0.75, 0) forwards;
}
@keyframes water-rise {
  to {
    transform: translateY(0);
  }
}
@keyframes water-leave {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-112%);
    opacity: 0.6;
  }
}
.water-wave {
  position: absolute;
  left: 0;
  top: -58px;
  width: 200%;
  height: 60px;
  animation: water-wave 1.4s linear infinite;
}
.water-wave path {
  fill: #7db8ee;
}
.water-wave--back {
  top: -70px;
  opacity: 0.45;
  animation-duration: 2.2s;
  animation-direction: reverse;
}
.water-wave--back path {
  fill: #b9d9fb;
}
@keyframes water-wave {
  to {
    transform: translateX(-50%);
  }
}
.water-bubble {
  position: absolute;
  left: var(--x);
  bottom: 6%;
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.18);
  animation: water-bubble 1.1s ease-in var(--d) both;
}
@keyframes water-bubble {
  from {
    transform: translateY(0) scale(0.6);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  to {
    transform: translateY(-70vh) scale(1);
    opacity: 0;
  }
}
.water-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-family: var(--global-font-family, 'StudyBuddy Lexend', sans-serif);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 900;
  letter-spacing: -0.01em;
  text-shadow: 0 4px 20px rgba(40, 60, 120, 0.25);
  opacity: 0;
  animation: water-text 760ms ease forwards;
}
@keyframes water-text {
  60% {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* A guest's daily limit: what logging in adds, in the message */
.limit-perks {
  list-style: none;
  margin: 4px 0 14px;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
  border-radius: 14px;
  background: linear-gradient(160deg, #f0f7ff, #faf4ff);
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  color: #3a4f6e;
}

/* Opening another session: the page starts under the water (lib/boot-water.js) until it is in place */
html.session-booting::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: linear-gradient(180deg, #7db8ee 0%, #6f9de6 45%, #8a7fd6 100%);
  pointer-events: none;
}
html.session-booting.session-booted::after {
  animation: water-leave 520ms cubic-bezier(0.5, 0, 0.75, 0) forwards;
}

/* The menu's right edge: drag it to make the menu wider or narrower (wide screens, web/app.js) */
.nav-resizer {
  display: none;
}
@media (min-width: 901px) {
  .workspace:not(.nav-hidden) > .nav-resizer {
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--nav-width, 250px) - 5px);
    width: 10px;
    z-index: 6;
    cursor: col-resize;
    touch-action: none;
  }
  .nav-resizer::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 3px;
    width: 4px;
    height: 44px;
    margin-top: -22px;
    border-radius: 4px;
    background: #c9d6e6;
    opacity: 0;
    transition: opacity 0.15s;
  }
  .nav-resizer:hover::after,
  .nav-resizer:focus-visible::after,
  body.chat-resizing .nav-resizer::after {
    opacity: 1;
  }
}
@media (min-width: 901px) and (max-width: 1180px) {
  .workspace:not(.nav-hidden) > .nav-resizer {
    left: calc(var(--nav-width, 220px) - 5px);
  }
}

/* Deleting sessions from the menu: 🗑 on each one (on hover), or 🗑 next to ＋ New to tick several */
.sn-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sn-select {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #e0e8f2;
  border-radius: 999px;
  background: #ffffff;
  font-size: 14px;
  cursor: pointer;
}
.sn-select[hidden] {
  display: none;
}
.sn-select:hover,
.sn-select[aria-pressed='true'] {
  background: #fff1f0;
  border-color: #f2c9c6;
}
.sn-list > li {
  position: relative;
}
.sn-list > li > .sn-item {
  padding-right: 38px;
}
.sn-del {
  position: absolute;
  top: 8px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, background-color 0.12s ease;
}
.sn-list > li:hover > .sn-del,
.sn-list > li:focus-within > .sn-del {
  opacity: 1;
}
.sn-del:hover,
.sn-del:focus-visible {
  background: #fff1f0;
}
@media (hover: none) {
  .sn-del {
    opacity: 0.7;
  }
}
.sn-list > li.is-selecting {
  display: flex;
  align-items: center;
  gap: 4px;
}
.sn-list > li.is-selecting > .sn-item {
  padding-right: 10px;
}
.sn-check {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0 0 0 6px;
  accent-color: #c0564f;
  cursor: pointer;
}
.sn-selectbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 4px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #fff6f5;
  border: 1px solid #f4d6d3;
}
.sn-selectbar[hidden] {
  display: none;
}
.sn-selectcount {
  flex: 1 1 auto;
  font-size: 13px;
  font-weight: 700;
  color: #7a3d39;
}
.sn-selectdel,
.sn-selectcancel {
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.sn-selectdel {
  background: #c0564f;
  color: #ffffff;
}
.sn-selectdel:disabled {
  opacity: 0.45;
  cursor: default;
}
.sn-selectcancel {
  background: #ffffff;
  color: #40566d;
  border: 1px solid #dce5f0;
}
/* The trash can (a drawn icon: the emoji was hard to make out) */
.sn-select,
.sn-del {
  color: #6b7c90;
}
.sn-select:hover,
.sn-select[aria-pressed='true'],
.sn-del:hover,
.sn-del:focus-visible {
  color: #b7443c;
}
.trash-icon {
  display: block;
}

/* Deleting sessions: asked in the middle of the screen, not squeezed into the menu */
.delete-dialog {
  text-align: center;
}
.delete-dialog-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: 4px auto 10px;
  border-radius: 50%;
  background: #fdeeed;
  color: #b7443c;
}
.delete-dialog #deleteText {
  overflow-wrap: anywhere;
}
.delete-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}
.delete-yes,
.delete-no {
  flex: 1 1 140px;
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}
.delete-no {
  border: 1px solid #dce5f0;
  background: #ffffff;
  color: #1f2a37;
}
.delete-yes {
  border: 0;
  background: #c0453d;
  color: #ffffff;
}
.delete-no:hover,
.delete-no:focus-visible {
  background: #f3f7fb;
}
.delete-yes:hover,
.delete-yes:focus-visible {
  background: #a5372f;
}
.delete-yes:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Long names stay inside their card: the card's content may shrink to the card's width (a flex item
   otherwise keeps the width of its longest line), then the title wraps and the file name ends in "…". */
.ss-card {
  min-width: 0;
}
.ss-card > .ss-open {
  flex: 1 1 auto;
  min-width: 0;
}
