/* ===========================
   AllTab Tour — Shared Styles
   =========================== */

/* --- Page Layout (matches index.html dark theme) --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --tour-bg: #0f1014;
  --tour-bg-gradient: radial-gradient(circle at 50% 0%, #1e2028 0%, #0f1014 80%);
  --tour-accent: #4dabf7;
  --tour-accent-glow: rgba(77, 171, 247, 0.4);
  --tour-text: #ffffff;
  --tour-text-secondary: #a0a0a5;
  --tour-card-bg: rgba(255, 255, 255, 0.03);
  --tour-card-border: rgba(255, 255, 255, 0.08);
}

body {
  font-family: 'Roboto', 'Inter', -apple-system, sans-serif;
  background: var(--tour-bg);
  background-image: var(--tour-bg-gradient);
  background-attachment: fixed;
  color: var(--tour-text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient glow */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 60%;
  background: radial-gradient(circle, rgba(49, 130, 206, 0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* --- Tour Page Container --- */
.tour-page {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* --- Tour Header (page title, not popup header) --- */
.tour-header {
  text-align: center;
  margin-bottom: 48px;
  animation: tourFadeIn 0.8s ease-out;
  position: relative;
}

.tour-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 30%, #a5d8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}

.tour-header p {
  font-size: 1.1rem;
  color: var(--tour-text-secondary);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}

.tour-back-btn {
  position: absolute;
  left: 20px;
  top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--tour-text-secondary);
  text-decoration: none;
  background: var(--tour-card-bg);
  border: 1px solid var(--tour-card-border);
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.tour-back-btn:hover {
  color: var(--tour-accent);
  border-color: var(--tour-accent);
  transform: translateX(-3px);
  box-shadow: 0 0 12px rgba(77, 171, 247, 0.2);
}

@keyframes tourFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Popup Replica Frame --- */
.popup-frame {
  position: relative;
  width: 780px;
  margin: 0 auto 40px;
  border-radius: 16px;
  overflow: visible;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* Browser chrome bar */
.popup-frame-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #2c2c2e;
  border-radius: 16px 16px 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.popup-frame-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #3a3a3c;
}

.popup-frame-dot:nth-child(1) {
  background: #ff5f57;
}

.popup-frame-dot:nth-child(2) {
  background: #febc2e;
}

.popup-frame-dot:nth-child(3) {
  background: #28c840;
}

.popup-frame-title {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  color: #8e8e93;
  font-weight: 500;
}

/* --- Popup Replica (internal) --- */
.popup-replica {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --bg: #1c1c1e;
  --surface: #2c2c2e;
  --text: #F1F5F9;
  --text-secondary: #94A3B8;
  --border: #38383a;
  --danger: #EF4444;

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  width: 100%;
  height: 580px;
  overflow: hidden;
  position: relative;
  border-radius: 16px;
}

.popup-container {
  width: 100%;
  height: 100%;
  padding: 1.5rem 1.5rem 0.5rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* View system */
.view {
  display: none;
}

.view.active {
  display: block;
}

#main-view.active {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100%;
}

/* --- Popup header --- */
.popup-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 0.25rem;
  padding: 0 2.5rem;
}

.popup-header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  background: none;
  -webkit-text-fill-color: var(--text);
}

/* Header buttons */
.header-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: default;
  padding: 0.35rem;
  border-radius: 50%;
  transition: all 0.2s ease;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.left-btn {
  left: 0;
}

.right-btn {
  right: 0;
}

.user-btn {
  left: 36px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.5rem;
  border-radius: 1rem;
}

.user-name-badge {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text);
}

/* Group selector */
.group-selector {
  position: absolute;
  left: 158px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
}

.group-selector-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.3rem 0.6rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 1rem;
  color: var(--text-secondary);
  font-size: 0.7rem;
  cursor: default;
}

/* Reload wrapper */
.reload-wrapper {
  position: absolute;
  right: 72px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
}

.reload-wrapper .reload-btn {
  position: static;
  transform: none;
}

/* Close no save wrapper */
.close-no-save-wrapper {
  position: absolute;
  right: 108px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
}

.close-no-save-wrapper .close-no-save-btn {
  position: static;
  transform: none;
}

/* Volume wrapper */
.volume-wrapper {
  position: absolute;
  right: 144px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
}

.volume-wrapper .volume-btn {
  position: static;
  transform: none;
  background: transparent;
  border: none;
  cursor: default;
  padding: 0.35rem;
  border-radius: 50%;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

/* Undo wrapper */
.undo-wrapper {
  position: absolute;
  right: 180px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
}

.undo-wrapper .undo-btn {
  position: static;
  transform: none;
  background: transparent;
  border: none;
  cursor: default;
  padding: 0.35rem;
  border-radius: 50%;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

/* Search tab */
.search-tab-btn {
  right: 252px;
  position: absolute;
}

/* Screen filter wrapper */
.screen-filter-wrapper {
  position: absolute;
  right: 216px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
}

.screen-filter-wrapper .header-btn {
  position: static;
  transform: none;
}

/* More actions */
.more-actions-wrapper {
  position: absolute;
  right: 288px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
}

.more-actions-btn {
  background: transparent;
  border: none;
  cursor: default;
  padding: 0.35rem;
  border-radius: 50%;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

/* Sidebar button */
#open-sidebar {
  right: 36px;
  position: absolute;
}

/* --- Stats --- */
#stats {
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* --- Buttons --- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: none;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: default;
  transition: all 0.2s ease;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 4px 6px -1px rgb(37 99 235 / 0.2);
}

.btn-secondary {
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

/* --- Quick Actions --- */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: auto;
  margin-bottom: auto;
  padding: 0 0.5rem;
  width: 100%;
  align-items: stretch;
}

.action-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.action-list {
  background-color: #2c2c2e;
  border: 1px solid #48484a;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  flex: 1;
}

.action-item {
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  color: var(--text);
  cursor: default;
  white-space: normal;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.action-item:last-child {
  border-bottom: none;
}

.action-divider {
  height: 1px;
  background-color: var(--border);
}

/* --- RAM Monitor --- */
.ram-monitor {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
}

.ram-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex: 1;
}

.ram-label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ram-label svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.ram-bar-container {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.ram-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
  width: 0%;
}

.ram-bar.system-bar {
  background: linear-gradient(90deg, #10b981, #34d399);
  width: 62%;
}

.ram-bar.chrome-bar {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  width: 38%;
}

.ram-value {
  min-width: 50px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}


/* ============================
   Tour Overlay System
   ============================ */

/* --- Hotspot (badge at corner of element) --- */
.tour-hotspot {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(77, 171, 247, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  cursor: pointer;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.52rem;
  font-weight: 700;
  color: #fff;
  animation: hotspotPulse 2.5s ease-in-out infinite;
  transition: width 0.25s ease, height 0.25s ease, font-size 0.25s ease,
    background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease,
    opacity 0.25s ease;
  box-shadow: 0 2px 8px rgba(77, 171, 247, 0.3);
}

.tour-hotspot:hover {
  transform: scale(1.25);
  background: rgba(77, 171, 247, 1);
  box-shadow: 0 0 16px rgba(77, 171, 247, 0.5);
}

.tour-hotspot.active {
  background: #ff6b6b;
  border-color: #fff;
  animation: hotspotActive 1.5s ease-in-out infinite;
  transform: scale(1.25);
  box-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
  z-index: 600;
  width: 20px;
  height: 20px;
  font-size: 0.55rem;
}

/* --- Hide-numbers mode: all non-active hotspots become tiny dots --- */
.popup-replica.hide-numbers .tour-hotspot {
  width: 8px;
  height: 8px;
  font-size: 0;
  border-width: 1px;
  opacity: 0.5;
  animation: none;
}

.popup-replica.hide-numbers .tour-hotspot:hover {
  opacity: 0.8;
  transform: scale(1.3);
}

.popup-replica.hide-numbers .tour-hotspot.active {
  width: 20px;
  height: 20px;
  font-size: 0.55rem;
  opacity: 1;
  animation: hotspotActive 1.5s ease-in-out infinite;
}

@keyframes hotspotPulse {

  0%,
  100% {
    box-shadow: 0 2px 8px rgba(77, 171, 247, 0.3);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(77, 171, 247, 0);
  }
}

@keyframes hotspotActive {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.5);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(255, 107, 107, 0);
  }
}

/* --- Highlight ring (around active element) --- */
.tour-highlight {
  position: absolute;
  border: 2px solid var(--tour-accent);
  border-radius: 8px;
  pointer-events: none;
  z-index: 490;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 0 16px rgba(77, 171, 247, 0.3), inset 0 0 16px rgba(77, 171, 247, 0.05);
  opacity: 0;
}

.tour-highlight.visible {
  opacity: 1;
}

/* --- Explanation Card --- */
.tour-card {
  position: absolute;
  z-index: 700;
  background: rgba(30, 32, 40, 0.97);
  border: 1px solid rgba(77, 171, 247, 0.3);
  border-radius: 14px;
  padding: 20px 22px;
  max-width: 340px;
  min-width: 260px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(77, 171, 247, 0.1);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.tour-card.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.tour-card-step {
  display: inline-block;
  background: var(--tour-accent);
  color: #0f1014;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tour-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
}

.tour-card p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--tour-text-secondary);
  margin-bottom: 0;
}

.tour-card .tour-tip {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(77, 171, 247, 0.08);
  border: 1px solid rgba(77, 171, 247, 0.15);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--tour-accent);
  line-height: 1.5;
}

.tour-card .tour-tip::before {
  content: '💡 ';
}

/* Card arrow (pointing to hotspot) */
.tour-card::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: rgba(30, 32, 40, 0.97);
  border: 1px solid rgba(77, 171, 247, 0.3);
  transform: rotate(45deg);
}

.tour-card.arrow-top::before {
  top: -7px;
  left: var(--arrow-left, 24px);
  border-right: none;
  border-bottom: none;
}

.tour-card.arrow-bottom::before {
  bottom: -7px;
  left: var(--arrow-left, 24px);
  border-left: none;
  border-top: none;
}

.tour-card.arrow-left::before {
  left: -7px;
  top: 20px;
  border-right: none;
  border-top: none;
}

.tour-card.arrow-right::before {
  right: -7px;
  top: 20px;
  border-left: none;
  border-bottom: none;
}

/* --- Navigation Bar (bottom fixed) --- */
.tour-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(15, 16, 20, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.tour-nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--tour-text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tour-nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--tour-text);
  border-color: rgba(255, 255, 255, 0.2);
}

.tour-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.tour-nav-btn.primary {
  background: var(--tour-accent);
  color: #0f1014;
  border-color: var(--tour-accent);
  font-weight: 600;
}

.tour-nav-btn.primary:hover {
  background: #6bc0ff;
}

/* Toggle numbers button */
.tour-nav-btn.toggle-btn {
  padding: 10px 14px;
  font-size: 0;
  gap: 0;
}

.tour-nav-btn.toggle-btn svg {
  width: 18px;
  height: 18px;
}

.tour-nav-btn.toggled {
  background: rgba(255, 107, 107, 0.15);
  border-color: rgba(255, 107, 107, 0.3);
  color: #ff6b6b;
}

/* Progress */
.tour-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tour-progress-text {
  font-size: 0.8rem;
  color: var(--tour-text-secondary);
  font-weight: 500;
  min-width: 50px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tour-progress-bar {
  width: 160px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.tour-progress-fill {
  height: 100%;
  background: var(--tour-accent);
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- Responsive --- */
@media (max-width: 840px) {
  .popup-frame {
    width: 95vw;
    max-width: 780px;
  }

  .tour-header h1 {
    font-size: 1.8rem;
  }
}

@media (max-width: 500px) {
  .tour-nav {
    padding: 10px 12px;
    gap: 8px;
  }

  .tour-nav-btn {
    padding: 8px 12px;
    font-size: 0.78rem;
  }

  .tour-progress-bar {
    width: 80px;
  }
}