/* Team Post Kit shell/navigation account menu styles. */

/* =============================================================================
   Account dropdown menu (nav avatar → profile / billing / admin / logout)
   ============================================================================= */
/* Right margin keeps the avatar pill (and its right-aligned dropdown) off the
   header's right edge for a bit of breathing room. */
.tpk-account-menu { position: relative; margin-right: 0.5rem; }
.tpk-avatar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.4rem 0.2rem 0.2rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.tpk-avatar-btn:hover,
.tpk-avatar-btn[aria-expanded="true"] {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
}
.tpk-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(120deg, var(--primary), var(--tpk-accent));
}
.tpk-avatar-caret { color: var(--muted); transition: transform 0.2s ease; }
.tpk-avatar-btn[aria-expanded="true"] .tpk-avatar-caret { transform: rotate(180deg); }

.tpk-account-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 260px;
  padding: 0.5rem;
  background: var(--surface, #11151f);
  border: 1px solid var(--border, rgba(148, 163, 184, 0.22));
  border-radius: 14px;
  box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.7);
  z-index: 60;
}
.tpk-account-dropdown[hidden] { display: none; }
.tpk-account-dropdown-head {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.35rem 0.6rem 0.5rem;
}
.tpk-account-dropdown-usage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem 0.5rem;
}
.tpk-account-dropdown-usage-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.tpk-account-dropdown-name { font-weight: 700; font-size: 0.92rem; color: var(--text); }
.tpk-account-dropdown-email {
  font-size: 0.78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tpk-account-dropdown-link {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #d4dcec;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.tpk-account-dropdown-link:hover { background: rgba(99, 102, 241, 0.16); color: var(--text); }
.tpk-account-dropdown-divider {
  height: 1px;
  margin: 0.35rem 0.4rem;
  background: var(--border, rgba(148, 163, 184, 0.2));
}
.tpk-account-dropdown-section {
  display: block;
  padding: 0.25rem 0.6rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.tpk-install-tip {
  display: none;
}

@media (max-width: 820px) {
  .tpk-install-tip:not([hidden]) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    margin: 0.35rem 0.4rem 0.1rem;
    padding: 0.65rem 0.65rem 0.65rem 0.75rem;
    border: 1px solid rgba(47, 227, 255, 0.28);
    border-radius: 10px;
    background: rgba(8, 47, 73, 0.34);
  }

  .tpk-install-tip-copy {
    display: grid;
    gap: 0.12rem;
    min-width: 0;
  }

  .tpk-install-tip-copy strong {
    color: var(--text);
    font-size: 0.8rem;
  }

  .tpk-install-tip-copy span {
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .tpk-install-tip-copy em {
    color: #c7d2fe;
    font-style: normal;
    font-weight: 700;
  }

  .tpk-install-tip-dismiss {
    display: grid;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: rgba(15, 23, 42, 0.78);
    color: var(--muted);
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
  }
}

/* =============================================================================
   Shared button primitives
   =============================================================================
   base_tpk.html and public marketing pages use the same button classes as the
   workstation. Keep the generic sizing/display rules in the always-loaded shell
   CSS so public pages do not depend on schedule-designer.css for basic buttons.
*/
.btn-solid {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 1.35rem;
  border: none;
  border-radius: var(--radius-pill);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-solid:active {
  transform: translateY(1px);
  filter: brightness(0.95);
}
/* Keyboard focus ring: shown only for keyboard nav (:focus-visible), so mouse
   clicks stay clean. Applies to every .btn-solid (links + buttons) app-wide. */
.btn-solid:focus-visible {
  outline: 2px solid var(--tpk-logo-cyan, #2fe3ff);
  outline-offset: 2px;
}
.btn-solid.disabled,
.btn-solid:disabled,
.btn-solid[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.btn-main {
  background: var(--primary);
  color: #fff;
}
.btn-main:hover {
  background: var(--primary-dark);
}
.btn-grid {
  background: var(--badge-grid);
  color: #0b1a2a;
}
.btn-grid:hover {
  background: #2f98ff;
}
.btn-neutral {
  background: var(--btn-neutral);
  color: var(--text);
}
.btn-neutral:hover {
  background: var(--btn-neutral-dark);
}

/* =============================================================================
   Shared shell modals
   =============================================================================
   base_tpk.html renders the confirm, image zoom, and text-edit modals for the
   whole TPK shell. Keep their hidden/default styling with the shell so public
   pages do not depend on the heavier workstation/style-picker bundles.
*/
.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(4, 6, 12, 0.88);
  z-index: 1000;
}
.modal-overlay.show {
  display: flex;
}
.modal-card {
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.modal-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}
.modal-card p {
  margin: 0 0 1.25rem;
  color: var(--muted);
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}
body.modal-open,
body.gd-textedit-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.image-zoom-modal {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
  background: rgba(4, 6, 12, 0.96);
  backdrop-filter: blur(6px);
  touch-action: none;
  overscroll-behavior: contain;
  z-index: 1200;
}
.image-zoom-modal.show {
  display: flex;
}
.image-zoom-toolbar {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  right: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: rgba(15, 18, 28, 0.78);
  box-shadow: var(--shadow);
  z-index: 3;
}
.image-zoom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border: none;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.image-zoom-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
.image-zoom-share-icon {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.image-zoom-level {
  min-width: 3.2rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  user-select: none;
}
.image-zoom-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
}
.image-zoom-stage[aria-busy="true"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2rem;
  height: 2rem;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--accent, #2dd4bf);
  border-radius: 50%;
  transform: translate(-50%, -2.2rem);
  animation: image-zoom-loading-spin 0.7s linear infinite;
}
.image-zoom-stage[aria-busy="true"]::after {
  content: "Loading image…";
  position: absolute;
  top: 50%;
  left: 50%;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  transform: translate(-50%, 0.85rem);
}
@keyframes image-zoom-loading-spin {
  to {
    transform: translate(-50%, -2.2rem) rotate(360deg);
  }
}
.image-zoom-stage.is-panning {
  cursor: grabbing;
}
.image-zoom-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: 0 0;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}
.image-zoom-hint {
  position: absolute;
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  left: 50%;
  margin: 0;
  max-width: 88vw;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  opacity: 0.85;
  pointer-events: none;
  transform: translateX(-50%);
}

.gd-textedit-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(4, 6, 12, 0.78);
  z-index: 1200;
}
.gd-textedit-modal[aria-hidden="false"] {
  display: flex;
}
.gd-textedit-card {
  width: min(720px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface, #121826);
}
.gd-textedit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.gd-textedit-title {
  margin: 0;
  font-size: 1.05rem;
}
.gd-textedit-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  opacity: 0.8;
  cursor: pointer;
}
.gd-textedit-close:hover {
  color: var(--text);
  opacity: 1;
}
.gd-textedit-field {
  width: 100%;
  flex: 1 1 auto;
  min-height: 45vh;
  resize: none;
  line-height: 1.5;
}
.gd-textedit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

@media (max-width: 640px) {
  .gd-textedit-modal {
    padding: 0;
  }
  .gd-textedit-card {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    max-height: 100svh; /* Android Chrome: keep the card within the visible viewport while the URL bar is shown */
    border: none;
    border-radius: 0;
  }
  .gd-textedit-field {
    min-height: 0;
  }
  .gd-textedit-actions .btn-solid {
    flex: 1 1 0;
  }
}

/* Flash messages on shell-rendered pages (landing, logged-out, account, etc.).
   base_tpk.html always renders the `.flash-stack` but only loads the shell
   bundles, so the default toast skin must live here — the denser variant in
   schedule-designer.css covers workstation pages. Keep visuals in sync. */
.flash-stack {
  display: grid;
  gap: 0.6rem;
}
.flash-stack:has(.flash) {
  min-height: 3.5rem;
}
.flash-stack:not(:has(.flash)) {
  display: none;
}
.flash {
  padding: 0.9rem 1.2rem;
  border-radius: 16px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.flash-error {
  border-color: rgba(245, 72, 110, 0.6);
  color: var(--error-text);
  background-color: rgba(245, 72, 110, 0.1);
}
.flash-info {
  border-color: rgba(var(--primary-rgb), 0.4);
}
.flash-hide {
  opacity: 0;
  transform: translateY(-10px);
}

/* ------------------------------------------------- press + navigation feedback
   Full-page navigations give no native feedback in iOS standalone mode (no URL
   bar spinner), so every tappable nav element needs an :active press state and
   in-flight navigations show a top progress bar (started by tpk_shell.js). */

/* Press states for nav elements that aren't .btn-solid (which has its own). */
a.wizard-step:active,
.tpk-mobile-link:active,
.tpk-mobile-menu-btn:active,
.tpk-account-dropdown-link:active,
.tpk-avatar-btn:active,
.tpk-nav-link:active {
  filter: brightness(1.35);
  transform: scale(0.97);
}

/* Indeterminate top progress bar shown from tap until the next page paints.
   The base bar carries a solid faint tint so it stays visible even when the
   sliding animation is throttled — iOS Low Power Mode disables CSS animations,
   which otherwise left the bar (and its off-screen gradient band) invisible in
   Safari and the installed PWA. The moving highlight rides on a compositor
   transform, which WebKit animates far more reliably than background-position. */
.tpk-nav-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 2000;
  pointer-events: none;
  overflow: hidden;
  background: rgba(72, 245, 192, 0.28); /* fallback for no color-mix */
  background: color-mix(in srgb, var(--primary, #48f5c0) 28%, transparent);
}

.tpk-nav-progress::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  background-image: linear-gradient(
    90deg,
    transparent,
    var(--primary, #48f5c0),
    transparent
  );
  will-change: transform;
  animation: tpk-nav-progress-slide 1.1s ease-in-out infinite;
}

@keyframes tpk-nav-progress-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(350%);
  }
}

/* The clicked link/pill/button pulses while its navigation is in flight. */
.is-nav-busy {
  animation: tpk-nav-busy-pulse 1s ease-in-out infinite;
}

@keyframes tpk-nav-busy-pulse {
  50% {
    opacity: 0.45;
  }
}
