/* Toolscribe — shared styles. Tailwind handles most of the visuals,
   this file holds the bits Tailwind can't do well (custom scrollbars,
   diff highlighting, transitions, etc.). */

:root {
  color-scheme: light dark;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* AdSense placeholders show as a subtle dashed area when no ad is loaded. */
.adsense-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  border: 1px dashed rgb(148 163 184 / 0.6);
  border-radius: 0.75rem;
  background: rgb(248 250 252 / 0.6);
  color: rgb(100 116 139);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 1.5rem 0;
}

.dark .adsense-placeholder {
  background: rgb(15 23 42 / 0.6);
  color: rgb(148 163 184);
  border-color: rgb(51 65 85);
}

/* Hide the placeholder once the AdSense ins element is filled. */
.adsense-placeholder ins.adsbygoogle:not([data-ad-status]) {
  display: none;
}

/* File drop area styling shared across upload tools. */
.dropzone {
  border: 2px dashed rgb(148 163 184);
  border-radius: 1rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: rgb(99 102 241);
  background: rgb(238 242 255);
  transform: translateY(-2px);
}

.dark .dropzone {
  border-color: rgb(71 85 105);
}

.dark .dropzone:hover,
.dark .dropzone.dragover {
  border-color: rgb(129 140 248);
  background: rgb(30 41 59);
}

/* Diff colours for the text-compare tool. */
.diff-added {
  background: rgb(220 252 231);
  color: rgb(22 101 52);
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
}

.diff-removed {
  background: rgb(254 226 226);
  color: rgb(153 27 27);
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  text-decoration: line-through;
}

.diff-unchanged {
  color: inherit;
}

.dark .diff-added {
  background: rgb(20 83 45);
  color: rgb(187 247 208);
}

.dark .diff-removed {
  background: rgb(127 29 29);
  color: rgb(254 202 202);
}

/* Spinner used by AI tools while waiting on the backend. */
.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid rgb(199 210 254);
  border-top-color: rgb(79 70 229);
  border-radius: 9999px;
  animation: spin 0.9s linear infinite;
}

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

/* Toast notifications. */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  background: rgb(15 23 42);
  color: white;
  font-size: 0.875rem;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 80;
  pointer-events: none;
  box-shadow: 0 10px 30px rgb(15 23 42 / 0.25);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: rgb(153 27 27);
}

.toast.success {
  background: rgb(22 101 52);
}

/* Code beautifier highlighted output container should scroll. */
.code-output {
  max-height: 28rem;
  overflow: auto;
}

/* Nicer focus rings. */
:focus-visible {
  outline: 2px solid rgb(99 102 241);
  outline-offset: 2px;
  border-radius: 0.375rem;
}

/* Toggle switch (used by audio AI tools for diarization / timestamps). */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle .track {
  position: relative;
  width: 2.5rem;
  height: 1.375rem;
  border-radius: 9999px;
  background: rgb(203 213 225);
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.toggle .thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 9999px;
  background: white;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.2);
  transition: transform 0.2s ease;
}

.toggle input:checked + .track {
  background: rgb(99 102 241);
}

.toggle input:checked + .track .thumb {
  transform: translateX(1.125rem);
}

.toggle input:focus-visible + .track {
  box-shadow: 0 0 0 3px rgb(199 210 254);
}

.dark .toggle .track {
  background: rgb(71 85 105);
}

.dark .toggle input:focus-visible + .track {
  box-shadow: 0 0 0 3px rgb(67 56 202 / 0.6);
}

/* Render timestamps and speaker labels nicely inside transcription output. */
textarea.has-tags {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.7;
}

/* View switcher (Formatted | Plain text) used by audio AI tools. */
.view-btn {
  color: rgb(71 85 105);
  transition: background 0.15s ease, color 0.15s ease;
}
.view-btn[aria-pressed="true"] {
  background: white;
  color: rgb(67 56 202);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
}
.dark .view-btn {
  color: rgb(148 163 184);
}
.dark .view-btn[aria-pressed="true"] {
  background: rgb(30 41 59);
  color: rgb(199 210 254);
}

/* ===========================================================================
   Billing — usage badge + paywall modal
   =========================================================================== */

.usage-badge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  border-radius: 0.875rem;
  background: linear-gradient(135deg, rgb(238 242 255), rgb(243 232 255));
  color: rgb(55 48 163);
  border: 1px solid rgb(199 210 254);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}
.dark .usage-badge {
  background: rgb(30 27 75 / 0.5);
  color: rgb(199 210 254);
  border-color: rgb(67 56 202 / 0.6);
}
.usage-badge.usage-pro {
  background: linear-gradient(135deg, rgb(220 252 231), rgb(187 247 208));
  border-color: rgb(134 239 172);
  color: rgb(20 83 45);
}
.dark .usage-badge.usage-pro {
  background: rgb(20 83 45 / 0.4);
  color: rgb(187 247 208);
  border-color: rgb(34 197 94 / 0.5);
}
.usage-badge.usage-credit {
  background: linear-gradient(135deg, rgb(254 249 195), rgb(253 230 138));
  border-color: rgb(252 211 77);
  color: rgb(120 53 15);
}
.dark .usage-badge.usage-credit {
  background: rgb(120 53 15 / 0.3);
  color: rgb(253 230 138);
  border-color: rgb(217 119 6 / 0.5);
}

.usage-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: white;
  color: rgb(67 56 202);
}
.usage-pill.usage-pro-pill { color: rgb(20 83 45); }
.usage-pill.usage-credit-pill { color: rgb(146 64 14); }
.dark .usage-pill { background: rgb(15 23 42); }

.usage-text { font-weight: 500; }

.usage-bar {
  flex: 1 1 8rem;
  min-width: 6rem;
  height: 0.4rem;
  border-radius: 9999px;
  background: rgb(255 255 255 / 0.6);
  overflow: hidden;
}
.dark .usage-bar { background: rgb(15 23 42 / 0.5); }
.usage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, rgb(99 102 241), rgb(168 85 247));
  transition: width 0.3s ease;
}

.usage-link {
  margin-left: auto;
  font-weight: 600;
  font-size: 0.8rem;
  color: rgb(79 70 229);
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.usage-link:hover { color: rgb(67 56 202); }
.dark .usage-link { color: rgb(165 180 252); }
.dark .usage-link:hover { color: rgb(199 210 254); }

/* Paywall modal */
.paywall.hidden { display: none; }
body.paywall-open { overflow: hidden; }
.paywall {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.paywall-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(15 23 42 / 0.7);
  backdrop-filter: blur(4px);
}
.paywall-card {
  position: relative;
  background: white;
  color: rgb(15 23 42);
  width: 100%;
  max-width: 64rem;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 1.25rem;
  box-shadow: 0 25px 50px rgb(0 0 0 / 0.4);
  padding: 2rem;
}
.dark .paywall-card {
  background: rgb(15 23 42);
  color: rgb(241 245 249);
}
.paywall-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  border: none;
  background: rgb(241 245 249);
  color: rgb(71 85 105);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
}
.paywall-close:hover { background: rgb(226 232 240); }
.dark .paywall-close {
  background: rgb(30 41 59);
  color: rgb(148 163 184);
}
.paywall-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 0.5rem;
}
.paywall-sub {
  font-size: 0.95rem;
  color: rgb(71 85 105);
  margin: 0 0 1.5rem;
}
.dark .paywall-sub { color: rgb(148 163 184); }

.paywall-plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.paywall-plan {
  position: relative;
  border: 1px solid rgb(226 232 240);
  border-radius: 1rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  background: rgb(248 250 252);
}
.dark .paywall-plan {
  background: rgb(30 41 59);
  border-color: rgb(51 65 85);
}
.paywall-plan-name {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgb(79 70 229);
  margin-bottom: 0.25rem;
}
.dark .paywall-plan-name { color: rgb(165 180 252); }
.paywall-plan-price {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}
.paywall-plan-tag {
  font-size: 0.8rem;
  color: rgb(71 85 105);
  margin-bottom: 0.75rem;
}
.dark .paywall-plan-tag { color: rgb(148 163 184); }
.paywall-plan-perks {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  font-size: 0.85rem;
  flex: 1;
}
.paywall-plan-perks li {
  padding: 0.25rem 0 0.25rem 1.25rem;
  position: relative;
}
.paywall-plan-perks li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: rgb(22 163 74);
  font-weight: 700;
}
.paywall-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  background: rgb(79 70 229);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.paywall-cta:hover { background: rgb(67 56 202); }
.paywall-cta-disabled,
.paywall-cta-disabled:hover {
  background: rgb(148 163 184);
  cursor: not-allowed;
}
.paywall-badge {
  position: absolute;
  top: -0.6rem;
  right: 0.75rem;
  background: rgb(168 85 247);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  letter-spacing: 0.05em;
}

.paywall-license {
  border-top: 1px solid rgb(226 232 240);
  padding-top: 1rem;
}
.dark .paywall-license { border-color: rgb(51 65 85); }
.paywall-license summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgb(79 70 229);
  list-style: none;
}
.paywall-license summary::-webkit-details-marker { display: none; }
.paywall-license summary::before { content: '+ '; font-weight: 700; }
.paywall-license details[open] summary::before { content: '\2212 '; }
.dark .paywall-license summary { color: rgb(165 180 252); }
.paywall-license form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.paywall-license input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgb(203 213 225);
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, monospace;
  background: white;
  color: inherit;
}
.dark .paywall-license input {
  background: rgb(15 23 42);
  border-color: rgb(51 65 85);
}
.paywall-license button {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  background: rgb(79 70 229);
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
.paywall-license button:disabled { opacity: 0.6; cursor: wait; }
.paywall-error {
  color: rgb(190 18 60);
  font-size: 0.8rem;
  margin: 0.5rem 0 0;
}
.paywall-fine {
  font-size: 0.7rem;
  color: rgb(100 116 139);
  margin: 1rem 0 0;
  text-align: center;
}
.paywall-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: rgb(100 116 139);
  font-size: 0.9rem;
  border: 1px dashed rgb(203 213 225);
  border-radius: 0.75rem;
}
.dark .paywall-empty { border-color: rgb(51 65 85); }
.paywall-empty code {
  background: rgb(241 245 249);
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.85rem;
}
.dark .paywall-empty code { background: rgb(30 41 59); }

/* ===========================================================================
   Navbar auth widget
   =========================================================================== */
.nav-auth { display: flex; align-items: center; gap: 0.5rem; }
.nav-auth-login,
.nav-auth-signup {
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 0.5rem;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-auth-login {
  background: transparent;
  color: rgb(51 65 85);
  border-color: rgb(203 213 225);
}
.nav-auth-login:hover { background: rgb(241 245 249); }
.dark .nav-auth-login { color: rgb(203 213 225); border-color: rgb(51 65 85); }
.dark .nav-auth-login:hover { background: rgb(30 41 59); }
.nav-auth-signup {
  background: rgb(79 70 229);
  color: #fff;
}
.nav-auth-signup:hover { background: rgb(67 56 202); }
.nav-auth-user { display: flex; align-items: center; gap: 0.5rem; }
.nav-auth-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgb(99 102 241), rgb(147 51 234));
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}
.nav-auth-email {
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgb(51 65 85);
}
.dark .nav-auth-email { color: rgb(226 232 240); }
.nav-auth-logout {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgb(220 38 38);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: 0.4rem;
}
.nav-auth-logout:hover { background: rgb(254 226 226); }
.dark .nav-auth-logout { color: rgb(248 113 113); }
.dark .nav-auth-logout:hover { background: rgb(127 29 29 / 0.4); }
/* Mobile auth row */
.nav-auth-mobile { display: flex; }
.nav-auth-mobile .nav-auth-user,
.nav-auth-mobile :is(.nav-auth-login, .nav-auth-signup) { flex: 1; }
.nav-auth-mobile { gap: 0.5rem; }

/* ===========================================================================
   Auth modal
   =========================================================================== */
.authm.hidden { display: none; }
body.authm-open { overflow: hidden; }
.authm {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.authm-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(15 23 42 / 0.6);
  backdrop-filter: blur(2px);
}
.authm-card {
  position: relative;
  width: 100%;
  max-width: 26rem;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.35);
  padding: 1.75rem;
}
.dark .authm-card { background: rgb(15 23 42); }
.authm-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  font-size: 1.5rem;
  line-height: 1;
  color: rgb(100 116 139);
  background: none;
  border: none;
  cursor: pointer;
}
.authm-close:hover { color: rgb(51 65 85); }
.dark .authm-close:hover { color: rgb(226 232 240); }
.authm-tabs {
  display: inline-flex;
  background: rgb(241 245 249);
  border-radius: 0.6rem;
  padding: 0.2rem;
  margin-bottom: 1rem;
}
.dark .authm-tabs { background: rgb(30 41 59); }
.authm-tab {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgb(100 116 139);
  padding: 0.4rem 1rem;
  border-radius: 0.45rem;
}
.authm-tab.active {
  background: #fff;
  color: rgb(79 70 229);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.1);
}
.dark .authm-tab.active { background: rgb(15 23 42); color: rgb(165 180 252); }
.authm-title { font-size: 1.35rem; font-weight: 700; color: rgb(15 23 42); }
.dark .authm-title { color: #fff; }
.authm-sub { font-size: 0.9rem; color: rgb(100 116 139); margin: 0.25rem 0 1rem; }
.dark .authm-sub { color: rgb(148 163 184); }
.authm-google { display: flex; justify-content: center; min-height: 0; }
.authm-google:empty { display: none; }
.authm-or {
  display: flex;
  align-items: center;
  text-align: center;
  color: rgb(148 163 184);
  font-size: 0.75rem;
  margin: 1rem 0;
}
.authm-or:empty { display: none; }
.authm-or::before,
.authm-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgb(226 232 240);
}
.dark .authm-or::before, .dark .authm-or::after { background: rgb(51 65 85); }
.authm-or span { padding: 0 0.6rem; }
/* Hide the divider entirely when Google isn't configured. */
.authm-google:empty + .authm-or { display: none; }
.authm-field { display: block; margin-bottom: 0.8rem; }
.authm-field.hidden { display: none; }
.authm-field span {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgb(71 85 105);
  margin-bottom: 0.3rem;
}
.dark .authm-field span { color: rgb(148 163 184); }
.authm-field input {
  width: 100%;
  border: 1px solid rgb(203 213 225);
  border-radius: 0.55rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  background: #fff;
  color: rgb(15 23 42);
}
.authm-field input:focus {
  outline: none;
  border-color: rgb(99 102 241);
  box-shadow: 0 0 0 3px rgb(99 102 241 / 0.2);
}
.dark .authm-field input {
  background: rgb(30 41 59);
  border-color: rgb(51 65 85);
  color: #fff;
}
.authm-error {
  font-size: 0.82rem;
  color: rgb(220 38 38);
  margin: 0 0 0.6rem;
}
.authm-error.hidden, .authm-success.hidden { display: none; }
.authm-success {
  font-size: 0.85rem;
  color: rgb(21 128 61);
  background: rgb(240 253 244);
  border: 1px solid rgb(187 247 208);
  border-radius: 0.55rem;
  padding: 0.6rem 0.75rem;
  margin: 0 0 0.6rem;
}
.dark .authm-success {
  color: rgb(134 239 172);
  background: rgb(20 83 45 / 0.4);
  border-color: rgb(22 101 52);
}
.authm-success a { color: rgb(79 70 229); font-weight: 600; text-decoration: underline; }
.dark .authm-success a { color: rgb(165 180 252); }
.authm-submit {
  width: 100%;
  background: rgb(79 70 229);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: 0.6rem;
  padding: 0.7rem;
  cursor: pointer;
  transition: background 0.15s;
}
.authm-submit:hover { background: rgb(67 56 202); }
.authm-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.authm-foot { text-align: center; margin-top: 0.85rem; }
.authm-link {
  background: none;
  border: none;
  color: rgb(79 70 229);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.authm-link.hidden { display: none; }
.dark .authm-link { color: rgb(165 180 252); }
