/* ══════════════════════════════════════════════════════════════════
   IDISI — FLOATING NAVIGATION DOCK & TOASTS (VIDEOMAKER AESTHETIC)
   With Dynamic Hover Color Manifestation
   ══════════════════════════════════════════════════════════════════ */

/* ── Modern Floating Bottom Dock ───────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translate3d(-50%, 0, 0);
  will-change: transform;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  background: var(--dock-bg);
  border: 1px solid var(--border-light);
  box-shadow: var(--dock-shadow);
  backdrop-filter: var(--glass-sheet);
  -webkit-backdrop-filter: var(--glass-sheet);
  border-radius: var(--r-full);
  z-index: 50;
  max-width: calc(100% - 32px);
  overflow: hidden;
  transition: transform 0.35s var(--ease), opacity 0.35s var(--ease), background 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.bottom-nav.dock-hidden {
  transform: translate3d(-50%, calc(100% + 40px), 0);
  opacity: 0;
  pointer-events: none;
}

.nav-tab {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 16px;
  border-radius: var(--r-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  z-index: 1;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
  font-family: var(--font);
}

.nav-tab:focus,
.nav-tab:focus-visible {
  outline: none !important;
}

.nav-tab svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  stroke-width: 2.1;
  flex-shrink: 0;
  display: block;
  margin: 0 auto;
  transition: transform 0.22s var(--spring), stroke 0.22s var(--ease);
}

.nav-tab span {
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nav-tab:hover {
  z-index: 3;
  color: var(--text-main);
  transform: translateY(-1px);
}

.nav-tab:hover svg {
  stroke: var(--text-main);
  transform: scale(1.08);
}

.nav-tab:active {
  transform: scale(0.94);
}

.nav-tab.active {
  background: var(--glass-pill);
  color: var(--text-main);
  box-shadow: none;
}

html[data-theme="light"] .nav-tab.active {
  background: rgba(255, 255, 255, 0.88);
  color: #0f172a;
  box-shadow: none;
}

html[data-theme="dark"] .nav-tab.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: none;
}

.nav-tab.active svg {
  stroke: var(--text-main);
  transform: scale(1.05);
}

/* Badge on nav tab: calm in idle, glows red on hover */
.nav-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: var(--fs-meta);
  font-weight: 700;
  padding: 1.5px 4px;
  border-radius: var(--r-full);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: all 0.22s var(--ease);
}

.nav-tab:hover .nav-badge {
  background: var(--danger);
  box-shadow: var(--danger-glow);
}

/* Desktop Keyboard Hotkey Hint (1, 2, 3, 4) */
.desktop-hotkey {
  display: none;
  position: absolute;
  top: 4px;
  left: 8px;
  font-size: var(--fs-meta);
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-muted);
  border-radius: var(--r-xs);
  padding: 1px 4px;
  line-height: 1.1;
  pointer-events: none;
  transition: all 0.2s var(--ease);
}

@media (min-width: 768px) {
  .bottom-nav {
    bottom: 24px;
    padding: 4px;
    gap: 4px;
  }

  .nav-tab {
    padding: 8px 16px;
    gap: 3px;
  }

  .nav-tab svg {
    width: 21px;
    height: 21px;
    min-width: 21px;
    min-height: 21px;
    max-width: 21px;
    max-height: 21px;
    flex-shrink: 0;
  }

  .nav-tab span {
    font-size: var(--fs-meta);
  }

  .desktop-hotkey {
    display: none !important;
  }
}

/* ── Toast Notifications (Capsule Style) ───────────────────────── */
.toast-container {
  position: fixed;
  top: calc(72px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  pointer-events: none;
  width: auto;
  max-width: min(92vw, 460px);
  display: flex;
  justify-content: center;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: var(--r-full);
  background: var(--toast-bg);
  border: 1px solid var(--toast-border);
  box-shadow: var(--toast-shadow);
  backdrop-filter: var(--glass-sheet);
  -webkit-backdrop-filter: var(--glass-sheet);
  color: var(--toast-color);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: -0.01em;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px) scale(0.96);
  transition: opacity 0.28s var(--ease), transform 0.28s var(--spring), visibility 0.28s var(--ease);
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.toast.error {
  background: var(--toast-error-bg);
  color: var(--toast-error-color);
  border-color: var(--toast-error-border);
  box-shadow: var(--toast-error-shadow);
}

.toast-icon {
  width: 18px;
  height: 18px;
  stroke: var(--toast-icon);
  stroke-width: 2.4;
  flex-shrink: 0;
  transition: stroke 0.2s var(--ease);
}

.toast.error .toast-icon {
  stroke: var(--toast-error-icon);
}

/* ── Floating Batch Print Dock ─────────────────────────────────── */
.floating-batch-dock[hidden] {
  display: none !important;
}

.floating-batch-dock {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 580px;
  background: rgba(18, 18, 18, 0.92);
  border: 1px solid var(--border-light);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.75), 0 0 24px rgba(255, 255, 255, 0.08);
  backdrop-filter: var(--glass-sheet);
  -webkit-backdrop-filter: var(--glass-sheet);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 48;
  animation: slideUpBatch 0.2s var(--ease);
}

@keyframes slideUpBatch {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.batch-dock-info {
  display: flex;
  flex-direction: column;
}

.batch-dock-count {
  font-size: var(--fs-body);
  font-weight: 700;
  color: var(--text-main);
}

.batch-dock-hint {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  font-weight: 500;
}

.batch-dock-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-dock-cancel {
  padding: 8px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--glass-pill);
  color: var(--text-muted);
  font-size: var(--fs-label);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.btn-dock-cancel:hover {
  background: var(--glass-bg-hover);
  color: var(--text-main);
  border-color: var(--border-light);
}

.btn-dock-print {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-light);
  background: var(--accent);
  color: var(--accent-invert);
  font-size: var(--fs-label);
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.22s var(--ease);
}

.btn-dock-print:hover {
  background: var(--accent-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-dock-print:active {
  transform: var(--press-scale);
}

/* ── Loading Screen ────────────────────────────────────────────── */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--body-bg);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.35s var(--ease), visibility 0.35s var(--ease);
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-logo {
  font-size: var(--fs-hero);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.loading-logo span {
  font-size: var(--fs-meta);
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-top: -2px;
}

.loading-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: var(--r-full);
  animation: spin 0.8s linear infinite;
}

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

/* ── Quick Scroll To Top Button (VideoMaker Frosted Aesthetic) ──── */
.scroll-top-btn {
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  right: 18px;
  width: 50px;
  height: 50px;
  box-sizing: border-box;
  border-radius: var(--r-full);
  background: var(--dock-bg);
  border: 1px solid var(--border-light);
  box-shadow: var(--dock-shadow);
  backdrop-filter: var(--glass-sheet);
  -webkit-backdrop-filter: var(--glass-sheet);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 55;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(14px) scale(0.85);
  transition: opacity 0.25s var(--ease),
              transform 0.25s var(--spring),
              visibility 0.25s var(--ease),
              color 0.2s var(--ease),
              border-color 0.2s var(--ease),
              background 0.2s var(--ease),
              box-shadow 0.2s var(--ease);
}

.scroll-top-btn svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  stroke-width: 2.4;
  flex-shrink: 0;
  transition: transform 0.22s var(--spring), stroke 0.22s var(--ease);
}

.scroll-top-btn.visible {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1);
}

.scroll-top-btn:focus {
  outline: none;
}

.scroll-top-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Hover: Dynamic Color Manifestation */
.scroll-top-btn:hover {
  color: var(--text-main);
  background: var(--glass-bg-hover);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-lg), var(--accent-glow);
  transform: translateY(-2px) scale(1.05);
}

.scroll-top-btn:hover svg {
  stroke: var(--text-main);
  transform: translateY(-2px);
}

.scroll-top-btn:active {
  transform: scale(0.94);
}

@media (min-width: 768px) {
  .scroll-top-btn {
    bottom: 24px;
    left: calc(50% + 128px);
    right: auto;
    width: 54px;
    height: 54px;
  }

  .scroll-top-btn svg {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
  }
}

/* ── Mobile Pull to Refresh Indicator ──────────────────────────── */
.ptr-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 40;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
  opacity: 0;
}

.ptr-indicator.pulling,
.ptr-indicator.refreshing {
  opacity: 1;
}

.ptr-icon-box {
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  position: relative;
}

.ptr-arrow {
  transition: transform 0.22s var(--ease);
  stroke: var(--text-main);
}

.ptr-indicator.ready .ptr-arrow {
  transform: rotate(180deg);
}

.ptr-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ptrSpin 0.75s linear infinite;
}

.ptr-indicator.refreshing .ptr-arrow {
  display: none;
}

.ptr-indicator.refreshing .ptr-spinner {
  display: block;
}

.ptr-text {
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  font-family: var(--font);
}

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