/* ---------- Brand mark - real logo, added 2026-08-30 (was an emoji placeholder + plain text
   lockup before this; the image itself already carries the wordmark + tagline, so the old
   .app-brand-mark/-text/-name/-tagline text pieces are gone, not just hidden). ---------- */

.app-brand {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.app-logo {
  display: block;
  height: 80px;
  width: auto;
}

/* mainView (post-login form) only, per explicit user request 2026-08-30: the logo becomes a big
   centered banner spanning the same width as the form below it (.ug-form-container is
   min(560px, 100%-40px)), not the small bordered badge landingView still uses - the pill/border/
   background box that made sense at 80px tall would look odd stretched to ~560px wide, so it's
   dropped here rather than scaled up with it. */
#mainView .app-brand {
  display: flex;
  width: 100%;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
}

#mainView .app-logo {
  width: 100%;
  height: auto;
}

/* ---------- Topbar (added 2026-08-31, "make it a REAL login") - sticky (not fixed), so it
   reserves its own space in normal document flow and pushes page content down automatically -
   no manual padding-top math on .ug-landing/.ug-main needed. z-index kept below the modals'
   (100), so any open modal correctly covers it rather than floating on top of it. ---------- */
.ug-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.ug-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 10px 0;
}

.ug-topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ug-topbar-icon {
  height: 24px;
  width: 24px;
  display: block;
  flex-shrink: 0;
}

.ug-topbar-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ug-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.ug-topbar-login-btn {
  padding: 7px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.ug-topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ug-topbar-email {
  color: var(--muted);
  font-size: 0.82rem;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A button, not static text - opens the Report History modal (see js/ui.js's
   openReportHistoryModal), so its content ("N used · M left") doubles as the entry point rather
   than needing a separate, extra "History" link competing for the same small space. */
.ug-topbar-usage {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ug-topbar-usage:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ug-topbar-logout {
  padding: 5px 10px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
}

.ug-topbar-logout:hover {
  color: var(--text);
}

@media (max-width: 560px) {
  .ug-topbar-email {
    display: none;
  }
}

/* ---------- Hebrew/English toggle - now a normal flex item inside .ug-topbar-actions rather than
   its own independently `position: fixed` element (that was needed when it was the ONLY control up
   there; now it's part of a structured toolbar that already mirrors together as a unit under
   dir="rtl", so letting it mirror along with Login/Log out is the more consistent choice, not a
   regression of the old "always top-right" requirement - see index.html's topbar comment). ---------- */
.lang-toggle-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.lang-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Report History modal ---------- */
.ug-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
}

.ug-history-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.ug-history-row:last-child {
  border-bottom: none;
}

.ug-history-versions {
  color: var(--text);
  font-weight: 600;
}

.ug-history-date {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.ug-history-empty {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 12px 0;
}

/* RTL (Hebrew) - i18n.js sets dir="rtl" on <html>. Most of this layout already mirrors correctly
   via normal flex/text flow; the few spots that don't (checkbox row gap direction, the field-row
   label/input pairing already stacks vertically so needs no change) get explicit handling here
   rather than assuming every component auto-mirrors. */
[dir="rtl"] .ug-confirm-actions {
  justify-content: flex-start;
}

/* .ug-steps hardcodes text-align: left (line ~350) - fine for English, but never flips for
   Hebrew, so step card text stayed left-aligned even under dir="rtl" (the grid ORDER already
   mirrors correctly on its own - CSS Grid respects direction for auto-placement; only the text
   alignment inside each card needed an explicit override). */
[dir="rtl"] .ug-steps {
  text-align: right;
}

/* ---------- Ninja Review checkbox (renamed from "AI Insight" button+panel, 2026-08-30) - see
   index.html's diffReportChoiceSection comment for the full story. ---------- */
.ug-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
}

.ug-checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- Modals - copied from WebRTC.WebClient/wwwroot/css/searsh.css ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-dialog {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  padding: 20px 24px;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
}

.modal-dialog h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

.auth-gate-dialog {
  width: 300px;
  align-items: center;
  text-align: center;
}

.auth-gate-mark {
  font-size: 2rem;
}

.auth-gate-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.auth-provider-btn-slot {
  display: flex;
  justify-content: center;
  min-height: 40px;
}

.auth-provider-btn {
  width: 240px;
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: 0.15s;
}

.auth-provider-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.auth-provider-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.auth-provider-unconfigured {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

.modal-error {
  margin: 0;
  font-size: 0.85rem;
  color: var(--err);
}

.modal-error[hidden] {
  display: none;
}

.modal-dialog-report {
  width: min(1100px, 92vw);
  height: 88vh;
  padding: 16px 20px 20px;
}

.report-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-right: 24px;
}

.report-modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-modal-logo {
  height: 28px;
  width: auto;
  display: block;
}

.report-download-link {
  font: inherit;
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.report-download-link:hover {
  text-decoration: underline;
}

.report-download-link:disabled {
  color: var(--muted);
  cursor: not-allowed;
  text-decoration: none;
}

.report-frame {
  flex: 1;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

/* ---------- Landing page ---------- */

.ug-landing {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  text-align: center;
}

.ug-glow {
  position: absolute;
  width: 750px;
  height: 750px;
  left: 50%;
  top: 35%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(4, 125, 123, 0.14) 0%, rgba(4, 125, 123, 0.04) 35%, transparent 70%);
  pointer-events: none;
}

.ug-container {
  position: relative;
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 60px 0;
}

.ug-title {
  margin: 28px 0 0;
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.05;
  letter-spacing: -2px;
  font-weight: 800;
  color: var(--text);
}

.ug-title span {
  color: var(--accent);
}

.ug-subtitle {
  max-width: 640px;
  margin: 24px auto 0;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.6;
}

.ug-subtitle strong {
  color: var(--text);
}

/* Homepage demo video - responsive 16:9 frame (aspect-ratio, not fixed width/height), capped a
   little wider than the subtitle so it reads as the page's centrepiece. Centred with auto margins
   only, so it sits identically under dir="rtl". */
.ug-video {
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16 / 9;
  margin: 32px auto 0;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 18px 44px rgba(4, 125, 123, 0.22);
}

.ug-video iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.ug-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 32px;
  padding: 15px 30px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(4, 125, 123, 0.2);
  transition: transform 0.15s ease;
}

.ug-cta:hover {
  transform: translateY(-2px);
}

.ug-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Secondary path for a visitor who doesn't have the Agent yet - deliberately subdued (not a
   second .ug-cta) so it never competes with "Start a Report", the primary action for everyone who
   already has the Agent installed. */
.ug-agent-link {
  max-width: 560px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.ug-agent-link a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.ug-agent-link a:hover {
  text-decoration: underline;
}

.ug-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 64px;
  text-align: left;
}

.ug-step {
  padding: 22px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.ug-step-number {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg);
  color: var(--accent);
  font-weight: 800;
  margin-bottom: 14px;
}

.ug-step h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--text);
}

.ug-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .ug-steps {
    grid-template-columns: 1fr;
  }
}

/* ---------- Trust / Sample report / Pricing sections (landing page) - plain text/panel blocks
   only, no illustrations or feature-tile grids, matching the existing restrained design. Order on
   the page is deliberate: understand (hero+steps) -> trust -> see example -> buy. ---------- */

.ug-section {
  margin-top: 56px;
}

.ug-section-title {
  margin: 0 0 10px;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
}

.ug-section-body {
  max-width: 640px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.ug-sample .ug-secondary-btn {
  display: inline-block;
  margin-top: 16px;
  text-decoration: none;
}

.ug-pricing-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 460px;
  margin: 20px auto 0;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  text-align: left;
}

.ug-pricing-list-compact {
  margin: 4px 0 8px;
}

[dir="rtl"] .ug-pricing-list {
  text-align: right;
}

.ug-pricing-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.9rem;
}

.ug-pricing-label {
  color: var(--text);
  font-weight: 600;
}

.ug-pricing-value {
  color: var(--muted);
}

/* ---------- Main form view ---------- */

.ug-main {
  min-height: 100vh;
  padding: 40px 0;
}

.ug-form-container {
  width: min(560px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0;
}

.ug-form-panel {
  margin-top: 24px;
}

.ug-form-panel h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.ug-form-panel .field-row {
  margin-bottom: 10px;
}

/* .field-row is display:flex (site.css), which beats the UA's [hidden] rule - same fix as
   .modal-backdrop[hidden] below. Needed for #targetVersionRow in Analyze mode. */
.ug-form-panel .field-row[hidden] {
  display: none;
}

/* Matches site.css's .field-row label - the Report Type row labels a radiogroup, not one input,
   so it's a span rather than a <label for>. */
.ug-form-panel .field-label {
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 4.5rem;
}

/* Analyze Report / Upgrade Report segmented control. Flex + gap only (no physical margins), so it
   mirrors correctly under dir="rtl" with no extra rules. */
.ug-mode-toggle {
  flex: 1 1 220px;
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.ug-mode-toggle button {
  flex: 1 1 0;
  border-radius: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  padding: 0.5rem 0.65rem;
}

.ug-mode-toggle button + button {
  border-inline-start: 1px solid var(--border);
}

.ug-mode-toggle button[aria-checked="true"] {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.ug-form-panel select {
  flex: 1 1 220px;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

.ug-form-panel input[type="password"] {
  flex: 1 1 220px;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

.ug-form-hint {
  margin: 14px 0 10px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Sits right above the DB User/Password fields, deliberately - reassurance at the exact point of
   friction (see form.hint2 right above it for the full explanation these badges summarize). */
.ug-trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0 0 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.ug-primary-btn {
  width: 100%;
  margin-top: 10px;
  padding: 11px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.ug-primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ug-secondary-btn {
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

/* ---------- Combined disclaimer + confirm modal ---------- */

.ug-confirm-dialog {
  width: min(440px, 92vw);
}

.ug-disclaimer {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
}

.ug-disclaimer p {
  margin: 0 0 10px;
}

.ug-disclaimer p:last-child {
  margin-bottom: 0;
}

.ug-balance-line {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.ug-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

/* Deterministic diff-summary counts (see CLAUDE.md's "Upgrade Risk Report") - no AI runs to
   produce these, shown before either report is rendered. */
.ug-diff-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 8px;
}

.ug-diff-counts .diff-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.ug-diff-counts .diff-count-pill strong {
  color: var(--text);
  font-size: 1rem;
  text-transform: none;
  letter-spacing: normal;
}

/* Raw per-type totals (Tables/Triggers/SQLI/Procedures) - shown above the bucket pills, a quick
   sanity check on whether the target version looks like a plausibly different install, size-wise. */
.ug-type-counts {
  margin: 4px 0 8px;
}

.ug-counts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.ug-counts-table th,
.ug-counts-table td {
  text-align: right;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}

.ug-counts-table th:first-child,
.ug-counts-table td:first-child {
  text-align: left;
  color: var(--muted);
}

.ug-counts-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ug-counts-table td {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.ug-counts-table td.diff-pos { color: var(--accent); }
.ug-counts-table td.diff-neg { color: var(--err); }


/* ============ Site footer + sign-in consent line (added 2026-09-10) ============
   The footer lives directly in <body>, after both <main> elements, so one copy serves both the
   landing view and the report form - see index.html. Uses the same --muted/--accent tokens as the
   rest of the site, so it follows light/dark with no extra rules. */
.ug-site-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 40px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.ug-site-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

.ug-site-footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.ug-site-footer-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.ug-site-footer-links span {
  color: var(--border);
}

.ug-site-footer-note {
  margin: 12px auto 0;
  max-width: 620px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

/* Consent line inside the sign-in modal - deliberately small and last, but present at the exact
   moment an account is created rather than only in the page footer. */
.auth-gate-legal {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
}

.auth-gate-legal a {
  color: var(--accent);
}

/* ============ Report History: reopen a stored report (added 2026-09-10) ============
   The row gained a third child (the Open button), so the versions label now takes the free space
   rather than letting justify-content: space-between spread all three evenly and float the date
   into the middle. Declared here rather than editing the original rule so the whole change stays
   in one commented block - same specificity, later in source order, so this wins. */
.ug-history-versions {
  flex: 1;
}

.ug-history-open {
  border: 1px solid var(--border);
  background: none;
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ug-history-open:hover:not(:disabled) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.ug-history-open:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Rows from before reports were stored, and rows whose payload has aged out of retention. */
.ug-history-unavailable {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}
