/* QPal LET video-guide launcher alignment, popup sizing, and admin settings. */

.dashboard-topbar.qpal-let-video-guide-topbar {
  width: 100%;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.qpal-let-video-guide-launcher {
  width: auto;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: 0 0 0 auto;
  padding: 0;
}

.qpal-let-video-guide-pill {
  width: 52px;
  height: 52px;
  min-width: 52px;
  max-width: 52px;
  display: grid;
  grid-template-columns: none;
  place-items: center;
  gap: 0;
  padding: 0;
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface-elevated) 90%, var(--accent-soft));
  color: var(--accent);
  box-shadow: var(--shadow-control), var(--inner-highlight);
  text-align: center;
}

.qpal-let-video-pill-icon {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
}

.qpal-let-video-pill-icon svg {
  width: 24px;
  height: 24px;
}

body.qpal-let-video-admin-open {
  overflow: hidden;
}

.qpal-let-video-guide-overlay,
.qpal-let-video-admin-overlay {
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.qpal-let-video-guide-panel,
.qpal-let-video-guide-panel.qpal-popup-height-limited,
.qpal-let-video-admin-dialog,
.qpal-let-video-admin-dialog.qpal-popup-height-limited {
  width: min(780px, 100%);
  height: auto !important;
  max-height: var(
    --qpal-popup-max-height,
    min(920px, calc(100dvh - 32px))
  ) !important;
  min-height: 0 !important;
  overflow: hidden !important;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
}

.qpal-let-video-list {
  min-height: 0;
  flex: 1 1 auto;
}

.qpal-let-video-loading {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--text-secondary);
  text-align: center;
}

.qpal-let-video-loading > span {
  width: 28px;
  height: 28px;
  border: 3px solid color-mix(in srgb, var(--text-secondary) 22%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: qpalLetVideoGuideSpin 700ms linear infinite;
}

.qpal-let-video-loading strong {
  font-size: 12px;
  font-weight: 800;
}

@keyframes qpalLetVideoGuideSpin {
  to {
    transform: rotate(360deg);
  }
}

.qpal-let-video-admin-entry {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-muted);
}

.qpal-let-video-admin-entry-button {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.qpal-let-video-admin-entry-button:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
}

.qpal-let-video-admin-entry-button:focus-visible,
.qpal-let-video-admin-close:focus-visible,
.qpal-let-video-admin-row input:focus-visible,
.qpal-let-video-admin-cancel:focus-visible,
.qpal-let-video-admin-save:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 44%, transparent);
  outline-offset: 2px;
}

.qpal-let-video-admin-entry-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.qpal-let-video-admin-entry-icon svg {
  width: 18px;
  height: 18px;
}

.qpal-let-video-admin-entry-button > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.qpal-let-video-admin-entry-button strong {
  font-size: 12px;
  font-weight: 800;
}

.qpal-let-video-admin-entry-button small {
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-size: 9px;
  line-height: 1.35;
}

.qpal-let-video-admin-entry-button > span:last-child {
  color: var(--text-secondary);
  font-size: 22px;
  line-height: 1;
}

.qpal-let-video-admin-overlay {
  position: fixed;
  inset: 0;
  z-index: 11400;
  display: flex;
  background: var(--overlay-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.qpal-let-video-admin-dialog,
.qpal-let-video-admin-dialog.qpal-popup-height-limited {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  background: var(--surface-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-dialog), var(--inner-highlight);
}

.qpal-let-video-admin-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: start;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.qpal-let-video-admin-header > div {
  min-width: 0;
  display: grid;
  gap: var(--qpal-popup-heading-gap, 1.8px);
}

.qpal-let-video-admin-header span,
.qpal-let-video-admin-header h2,
.qpal-let-video-admin-header p {
  margin: 0;
}

.qpal-let-video-admin-header span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.qpal-let-video-admin-header h2 {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.qpal-let-video-admin-header p {
  max-width: 62ch;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.qpal-let-video-admin-close {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.qpal-let-video-admin-form {
  min-height: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.qpal-let-video-admin-loading {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.qpal-let-video-admin-list {
  min-height: 0;
  display: grid;
  gap: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 22px;
}

.qpal-let-video-admin-row {
  min-width: 0;
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 13px;
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  background: var(--surface);
}

.qpal-let-video-admin-row legend {
  padding: 0 5px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.qpal-let-video-admin-row > strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}

.qpal-let-video-admin-row > label:not(.qpal-let-video-admin-active) {
  display: grid;
  gap: 5px;
}

.qpal-let-video-admin-row label > span {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 750;
}

.qpal-let-video-admin-row input[type="url"] {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 11px;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
}

.qpal-let-video-admin-active {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qpal-let-video-admin-active input {
  accent-color: var(--accent);
}

.qpal-let-video-admin-message {
  min-height: 18px;
  padding: 0 22px 8px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
}

.qpal-let-video-admin-message.is-error {
  color: var(--danger);
}

.qpal-let-video-admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 12px 22px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
}

.qpal-let-video-admin-cancel,
.qpal-let-video-admin-save {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 10px;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.qpal-let-video-admin-cancel {
  border: 1px solid var(--border-subtle);
  background: var(--surface-muted);
  color: var(--text-primary);
}

.qpal-let-video-admin-save {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-contrast, #111);
}

.qpal-let-video-admin-save:disabled {
  opacity: 0.58;
  cursor: wait;
}

@media (max-width: 700px) {
  .qpal-let-video-guide-overlay,
  .qpal-let-video-admin-overlay {
    align-items: center;
    justify-content: center;
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  .qpal-let-video-guide-panel,
  .qpal-let-video-guide-panel.qpal-popup-height-limited,
  .qpal-let-video-admin-dialog,
  .qpal-let-video-admin-dialog.qpal-popup-height-limited {
    width: 100%;
    height: auto !important;
    max-height: var(
      --qpal-popup-max-height,
      min(920px, calc(100dvh - 24px))
    ) !important;
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
  }

  .qpal-let-video-admin-header {
    padding: 16px 16px 14px;
  }

  .qpal-let-video-admin-list {
    padding: 14px 16px;
  }

  .qpal-let-video-admin-actions {
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .qpal-let-video-guide-pill {
    width: 50px;
    height: 50px;
    min-width: 50px;
    max-width: 50px;
  }

  .qpal-let-video-admin-header {
    grid-template-columns: minmax(0, 1fr) 38px;
    gap: 10px;
  }

  .qpal-let-video-admin-close {
    width: 36px;
    height: 36px;
  }

  .qpal-let-video-admin-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .qpal-let-video-loading > span {
    animation: none;
  }
}
