/*
 * PYCAD Dental Viewer — platform shell theme.
 *
 * The shell wraps the dental viewer (pycad-dicom-viewer-client-dental) in an
 * iframe, so its chrome must read as one surface with the viewer's dark
 * "pycad-dark" theme. Every token below is copied from the viewer's design
 * system or the pycad.co WordPress embed pages; the source is cited per line.
 *
 *   [pycad.css]  viewer  src/styles/pycad.css          (:root --pycad-* tokens)
 *   [vuetify.js] viewer  src/plugins/vuetify.js        (PycadDarkTheme colors/variables)
 *   [global.css] viewer  src/global.css                (toast / dialog overrides)
 *   [topbar]     viewer  src/components/pycad/TopToolbar.vue  (.pycad-topbar)
 *   [wp-generic] pycad-dicom-viewer-client @ demos/generic-dicom-viewer
 *                deploy/pycad-generic/wordpress/generic-dicom-viewer-page.html
 *                (--gate-accent #FFC800, --gate-kicker #B98900, --gate-text #252627)
 */
:root {
  /* Brand accent ------------------------------------------------------ */
  --pc-brand: #ffc800;                       /* [pycad.css] --pycad-primary; [vuetify.js] primary; [wp-generic] --gate-accent */
  --pc-brand-hover: #ffd21f;                 /* derived: brand lifted ~8% for hover on dark surfaces (viewer hovers active tools with rgba(255,200,0,.24)) */
  --pc-brand-deep: #b98900;                  /* [wp-generic] --gate-kicker — pressed / active state */
  --pc-brand-ink: #050505;                   /* [vuetify.js] on-primary — text on brand-filled controls (12.6:1 on brand) */
  --pc-brand-dim: rgba(255, 200, 0, 0.14);   /* [pycad.css] --pycad-primary-dim */
  --pc-brand-border: rgba(255, 200, 0, 0.45);/* [pycad.css] --pycad-primary-border */
  --pc-brand-glow: 0 0 10px rgba(255, 200, 0, 0.22); /* [pycad.css] --pycad-shadow-glow */
  --pc-secondary: #3b82f6;                   /* [vuetify.js] secondary / info (used sparingly: info accents only) */

  /* Surfaces ----------------------------------------------------------- */
  --pc-bg: #000000;                          /* [pycad.css] --pycad-bg; [vuetify.js] background is #050505 — iframe canvas is pure black */
  --pc-surface: #0b0b0b;                     /* [pycad.css] --pycad-surface — the viewer topbar background ([topbar]) */
  --pc-surface-2: #161616;                   /* [pycad.css] --pycad-elevated — cards, menus, dialogs */
  --pc-hover: #1e1e1e;                       /* [pycad.css] --pycad-hover */
  --pc-border: #282828;                      /* [pycad.css] --pycad-border; [vuetify.js] border-color #2c2c2c */
  --pc-border-strong: #3a3a3a;               /* [pycad.css] --pycad-border-strong */
  --pc-scrim: rgba(0, 0, 0, 0.65);           /* [global.css] .v-overlay__scrim */
  --pc-glass: rgba(16, 16, 16, 0.82);        /* [global.css] toast background */

  /* Text --------------------------------------------------------------- */
  --pc-text: #ffffff;                        /* [pycad.css] --pycad-text-primary */
  --pc-muted: #a0a0a0;                       /* [pycad.css] --pycad-text-secondary (7.5:1 on surface, AA for body text) */
  --pc-faint: #666666;                       /* [pycad.css] --pycad-text-muted — placeholders / disabled only (fails AA for body text) */
  --pc-tool-icon: #cccccc;                   /* [pycad.css] .pycad-tool-btn color */

  /* Status ------------------------------------------------------------- */
  --pc-danger: #f87171;                      /* [vuetify.js] error; [global.css] toast--error */
  --pc-danger-dim: rgba(248, 113, 113, 0.14);
  --pc-success: #4ade80;                     /* [vuetify.js] success; [global.css] toast--success */
  --pc-warning: #ffc800;                     /* [vuetify.js] warning */
  --pc-info: #3b82f6;                        /* [vuetify.js] info */

  /* Shape / motion / type --------------------------------------------- */
  --pc-radius-sm: 6px;                       /* [pycad.css] --pycad-radius-sm */
  --pc-radius: 10px;                         /* [pycad.css] --pycad-radius */
  --pc-radius-lg: 14px;                      /* [pycad.css] --pycad-radius-lg; toast radius in [global.css] */
  --pc-shadow-pop: 0 8px 28px rgba(0, 0, 0, 0.55);   /* [pycad.css] --pycad-shadow-pop */
  --pc-shadow-dialog: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 200, 0, 0.08); /* [global.css] .v-dialog card */
  --pc-ease: 0.13s ease;                     /* [pycad.css] .pycad-tool-btn transitions */
  --pc-header-h: 48px;
  --pc-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; /* [pycad.css] body.pycad-dark; [topbar] */
  --pc-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;       /* [pycad.css] .pycad-kbd */
  --pc-disabled-opacity: 0.4;                /* [vuetify.js] disabled-opacity */

  font-family: var(--pc-font);
  color-scheme: dark;
  accent-color: var(--pc-brand);
}

/* ------------------------------------------------------------------------
 * Base
 * --------------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--pc-bg); color: var(--pc-text); }
body {
  display: flex; flex-direction: column; min-height: 100dvh;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  line-height: 1.45;
}
a { color: var(--pc-brand); text-decoration-color: var(--pc-brand-border); text-underline-offset: 2px; }
a:hover { color: var(--pc-brand-hover); text-decoration-color: currentColor; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::placeholder { color: var(--pc-faint); opacity: 1; }
::selection { background: rgba(255, 200, 0, 0.18); color: var(--pc-text); } /* [vuetify.js] selection-bg-color */
h1, h2, h3 { font-weight: 600; letter-spacing: 0.01em; line-height: 1.25; }
strong { font-weight: 600; }

/* Visible, brand-coloured focus ring for keyboard users everywhere. */
:focus-visible { outline: 2px solid var(--pc-brand); outline-offset: 2px; border-radius: var(--pc-radius-sm); }
:focus:not(:focus-visible) { outline: none; }

/* Elements toggled with the `hidden` attribute must disappear even when a
   class below gives them an explicit display (the share gate is `display: grid`). */
[hidden] { display: none !important; }

/* Scrollbars: thin, dark, brand-neutral — same recipe as [pycad.css]. */
* { scrollbar-width: thin; scrollbar-color: var(--pc-border-strong) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--pc-border); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--pc-border-strong); background-clip: content-box; }

/* ------------------------------------------------------------------------
 * Header / topbar — same surface + border as the viewer's .pycad-topbar so
 * the shell header and the embedded toolbar read as one block.
 * --------------------------------------------------------------------- */
.pc-header {
  height: var(--pc-header-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px;
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
  background: var(--pc-surface);
  border-bottom: 1px solid var(--pc-border);
  flex: 0 0 auto;
  position: relative; z-index: 20;
}
/* On viewer pages the iframe's own topbar carries the divider; drop ours so
   there is a single hairline between brand bar and tools. */
body:has(.pc-stage) .pc-header { border-bottom-color: transparent; }
.pc-header__brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit;
  font-weight: 600; letter-spacing: 0.02em; border-radius: var(--pc-radius-sm); padding: 4px 6px; margin-left: -6px;
}
.pc-header__brand img { height: 22px; display: block; }
.pc-header__nav { display: flex; gap: 2px; margin-left: 4px; }
.pc-header__nav a {
  position: relative; color: var(--pc-muted); text-decoration: none; padding: 7px 10px;
  border-radius: var(--pc-radius-sm); font-size: 13px; font-weight: 500; letter-spacing: 0.02em;
  transition: background var(--pc-ease), color var(--pc-ease);
}
.pc-header__nav a:hover { color: var(--pc-text); background: var(--pc-hover); }
.pc-header__nav a[aria-current="page"] { color: var(--pc-brand); background: var(--pc-brand-dim); }
.pc-header__spacer { flex: 1; }
.pc-header__account { position: relative; display: flex; align-items: center; }
/* "Saved HH:MM" / "Autosaved HH:MM" indicator (static/shell/app.js). */
.pc-saved { color: var(--pc-muted); font-size: 12px; white-space: nowrap; margin-right: 4px; }
.pc-saved[data-kind="auto"]::before { content: "\2713\00a0"; color: var(--pc-success); }
.pc-saved[data-kind="error"] { color: var(--pc-danger); }

/* Avatar + menu */
.pc-avatar {
  width: 34px; height: 34px; border-radius: 50%; padding: 0;
  border: 1px solid var(--pc-brand-border); background: var(--pc-brand-dim); color: var(--pc-brand);
  display: grid; place-items: center; cursor: pointer;
  transition: background var(--pc-ease), border-color var(--pc-ease), box-shadow var(--pc-ease);
}
.pc-avatar:hover, .pc-avatar[aria-expanded="true"] { background: rgba(255, 200, 0, 0.24); border-color: rgba(255, 200, 0, 0.6); box-shadow: var(--pc-brand-glow); }
.pc-avatar__initials { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; }
.pc-avatar-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px;
  background: var(--pc-surface-2); border: 1px solid var(--pc-border); border-radius: var(--pc-radius);
  box-shadow: var(--pc-shadow-pop); padding: 6px; z-index: 50; display: flex; flex-direction: column;
}
.pc-avatar-menu__who { padding: 8px 10px 10px; border-bottom: 1px solid var(--pc-border); margin-bottom: 4px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.pc-avatar-menu__who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-avatar-menu__who span { color: var(--pc-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-avatar-menu a, .pc-avatar-menu button {
  text-align: left; background: none; border: 0; color: var(--pc-text); padding: 8px 10px; border-radius: var(--pc-radius-sm);
  cursor: pointer; text-decoration: none; font-size: 13.5px; font-weight: 500;
  transition: background var(--pc-ease), color var(--pc-ease);
}
.pc-avatar-menu a:hover, .pc-avatar-menu button:hover { background: var(--pc-hover); color: var(--pc-brand); }

/* ------------------------------------------------------------------------
 * Buttons
 * --------------------------------------------------------------------- */
.pc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 7px 14px; border-radius: var(--pc-radius-sm);
  border: 1px solid var(--pc-border); background: var(--pc-surface-2); color: var(--pc-text);
  cursor: pointer; text-decoration: none; font-size: 13.5px; font-weight: 500; letter-spacing: 0.02em; line-height: 1.2;
  transition: background var(--pc-ease), color var(--pc-ease), border-color var(--pc-ease), box-shadow var(--pc-ease);
}
.pc-btn:hover { background: var(--pc-hover); border-color: var(--pc-border-strong); color: var(--pc-text); }
.pc-btn:active { background: var(--pc-surface); }
.pc-btn:disabled, .pc-btn[aria-disabled="true"] { opacity: var(--pc-disabled-opacity); cursor: not-allowed; pointer-events: none; box-shadow: none; }

.pc-btn--primary { background: var(--pc-brand); color: var(--pc-brand-ink); border-color: var(--pc-brand); font-weight: 600; }
.pc-btn--primary:hover { background: var(--pc-brand-hover); border-color: var(--pc-brand-hover); color: var(--pc-brand-ink); box-shadow: var(--pc-brand-glow); }
.pc-btn--primary:active { background: var(--pc-brand-deep); border-color: var(--pc-brand-deep); box-shadow: none; }

.pc-btn--ghost { background: transparent; border-color: transparent; color: var(--pc-muted); }
.pc-btn--ghost:hover { background: var(--pc-hover); border-color: transparent; color: var(--pc-text); }
/* Header "Sign in" is the anonymous visitor's main call to action. */
.pc-header .pc-btn--ghost { color: var(--pc-brand); border-color: var(--pc-brand-border); }
.pc-header .pc-btn--ghost:hover { background: var(--pc-brand-dim); border-color: var(--pc-brand); color: var(--pc-brand); }

.pc-btn--danger { background: transparent; color: var(--pc-danger); border-color: transparent; }
.pc-btn--danger:hover { background: var(--pc-danger-dim); border-color: rgba(248, 113, 113, 0.45); color: var(--pc-danger); }
.pc-btn--danger:active { background: rgba(248, 113, 113, 0.24); }

.pc-icon-btn {
  width: 32px; height: 32px; padding: 0; flex: 0 0 auto;
  display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--pc-radius-sm);
  background: transparent; color: var(--pc-muted); cursor: pointer;
  transition: background var(--pc-ease), color var(--pc-ease), border-color var(--pc-ease);
}
.pc-icon-btn:hover { background: var(--pc-hover); color: var(--pc-text); border-color: var(--pc-border); }
.pc-icon-btn:focus-visible { outline: none; border-color: var(--pc-brand-border); box-shadow: 0 0 0 3px var(--pc-brand-dim); color: var(--pc-text); }
.pc-icon-btn svg { width: 16px; height: 16px; display: block; }
.pc-icon-btn--danger:hover, .pc-icon-btn--danger:focus-visible {
  background: var(--pc-danger-dim); color: var(--pc-danger); border-color: rgba(248, 113, 113, 0.45);
}

.pc-link {
  background: none; border: 0; color: var(--pc-brand); cursor: pointer; padding: 2px 0; font-size: 13px; font-weight: 500;
  text-decoration: underline; text-decoration-color: var(--pc-brand-border); text-underline-offset: 3px;
  transition: color var(--pc-ease), text-decoration-color var(--pc-ease);
}
.pc-link:hover { color: var(--pc-brand-hover); text-decoration-color: currentColor; }

/* ------------------------------------------------------------------------
 * Viewer stage
 * --------------------------------------------------------------------- */
.pc-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; background: var(--pc-bg); }
.pc-stage[hidden] { display: none !important; }
.pc-stage iframe { flex: 1; width: 100%; height: 100%; border: 0; background: var(--pc-bg); }
#sessions-panel[hidden] { display: none !important; }
#sessions-panel:not([hidden]) { flex: 1 1 auto; min-height: 0; overflow: auto; }
.pc-status {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--pc-glass); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 999px;
  padding: 7px 10px 7px 16px; font-size: 13px; font-weight: 500; z-index: 5; pointer-events: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  max-width: min(90vw, 560px);
}
.pc-status.is-dismissible { pointer-events: auto; }
.pc-status__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pc-status__close {
  flex: 0 0 auto; width: 22px; height: 22px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08); color: var(--pc-text); font-size: 16px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.pc-status__close:hover { background: rgba(255, 255, 255, 0.16); }
.pc-status.is-busy::before {
  content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid rgba(255, 200, 0, 0.2); border-top-color: var(--pc-brand);
  animation: pc-spin 0.8s linear infinite;
}
@keyframes pc-spin { to { transform: rotate(360deg); } }

/* Full-stage centered overlay while a cloud session is opening — hides the
   viewer's empty dropzone behind a scrim until the bridge `load` finishes. */
.pc-status.is-overlay {
  inset: 0; top: 0; left: 0; right: 0; bottom: 0;
  transform: none; width: auto; max-width: none;
  border-radius: 0; border: 0;
  background: rgba(5, 5, 5, 0.72);
  backdrop-filter: blur(8px) saturate(1.1); -webkit-backdrop-filter: blur(8px) saturate(1.1);
  justify-content: center; align-items: center;
  padding: 24px; box-shadow: none; pointer-events: auto;
  font-size: 15px;
}
.pc-status.is-overlay .pc-status__text {
  white-space: normal; text-align: center; max-width: min(90vw, 420px);
}
.pc-status.is-overlay.is-busy::before {
  width: 18px; height: 18px; border-width: 2.5px;
}

/* Share password gate: scrim over the (read-only) viewer. The JS appends
   h2 / p / form straight into #share-gate, so the "card" is built from the
   children themselves — shared side borders, first child gets the top,
   last child gets the bottom. */
.pc-gate {
  position: absolute; inset: 0; z-index: 6;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px; overflow: auto;
  background: var(--pc-scrim); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.pc-gate > * {
  width: min(400px, 100%); margin: 0;
  background: var(--pc-surface-2); border: 1px solid var(--pc-border); border-top-width: 0; border-bottom-width: 0;
  padding: 0 24px;
}
.pc-gate > :first-child { border-top-width: 1px; border-radius: var(--pc-radius-lg) var(--pc-radius-lg) 0 0; padding-top: 24px; }
.pc-gate > :last-child { border-bottom-width: 1px; border-radius: 0 0 var(--pc-radius-lg) var(--pc-radius-lg); padding-bottom: 24px; }
.pc-gate > :only-child { border-radius: var(--pc-radius-lg); }
.pc-gate h2 { margin: 0; padding-bottom: 6px; font-size: 20px; }
.pc-gate h2::before { content: ""; display: block; width: 28px; height: 3px; border-radius: 2px; background: var(--pc-brand); margin-bottom: 14px; }
.pc-gate p { padding-bottom: 14px; font-size: 14px; }

/* ------------------------------------------------------------------------
 * Modals (auth gate, consent, share, links)
 * --------------------------------------------------------------------- */
.pc-modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  background: var(--pc-scrim); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  overflow-y: auto;
  animation: pc-fade-in 0.16s ease-out;
}
.pc-modal {
  position: relative; width: min(440px, 100%); max-height: 100%; overflow-y: auto;
  background: var(--pc-surface-2); border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-lg); padding: 24px; box-shadow: var(--pc-shadow-dialog);
  animation: pc-rise 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.pc-modal h2 { margin: 0 0 8px; padding-right: 28px; font-size: 20px; }
.pc-modal h2::before { content: ""; display: block; width: 28px; height: 3px; border-radius: 2px; background: var(--pc-brand); margin-bottom: 14px; }
.pc-modal__close {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: var(--pc-radius-sm);
  color: var(--pc-muted); font-size: 22px; line-height: 1; cursor: pointer;
  transition: background var(--pc-ease), color var(--pc-ease);
}
.pc-modal__close:hover { background: var(--pc-hover); color: var(--pc-text); }
.pc-lead { color: var(--pc-muted); margin: 0 0 14px; font-size: 14px; }
.pc-consent-note {
  font-size: 13px; line-height: 1.5; margin: 0 0 16px; padding: 10px 12px;
  background: var(--pc-brand-dim); border: 1px solid var(--pc-brand-border); border-left-width: 3px;
  border-radius: var(--pc-radius-sm); color: var(--pc-text);
}
.pc-consent-note strong { color: var(--pc-brand); }
@keyframes pc-fade-in { from { opacity: 0; } }
@keyframes pc-rise { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ------------------------------------------------------------------------
 * Forms
 * --------------------------------------------------------------------- */
.pc-form { display: flex; flex-direction: column; gap: 12px; }
.pc-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--pc-muted); }
.pc-form input[type=email], .pc-form input[type=password], .pc-form input[type=text], .pc-form input[type=number],
.pc-form input:not([type]) {
  background: var(--pc-surface); border: 1px solid var(--pc-border); color: var(--pc-text);
  border-radius: var(--pc-radius-sm); padding: 10px 12px; font-size: 14px; letter-spacing: normal; text-transform: none; font-weight: 400;
  min-height: 40px; width: 100%;
  transition: border-color var(--pc-ease), box-shadow var(--pc-ease), background var(--pc-ease);
}
.pc-form input:hover:not(:disabled) { border-color: var(--pc-border-strong); }
.pc-form input:focus, .pc-form input:focus-visible {
  outline: none; border-color: var(--pc-brand-border); box-shadow: 0 0 0 3px var(--pc-brand-dim);
}
.pc-form input:disabled { opacity: var(--pc-disabled-opacity); cursor: not-allowed; }
.pc-form input[aria-invalid="true"], .pc-form input:user-invalid { border-color: rgba(248, 113, 113, 0.6); }
.pc-form input::-webkit-outer-spin-button, .pc-form input::-webkit-inner-spin-button { opacity: 1; }
.pc-form > .pc-btn { margin-top: 4px; }
.pc-form__links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pc-check {
  flex-direction: row !important; align-items: flex-start; gap: 10px !important;
  color: var(--pc-text) !important; font-size: 14px !important; font-weight: 400 !important; text-transform: none !important; letter-spacing: normal !important;
  padding: 12px; border: 1px solid var(--pc-border); border-radius: var(--pc-radius-sm); background: var(--pc-surface); cursor: pointer;
  transition: border-color var(--pc-ease), background var(--pc-ease);
}
.pc-check:hover { border-color: var(--pc-border-strong); }
.pc-check:has(input:checked) { border-color: var(--pc-brand-border); background: var(--pc-brand-dim); }
.pc-check input { margin: 3px 0 0; width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--pc-brand); cursor: pointer; }
.pc-check input:focus-visible { outline: 2px solid var(--pc-brand); outline-offset: 2px; }
.pc-check span { line-height: 1.5; }
.pc-error { color: var(--pc-danger); font-size: 13px; margin: 0; min-height: 1em; line-height: 1.4; }
.pc-error:empty { display: none; }
.pc-muted { color: var(--pc-muted); font-size: 13px; }
.pc-muted a { color: var(--pc-brand); }

/* ------------------------------------------------------------------------
 * Share result / links list
 * --------------------------------------------------------------------- */
.pc-share-result p { margin: 0 0 10px; color: var(--pc-muted); font-size: 13px; }
.pc-share-result p::before { content: "✓ "; color: var(--pc-success); font-weight: 700; }
.pc-share-row { display: flex; gap: 8px; align-items: center; }
.pc-form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.pc-share-link {
  flex: 1; min-width: 0; background: var(--pc-surface); border: 1px solid var(--pc-border); color: var(--pc-text);
  border-radius: var(--pc-radius-sm); padding: 9px 10px; font-size: 12.5px; font-family: var(--pc-mono); letter-spacing: -0.01em;
  min-height: 36px; text-overflow: ellipsis;
}
.pc-share-link:focus, .pc-share-link:focus-visible { outline: none; border-color: var(--pc-brand-border); box-shadow: 0 0 0 3px var(--pc-brand-dim); }
.pc-shares { display: flex; flex-direction: column; max-height: min(60vh, 520px); overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.pc-share-item { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--pc-border); }
.pc-share-item:last-child { border-bottom: 0; }
.pc-share-item.is-inactive { opacity: 0.55; }
.pc-share-item.is-inactive .pc-share-link { text-decoration: line-through; color: var(--pc-muted); }

/* ------------------------------------------------------------------------
 * Pages: sessions, account, share-missing
 * --------------------------------------------------------------------- */
.pc-page {
  max-width: 1080px; width: 100%; margin: 0 auto; padding: 28px 16px 56px;
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
.pc-page h1 { margin: 0 0 18px; font-size: 24px; display: flex; align-items: center; gap: 12px; }
.pc-page h1::before { content: ""; width: 4px; height: 22px; border-radius: 2px; background: var(--pc-brand); flex: 0 0 auto; }
.pc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.pc-card--openable { cursor: pointer; }
.pc-card--openable .pc-card__tools,
.pc-card--openable .pc-card__actions { cursor: default; }
.pc-card {
  display: flex; gap: 14px; background: var(--pc-surface-2); border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius); padding: 14px;
  transition: border-color var(--pc-ease), box-shadow var(--pc-ease), transform var(--pc-ease);
}
.pc-card:hover { border-color: var(--pc-border-strong); box-shadow: var(--pc-shadow-pop); }
.pc-card:focus-within { border-color: var(--pc-brand-border); }
.pc-card__thumb { width: 96px; height: 96px; border-radius: var(--pc-radius-sm); object-fit: cover; background: var(--pc-bg); flex: 0 0 auto; border: 1px solid var(--pc-border); }
.pc-card__thumb--empty { display: grid; place-items: center; color: var(--pc-brand); font-weight: 700; letter-spacing: 0.08em; font-size: 13px; background: linear-gradient(160deg, var(--pc-brand-dim), var(--pc-bg) 70%); }
.pc-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pc-card__head { display: flex; align-items: flex-start; gap: 6px; }
.pc-card__name-wrap { flex: 1; min-width: 0; }
.pc-card__title {
  margin: 0; font-weight: 600; font-size: 16px; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 4px 6px; margin: -4px -6px 0;
}
.pc-card__tools { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; margin: -4px -4px 0 0; }
.pc-card__name {
  background: transparent; border: 1px solid transparent; color: var(--pc-text); font-weight: 600; font-size: 16px;
  padding: 4px 6px; margin: -4px -6px 0; border-radius: var(--pc-radius-sm); width: calc(100% + 12px); min-width: 0;
  transition: border-color var(--pc-ease), background var(--pc-ease), box-shadow var(--pc-ease);
}
.pc-card__name[hidden] { display: none; }
.pc-card__name:hover { border-color: var(--pc-border); background: var(--pc-surface); }
.pc-card__name:focus, .pc-card__name:focus-visible { outline: none; border-color: var(--pc-brand-border); background: var(--pc-surface); box-shadow: 0 0 0 3px var(--pc-brand-dim); }
.pc-card__meta { list-style: none; margin: 0; padding: 0; color: var(--pc-muted); font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.pc-card__processing { margin: 0; color: var(--pc-brand); font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.pc-card__processing::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--pc-brand); box-shadow: 0 0 8px rgba(255, 200, 0, 0.5); animation: pc-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes pc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.pc-card__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.pc-section { background: var(--pc-surface-2); border: 1px solid var(--pc-border); border-radius: var(--pc-radius); padding: 20px; margin-bottom: 16px; }
.pc-section h1 { font-size: 22px; }
.pc-section h2 { margin: 0 0 12px; font-size: 16px; }
.pc-section .pc-btn { margin-top: 8px; }
.pc-section .pc-form { max-width: 480px; }
.pc-section .pc-form div .pc-btn { margin-top: 0; }
.pc-section--notice { max-width: 520px; margin: 48px auto 0; text-align: center; padding: 36px 28px; }
.pc-section--notice h1 { justify-content: center; }
.pc-section--notice .pc-muted { margin: 0 0 20px; font-size: 14px; }

/* Empty state ("No saved sessions yet") */
.pc-empty {
  border: 1px dashed var(--pc-border-strong); border-radius: var(--pc-radius); padding: 40px 24px;
  text-align: center; color: var(--pc-muted); font-size: 14px; background: var(--pc-surface);
  margin: 0 0 16px;
}
.pc-empty::before {
  content: ""; display: block; width: 44px; height: 44px; margin: 0 auto 14px; border-radius: 12px;
  background: var(--pc-brand-dim); border: 1px solid var(--pc-brand-border);
  background-image: linear-gradient(var(--pc-brand), var(--pc-brand)), linear-gradient(var(--pc-brand), var(--pc-brand));
  background-size: 16px 2px, 2px 16px; background-position: center; background-repeat: no-repeat;
}

/* ------------------------------------------------------------------------
 * Toasts — glass pill with a status dot, mirroring the viewer's
 * vue-toastification overrides in [global.css].
 * --------------------------------------------------------------------- */
.pc-toasts {
  position: fixed; z-index: 200;
  right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none;
}
.pc-toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  background: var(--pc-glass); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
  color: var(--pc-text); border: 1px solid rgba(255, 255, 255, 0.09); border-radius: var(--pc-radius-lg);
  padding: 12px 10px 12px 16px; font-size: 13px; font-weight: 500; line-height: 1.45; max-width: min(360px, calc(100vw - 32px));
  cursor: pointer; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: pc-toast-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.pc-toast__msg { flex: 1 1 auto; min-width: 0; }
.pc-toast__close {
  flex: 0 0 auto; width: 22px; height: 22px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08); color: var(--pc-text); font-size: 16px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.pc-toast__close:hover { background: rgba(255, 255, 255, 0.16); }
.pc-toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--pc-brand); box-shadow: 0 0 8px rgba(255, 200, 0, 0.5); }
.pc-toast--error::before { background: var(--pc-danger); box-shadow: 0 0 8px rgba(248, 113, 113, 0.5); }
.pc-toast--success::before { background: var(--pc-success); box-shadow: 0 0 8px rgba(74, 222, 128, 0.5); }
.pc-toast--warning::before { background: var(--pc-warning); }
.pc-toast--error { border-color: rgba(248, 113, 113, 0.25); }
.pc-toast--success { border-color: rgba(74, 222, 128, 0.25); }
@keyframes pc-toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------------------
 * Responsive / mobile
 * --------------------------------------------------------------------- */
@media (max-width: 640px) {
  :root { --pc-header-h: 44px; }
  .pc-header { gap: 8px; }
  .pc-header__nav { display: none; }
  .pc-card { flex-direction: column; }
  .pc-card__thumb { width: 100%; height: 140px; }
  .pc-page { padding-top: 20px; }
  /* Modals become a full-width bottom sheet with safe-area padding. */
  .pc-modal-backdrop { place-items: end center; padding: 0; }
  .pc-modal {
    width: 100%; max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 12px);
    border-radius: var(--pc-radius-lg) var(--pc-radius-lg) 0 0; border-bottom: 0;
    padding: 22px max(18px, env(safe-area-inset-right)) calc(22px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left));
    animation-name: pc-sheet-in;
  }
  .pc-gate > * { width: 100%; }
  .pc-toasts { left: max(16px, env(safe-area-inset-left)); align-items: stretch; }
  .pc-toast { max-width: none; }
  .pc-share-row { flex-wrap: wrap; }
  .pc-share-row .pc-btn { flex: 1 1 auto; }
}
@keyframes pc-sheet-in { from { opacity: 0; transform: translateY(24px); } }

/* Touch targets */
@media (pointer: coarse) {
  .pc-btn { min-height: 42px; }
  .pc-form input[type=email], .pc-form input[type=password], .pc-form input[type=text], .pc-form input[type=number] { min-height: 44px; font-size: 16px; }
}

/* Reduced motion: no entrance animations, no spinners spinning fast, no transitions. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .pc-status.is-busy::before { animation: none; border-color: var(--pc-brand); }
  .pc-card__processing::before { animation: none; }
}

/* High contrast preference: solid borders instead of tinted ones. */
@media (prefers-contrast: more) {
  :root { --pc-border: #4a4a4a; --pc-border-strong: #6a6a6a; --pc-muted: #c4c4c4; }
  .pc-btn--ghost { border-color: var(--pc-border); }
}
