/* =============================================================================
   MindQuest — the "Install App" button and its dialog
   -----------------------------------------------------------------------------
   Loaded by views/partials/head.ejs on every page, and driven by
   /js/install-app.js.

     .mq-install-btn   the button, on the landing page, the login page and the
                       student's dashboard topbar
     .mq-app-sheet     the dialog it opens: "for students only", then the
                       download of the student Android app

   Self-contained on purpose: those pages do not share a modal stylesheet, so
   this file borrows nothing from them and leaks nothing into them.
   ========================================================================== */

/* -------------------------------------------------------------------------
   The button
   ---------------------------------------------------------------------- */

.mq-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid rgba(6, 76, 2, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  color: #064c02;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.mq-install-btn:hover {
  background: #fff;
  border-color: rgba(6, 76, 2, .45);
  transform: translateY(-1px);
}

.mq-install-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(25, 121, 27, .3);
}

.mq-install-btn svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

/* The login page sits it centred under the Forgot Password / Go Back row. */
.login-install-row {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.login-install-row:empty,
.login-install-row:not(:has(.mq-install-btn)) {
  display: none;
}

/* The topbar is tight on a phone: keep the icon, drop the word. */
@media (max-width: 640px) {
  .dashboard-topbar .mq-install-btn .mq-install-label {
    display: none;
  }

  .dashboard-topbar .mq-install-btn {
    padding: 8px 10px;
  }
}

/* -------------------------------------------------------------------------
   The dialog
   ---------------------------------------------------------------------- */

html.mq-app-sheet-open,
html.mq-app-sheet-open body {
  overflow: hidden;
}

.mq-app-sheet {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(4, 30, 8, .55);
  backdrop-filter: blur(3px);
}

.mq-app-sheet.is-open {
  display: flex;
}

.mq-app-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 30px 26px 24px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(4, 30, 8, .3);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #102033;
  text-align: center;
}

.mq-app-logo {
  width: 66px;
  height: 66px;
  margin: 0 auto 12px;
  display: block;
  border-radius: 16px;
}

.mq-app-card h3 {
  margin: 0 0 16px;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -.01em;
}

/* "For students only" — the part nobody should miss. */
.mq-app-notice {
  margin: 0 0 14px;
  padding: 14px 16px 12px;
  border: 1px solid #f1c56b;
  border-radius: 16px;
  background: #fff8e6;
  color: #5c3b00;
}

.mq-app-badge {
  display: inline-block;
  margin-bottom: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #b45309;
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.mq-app-notice p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

.mq-app-notice p + p {
  margin-top: 4px;
  color: #7a5410;
}

.mq-app-meta {
  margin: 0 0 18px;
  font-size: 13px;
  color: #5f7084;
}

.mq-app-apple {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.55;
  color: #263b52;
}

.mq-app-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mq-app-primary,
.mq-app-secondary {
  appearance: none;
  display: block;
  width: 100%;
  box-sizing: border-box;
  border-radius: 999px;
  padding: 12px 24px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.mq-app-primary {
  border: 0;
  color: #fff;
  background: linear-gradient(180deg, #19791b 0%, #064c02 100%);
}

.mq-app-primary:hover {
  filter: brightness(1.06);
}

.mq-app-secondary {
  border: 1px solid #d5e0e8;
  color: #263b52;
  background: #fff;
}

.mq-app-secondary:hover {
  background: #f7fafc;
}

.mq-app-primary:focus-visible,
.mq-app-secondary:focus-visible,
.mq-app-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(25, 121, 27, .3);
}

.mq-app-hint {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: #5f7084;
}

.mq-app-hint strong {
  color: #064c02;
}

.mq-app-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
  color: #5f7084;
  background: #f7fafc;
  transition: background .15s ease, color .15s ease;
}

.mq-app-close:hover {
  background: #e5eef3;
  color: #102033;
}
