/* Additional component styles */

/* Search input */
.search-input-wrap {
  position: relative;
}

.search-input-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-input-wrap .form-input {
  padding-left: 32px;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
  gap: var(--space-4);
  text-align: center;
}

.empty-state-icon {
  color: var(--color-border);
}

.empty-state-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* ─── Settings / theme toggle ───────────────────────────────────
   Standard pill toggle used throughout the settings panel.
   Fixed size: 36×20px. Never flex-shrinks. Thumb is contained.
   Usage: <div class="theme-toggle [on]"><div class="theme-toggle-thumb"></div></div>
──────────────────────────────────────────────────────────────── */
.theme-toggle {
  display: inline-block;
  width: 36px;
  height: 20px;
  min-width: 36px;     /* never shrink */
  background: var(--color-border);
  border-radius: var(--radius-full);
  position: relative;
  overflow: hidden;    /* clip thumb to pill shape */
  transition: background var(--transition);
  cursor: pointer;
  flex-shrink: 0;
  vertical-align: middle;
}

.theme-toggle.on {
  background: var(--color-accent);
}

.theme-toggle-thumb {
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: var(--radius-full);
  position: absolute;
  top: 3px;
  left: 3px;
  transition: left var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.theme-toggle.on .theme-toggle-thumb {
  left: 19px; /* 36 - 14 - 3 = 19 */
}

/* Owner select */
.owner-select-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.owner-pct-input {
  width: 70px;
  text-align: right;
}

/* Section heading */
.section-heading {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

/* ── Crypto progress overlay ───────────────────────────────────── */
.crypto-progress-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}

.crypto-progress-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-10);
  width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
}

.crypto-progress-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: var(--radius-full);
  animation: crypto-spin 0.8s linear infinite;
}

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

.crypto-progress-message {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
}

.crypto-progress-bar-wrap {
  width: 100%;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.crypto-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  animation: crypto-bar 3s ease-in-out forwards;
}

/* Animate bar from 0 → ~90% over ~3 s (key derivation duration).
   The remaining 10% fills when the operation actually completes (overlay removed). */
@keyframes crypto-bar {
  0%   { width: 0%; }
  60%  { width: 70%; }
  100% { width: 90%; }
}

.crypto-progress-hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* ── File version badge ─────────────────────────────────────────── */
.file-version-badge {
  display: inline-block;
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.file-version-badge--legacy {
  background: color-mix(in srgb, var(--color-warning) 12%, transparent);
  color: var(--color-warning);
  border: 1px solid color-mix(in srgb, var(--color-warning) 30%, transparent);
}

/* ── Settings version footer (inside nav col) ───────────────────── */
.settings-version-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-4);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.settings-version-badge {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.settings-version-notes-link {
  font-size: var(--font-size-xs);
  color: var(--color-accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity var(--transition);
}

.settings-version-notes-link:hover {
  opacity: 0.75;
}

/* ── Version notes modal content ────────────────────────────────── */
.version-notes-body {
  min-height: 260px;
  display: flex;
  flex-direction: column;
}

.version-notes-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
  flex-shrink: 0;
}

.version-notes-tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  margin-bottom: -1px;
}

.version-notes-tab:hover {
  color: var(--color-text);
}

.version-notes-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  font-weight: 500;
}

.version-notes-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-1);
}

.version-notes-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.version-notes-heading {
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--color-text);
}

.version-notes-list {
  list-style: disc;
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.version-notes-list li {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  line-height: 1.5;
}

/* Past versions: narrow clickable cards */
.version-notes-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color var(--transition);
  margin-bottom: var(--space-2);
}

.version-notes-card:hover {
  border-color: var(--color-accent);
}

.version-notes-card-ver {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  min-width: 48px;
}

.version-notes-card-count {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  flex: 1;
}

.version-notes-card-arrow {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* Back button inside version detail */
.version-notes-back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  margin-bottom: var(--space-4);
}

.version-notes-back-btn:hover {
  opacity: 0.75;
}

/* ── Documentation viewer ─────────────────────────────────────── */

/* Groups the download button + password hint in the header */
.docs-download-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Discrete password hint below the download button */
.docs-demo-password {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  opacity: 0.7;
  user-select: text;
}

.docs-download-btn {
  margin-right: -10%;
}

.docs-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: 100%;
}

.docs-nav {
  width: 220px;
  min-width: 220px;
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  padding: var(--space-3) 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.docs-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  margin: 0 var(--space-2);
  width: calc(100% - var(--space-4));
}

.docs-nav-item:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.docs-nav-item.active {
  background: var(--color-surface-2);
  color: var(--color-accent);
  font-weight: 500;
}

.docs-article {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-8);
}

/* Markdown body styles for docs */
.docs-content {
  max-width: 640px;
  line-height: 1.7;
}

.docs-content h1 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

.docs-content h2 {
  font-size: var(--font-size-md);
  font-weight: 700;
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  color: var(--color-text);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.docs-content h3 {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.docs-content p {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.docs-content ul,
.docs-content ol {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  padding-left: var(--space-5);
  margin-bottom: var(--space-3);
}

.docs-content li {
  margin-bottom: var(--space-1);
  line-height: 1.6;
}

.docs-content code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
}

.docs-content pre {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow-x: auto;
  margin-bottom: var(--space-4);
}

.docs-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
}

.docs-content blockquote {
  border-left: 3px solid var(--color-accent);
  padding: var(--space-2) var(--space-4);
  background: color-mix(in srgb, var(--color-accent) 6%, transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-4);
}

.docs-content th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 2px solid var(--color-border);
  font-weight: 600;
  color: var(--color-text);
}

.docs-content td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

.docs-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-6) 0;
}

.docs-content a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.docs-content strong {
  font-weight: 600;
}

.docs-content em {
  font-style: italic;
}

.docs-loading,
.docs-error {
  padding: var(--space-8);
  text-align: center;
}

/* ─── File viewer — ZIP tree & TIFF ─────────────────────────── */
.fv-loading {
  padding: var(--space-4) 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-align: center;
}

.fv-zip-tree {
  contain: content;
}

.fv-zip-item {
  transition: background var(--transition), color var(--transition);
}

.fv-zip-item--active {
  background: var(--color-accent) !important;
  color: #fff !important;
}

.fv-zip-preview pre {
  tab-size: 2;
}

/* ── Easter egg: Maria ──────────────────────────────────────────── */
@keyframes maria-wobble {
  0%, 100%  { transform: rotate(-3deg); }
  50%       { transform: rotate(3deg); }
}

.easter-egg-maria {
  position: fixed;
  bottom: 18px;
  right: 18px;
  width: 35px;
  height: 35px;
  border-radius: var(--radius-full);
  object-fit: cover;
  cursor: pointer;
  user-select: none;
  /* Very gentle wobble — barely noticeable */
  animation: maria-wobble 2.6s ease-in-out infinite;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: var(--shadow-md);
  z-index: 50;
}

.easter-egg-maria:hover {
  animation-play-state: paused;
  transform: scale(1.12) rotate(0deg);
  box-shadow: var(--shadow-lg);
}

/* On mobile the bottom bar is 56px tall and the FAB sits above it.
   Push Maria above the FAB stack so they never overlap. */
@media (max-width: 768px) {
  .easter-egg-maria {
    bottom: calc(56px + 14px + 44px + 14px); /* nav + gap + FAB + gap */
    right: 14px;
    width: 38px;
    height: 38px;
    background: var(--color-bg);
    padding: 2px;
  }
}
