/* popup.css — Immersive Translate Notebook */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #090d13;
  --panel: #101827;
  --panel-soft: #141f30;
  --panel-card: #18253a;
  --ink: #ebf2ff;
  --ink-soft: #a8bad8;
  --ink-muted: #7485a1;
  --accent: #65d0ff;
  --accent-strong: #2bb7ff;
  --accent-warm: #ffc670;
  --danger: #ff6f6f;
  --success: #53e7b0;
  --border: rgba(129, 166, 214, 0.24);
  --border-strong: rgba(161, 223, 255, 0.38);
  --glass: rgba(17, 31, 49, 0.78);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  --shadow-panel: 0 20px 48px rgba(4, 8, 14, 0.6);
  --shadow-card: 0 16px 34px rgba(4, 9, 16, 0.52);

  --font-title: "Bricolage Grotesque", "Noto Sans TC", sans-serif;
  --font-body: "Noto Sans TC", "Bricolage Grotesque", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --easing: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  font-size: 15px;
  width: 620px;
  height: 600px;
}

body {
  width: 620px;
  height: 600px;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(120% 120% at 6% -5%, rgba(36, 121, 201, 0.35) 0%, rgba(36, 121, 201, 0) 58%),
    radial-gradient(110% 100% at 95% 105%, rgba(255, 198, 112, 0.14) 0%, rgba(255, 198, 112, 0) 50%),
    var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  isolation: isolate;
  background: linear-gradient(156deg, rgba(8, 16, 28, 0.96) 0%, rgba(8, 14, 22, 0.94) 48%, rgba(9, 13, 19, 0.98) 100%);
  border: 1px solid rgba(146, 183, 231, 0.24);
  border-radius: 18px;
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}

.app>.header,
.app>.toolbar {
  flex-shrink: 0;
}

.bg-layer {
  position: absolute;
  pointer-events: none;
  inset: 0;
  z-index: -1;
}

.bg-a {
  background:
    radial-gradient(40% 42% at 88% 9%, rgba(79, 191, 255, 0.24) 0%, rgba(79, 191, 255, 0) 75%),
    radial-gradient(42% 38% at 6% 62%, rgba(255, 198, 112, 0.08) 0%, rgba(255, 198, 112, 0) 84%);
}

.bg-b {
  opacity: 0.22;
  background-image: linear-gradient(125deg, transparent 0 46%, rgba(255, 255, 255, 0.5) 49%, transparent 52%);
  transform: translateX(-32%);
}

.header {
  padding: 14px 16px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(19, 35, 55, 0.78) 0%, rgba(16, 24, 39, 0.82) 100%);
  backdrop-filter: blur(8px);
}

.header-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(83, 231, 176, 0.14);
}

.status-text {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-family: var(--font-mono);
}

.header-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
}

.header-icon {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  border: 1px solid rgba(161, 223, 255, 0.32);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  background:
    radial-gradient(140% 140% at 20% 20%, rgba(103, 221, 255, 0.32) 0%, rgba(103, 221, 255, 0.05) 52%, transparent 100%),
    rgba(17, 31, 49, 0.8);
  box-shadow: inset 0 0 24px rgba(57, 176, 255, 0.18);
}

.header-title {
  font-family: var(--font-title);
  font-size: 1.38rem;
  line-height: 1.1;
  letter-spacing: 0.015em;
  font-weight: 740;
}

.header-sub {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 3px;
}

.header-count {
  min-width: 72px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: linear-gradient(165deg, rgba(101, 208, 255, 0.2) 0%, rgba(101, 208, 255, 0.04) 100%);
  text-align: center;
}

#total-count {
  display: block;
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 720;
  line-height: 1;
  color: #d7f3ff;
}

.count-label {
  display: block;
  margin-top: 2px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-family: var(--font-mono);
}

.toolbar {
  padding: 14px 16px 13px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(16, 24, 39, 0.78) 0%, rgba(13, 22, 34, 0.94) 100%);
  backdrop-filter: blur(5px);
}

.actions-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  gap: 10px;
  margin-bottom: 12px;
}

.btn {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 9px 12px;
  font-family: var(--font-title);
  font-size: 0.82rem;
  font-weight: 640;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: transform 160ms var(--easing), border-color 160ms var(--easing), background-color 160ms var(--easing), box-shadow 160ms var(--easing);
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(101, 208, 255, 0.25);
}

.btn-icon {
  font-size: 0.84rem;
  line-height: 1;
}

.btn-text {
  line-height: 1;
}

.btn-primary {
  color: #04121d;
  border-color: rgba(174, 231, 255, 0.6);
  background: linear-gradient(100deg, #73ddff 0%, #58ceff 45%, #a6e6ff 100%);
  box-shadow: 0 12px 20px rgba(31, 173, 238, 0.34);
}

.btn-secondary {
  color: var(--ink);
  border-color: rgba(155, 186, 231, 0.34);
  background: rgba(20, 34, 55, 0.88);
}

.btn-danger {
  color: #ffd0d0;
  border-color: rgba(255, 136, 136, 0.4);
  background: rgba(73, 25, 33, 0.78);
}

#btn-clear {
  min-width: 104px;
}

.btn:disabled {
  opacity: 0.65;
  pointer-events: none;
  transform: none;
}

.status-bar {
  border-radius: 10px;
  padding: 7px 10px;
  margin-bottom: 10px;
  font-size: 0.82rem;
  line-height: 1.35;
  border: 1px solid var(--border);
  animation: statusIn 180ms var(--easing);
}

.status-bar.hidden {
  display: none;
}

.status-bar.success {
  color: #b2ffe2;
  border-color: rgba(83, 231, 176, 0.34);
  background: rgba(14, 70, 56, 0.5);
}

.status-bar.error {
  color: #ffd4d4;
  border-color: rgba(255, 111, 111, 0.4);
  background: rgba(95, 30, 44, 0.54);
}

.status-bar.info {
  color: #d2f3ff;
  border-color: rgba(101, 208, 255, 0.4);
  background: rgba(28, 62, 88, 0.48);
}

.search-bar {
  display: flex;
  align-items: center;
  border: 1px solid rgba(155, 186, 231, 0.34);
  border-radius: 11px;
  background: rgba(20, 35, 56, 0.7);
  margin-bottom: 10px;
  transition: border-color 140ms var(--easing), box-shadow 140ms var(--easing);
}

.search-bar:focus-within {
  border-color: rgba(172, 229, 255, 0.74);
  box-shadow: 0 0 0 3px rgba(101, 208, 255, 0.2);
}

.search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.search-input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 10px 10px 10px 0;
}

.search-input::placeholder {
  color: #7f95b8;
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-tabs {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(155, 186, 231, 0.28);
  background: rgba(18, 32, 51, 0.68);
  gap: 3px;
}

.filter-tab {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-title);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  padding: 6px 12px;
  cursor: pointer;
  transition: background-color 130ms var(--easing), color 130ms var(--easing);
}

.filter-tab:hover {
  color: #d7e8ff;
}

.filter-tab.active {
  color: #05131f;
  background: linear-gradient(110deg, #70deff 0%, #ffc670 100%);
}

.source-select {
  flex: 1 1 150px;
  min-width: 130px;
  background: rgba(18, 32, 51, 0.68);
  border: 1px solid rgba(155, 186, 231, 0.28);
  color: #d7e8ff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-family: var(--font-body);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%237f95b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 10px top 55%;
  background-size: 8px auto;
  padding-right: 24px;
}

.source-select option {
  background: var(--panel-card);
  color: var(--ink);
}

.filter-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(155, 186, 231, 0.28);
  background: rgba(18, 32, 51, 0.68);
  color: var(--ink-soft);
  margin-left: auto;
}

.filter-meta-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-family: var(--font-mono);
}

.filter-meta-count {
  min-width: 20px;
  text-align: center;
  border-radius: 999px;
  background: rgba(101, 208, 255, 0.16);
  color: #c5ebff;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 2px 5px;
}

.micro-hint {
  margin-top: 8px;
  color: #7389ac;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

.pairs-container {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pairs-container::-webkit-scrollbar {
  width: 7px;
}

.pairs-container::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(151, 181, 219, 0.34);
}

.pairs-container::-webkit-scrollbar-track {
  background: transparent;
}

.pair-card {
  border-radius: var(--radius-md);
  border: 1px solid rgba(156, 189, 239, 0.28);
  background:
    linear-gradient(180deg, rgba(24, 37, 58, 0.94) 0%, rgba(17, 29, 46, 0.9) 100%);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  flex-shrink: 0;
  transform-origin: 50% 0;
}

.pair-card:hover {
  border-color: rgba(184, 226, 255, 0.42);
}

.pair-card-enter {
  animation: cardFreshIn 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.pair-original,
.pair-translation {
  padding: 12px 13px;
  line-height: 1.64;
  letter-spacing: 0.01em;
  word-break: break-word;
}

.pair-original {
  color: #b2c4de;
  border-bottom: 1px solid rgba(156, 189, 239, 0.2);
  font-size: 0.88rem;
}

.pair-translation {
  color: var(--ink);
  font-size: 1rem;
}

.pair-original::before,
.pair-translation::before {
  display: inline-block;
  margin-right: 7px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border-radius: 6px;
  padding: 2px 6px;
  vertical-align: baseline;
}

.pair-original::before {
  content: "SRC";
  background: rgba(126, 153, 191, 0.2);
  border: 1px solid rgba(163, 190, 228, 0.24);
  color: #90a7ca;
}

.pair-translation::before {
  content: "TR";
  background: rgba(102, 208, 255, 0.18);
  border: 1px solid rgba(164, 231, 255, 0.36);
  color: #c1efff;
}

.pair-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px 10px;
  border-top: 1px solid rgba(156, 189, 239, 0.16);
  color: #8395b2;
  font-size: 0.76rem;
  flex-wrap: wrap;
  background: rgba(10, 18, 29, 0.35);
}

.pair-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.pair-action-btn {
  border: 1px solid rgba(160, 219, 255, 0.38);
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(34, 66, 95, 0.62);
  color: #d9f4ff;
  font-family: var(--font-body);
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 120ms var(--easing), border-color 120ms var(--easing), transform 120ms var(--easing);
}

.pair-action-btn:hover {
  background: rgba(58, 105, 146, 0.64);
  border-color: rgba(191, 236, 255, 0.58);
  transform: translateY(-1px);
}

.pair-action-btn.subtle {
  border-color: rgba(152, 176, 206, 0.3);
  background: rgba(26, 43, 63, 0.52);
  color: #aec2de;
}

.pair-action-btn.active {
  background: rgba(255, 198, 112, 0.2);
  border-color: rgba(255, 198, 112, 0.6);
  color: #ffde99;
}

.pair-type-badge {
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid rgba(156, 189, 239, 0.24);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.pair-type-badge.web {
  color: #9df2d1;
  border-color: rgba(83, 231, 176, 0.34);
  background: rgba(13, 64, 52, 0.46);
}

.pair-type-badge.video {
  color: #ffd4ab;
  border-color: rgba(255, 198, 112, 0.42);
  background: rgba(76, 50, 13, 0.46);
}

.pair-meta-url {
  color: #94a7c6;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 80px;
}

.pair-meta-time {
  font-family: var(--font-mono);
}

.empty-state {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  color: #a4b5ce;
  padding: 30px 18px;
}

.empty-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(162, 213, 255, 0.34);
  background: radial-gradient(circle at 35% 35%, rgba(120, 226, 255, 0.34) 0%, rgba(120, 226, 255, 0.05) 56%, transparent 100%);
  font-size: 1.5rem;
  margin-bottom: 2px;
}

.empty-hint {
  color: #778aa9;
  font-size: 0.84rem;
  line-height: 1.7;
}

mark {
  color: #ffebc9;
  background: rgba(255, 198, 112, 0.26);
  border-radius: 4px;
  padding: 0 2px;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.992);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cardFreshIn {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.985);
    border-color: rgba(128, 228, 255, 0.55);
    box-shadow: 0 0 0 rgba(96, 211, 255, 0);
  }

  65% {
    opacity: 1;
    transform: translateY(2px) scale(1.002);
    border-color: rgba(173, 236, 255, 0.64);
    box-shadow: 0 10px 22px rgba(61, 187, 255, 0.22);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    border-color: rgba(156, 189, 239, 0.28);
    box-shadow: var(--shadow-card);
  }
}

@keyframes statusIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 560px) {
  .actions-bar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }

  #btn-extract {
    grid-column: 1 / -1;
  }
}
