/* The toolbar popup reuses the side panel's styles (sidepanel.css); these are its own. */

/* Only in the popup (the Reader and the website load this file for its switches). */
html:has(body.popup),
body.popup {
  height: auto;
  overflow: visible;
}

body.popup {
  width: 340px;
  margin: 0;
  padding: 14px 14px 12px;
  display: grid;
  gap: 12px;
  background: #ffffff;
}

.popup-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.popup-head > img {
  width: 34px;
  height: 34px;
}

.popup-head-text {
  flex: 1;
  min-width: 0;
}

.popup-title {
  font-weight: 800;
  font-size: 16px;
}

.popup-site {
  font-size: 12px;
  color: #5a6f86;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popup-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: #f6f2fc;
  border: 1px solid #e3d6f5;
}

.popup-switch-label {
  font-weight: 700;
  font-size: 15px;
}

.popup-switch-hint {
  font-size: 12px;
  color: #5a6f86;
  line-height: 1.4;
}

/* The big ON / OFF switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-track {
  position: relative;
  width: 56px;
  height: 32px;
  border-radius: 999px;
  background: #d4dce6;
  transition: background-color 0.2s ease;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(31, 42, 55, 0.25);
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-track {
  background: linear-gradient(135deg, #5aa6e8, #b07cd8);
}

.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(24px);
}

.switch input:focus-visible + .switch-track {
  outline: 3px solid #8ec5ff;
  outline-offset: 2px;
}

.switch input:disabled + .switch-track {
  opacity: 0.4;
}

.switch-text {
  min-width: 30px;
  font-weight: 800;
  font-size: 13px;
  color: #5a6f86;
}

.switch input:checked ~ .switch-text {
  color: #6a4fb3;
}

.popup-pdf {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: #eaf7fb;
  border: 1px solid #b6e0f0;
}

.popup-pdf[hidden],
.popup-switch-row[hidden] {
  display: none;
}

.popup-pdf-text {
  font-size: 13px;
  line-height: 1.5;
  color: #2e4057;
}

.popup-style {
  display: grid;
  gap: 10px;
}

.popup-style[hidden] {
  display: none;
}

.popup-applied {
  font-size: 12px;
  line-height: 1.4;
  color: #2f6f4b;
  text-align: center;
}

.popup-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #2e4057;
  cursor: pointer;
}

.popup-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.popup-btn {
  border: 1px solid #b6d2ee;
  background: #eaf4ff;
  color: #1f2a37;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.popup-btn--ghost {
  background: #ffffff;
  border-color: var(--line);
  color: #35618f;
}

.popup-btn:hover {
  transform: scale(1.03);
  border-color: #8ec5ff;
}

@media (prefers-reduced-motion: reduce) {
  .switch-track,
  .switch-thumb,
  .popup-btn {
    transition: none;
  }
}

/* Links that look like buttons (the website links) */
a.transform-btn {
  display: block;
  text-align: center;
  text-decoration: none;
}

/* 🌐 the website, in the header */
.popup-web {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #c9d8ea;
  border-radius: 12px;
  background: #f0f6ff;
  font-size: 16px;
  text-decoration: none;
  transition: transform 0.15s, background-color 0.15s;
}

.popup-web:hover {
  background: #e3f0ff;
  transform: translateY(-1px);
}

.popup-web[hidden] {
  display: none;
}
