/* ===== DEMO TOUR OVERLAY =====
   We do NOT modify the real Solara dashboard's layout — html/body
   stay at `height:100%; overflow:hidden` as the extension expects.
   Instead the tour is driven by MOUSE WHEEL + KEYBOARD, which keeps
   every floating element (sticky notes, pomodoro overlay) where the
   real extension put it. */

/* Ayah widget — simulated hover during tour.
   The live extension keeps its hover-reveal behaviour (opacity:0 +
   pointer-events:none until :hover / :focus-within). That's the
   resting UX the user wants. But the TOUR has no real mouse on the
   widget, so without help the spotlighted buttons stay invisible.
   Fix: tour.js sets `data-tour-hover="1"` on #ayah-widget whenever
   the current step targets any ayah sub-element, and we mirror the
   widget's own :hover rules under that attribute selector. Specific-
   ity (id + attribute + class = 0,1,2,1) beats the plain resting
   rules so no !important is needed. Transitions shortened to 100ms
   so the state settles before positionBubble measures the rect at
   +120ms (the default 200ms would leave the rect mid-animation).
   Removing the attribute triggers the reverse transition back to the
   resting state at the widget's default 200ms — feels like the user
   "unhovered" naturally. */
#ayah-widget[data-tour-hover="1"] .ayah-controls {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: opacity 100ms ease, transform 100ms ease;
}
#ayah-widget[data-tour-hover="1"] .ayah-select {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  transition: background 100ms ease, border-color 100ms ease;
}
#ayah-widget[data-tour-hover="1"] .ayah-nav-btn {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  transition: opacity 100ms ease, transform 100ms ease,
              background 100ms ease, border-color 100ms ease;
}

/* Spotlight — dimmer over the whole page, punched open around the
   current step's target using a huge box-shadow trick so we don't
   need SVG masks. */
.tour-dim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  z-index: 9000;
  transition: background 0.4s ease;
}
.tour-spotlight {
  position: fixed;
  top: 0; left: 0;
  width: 80px; height: 80px;
  border-radius: 14px;
  /* NO dim overlay — dashboard stays fully legible. The spotlight
     is signalled purely by a bright amber ring + soft outer glow.
     Previously we used a 9999px shadow to darken everything outside
     the box; that made the whole screen nearly unreadable.  */
  box-shadow:
    0 0 0 3px rgba(249, 115, 22, 0.85),
    0 0 28px 8px rgba(249, 115, 22, 0.45),
    0 0 0 9999px rgba(0, 0, 0, 0.12);  /* very faint — just a hint */
  pointer-events: none;
  z-index: 9001;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
}
.tour-spotlight.is-visible { opacity: 1; }

/* Bubble / tooltip */
.tour-bubble {
  position: fixed;
  z-index: 9002;
  background: rgba(20, 25, 40, 0.95);
  color: #fff;
  padding: 16px 20px;
  border-radius: 14px;
  max-width: 340px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(249, 115, 22, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s ease, left 0.5s cubic-bezier(0.4, 0, 0.2, 1), top 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  /* Bubble must not steal clicks from widgets it sits on top of —
     the user has to be able to reach every button on the dashboard
     while the tour is running. */
  pointer-events: none;
}
.tour-bubble.is-visible { opacity: 1; transform: translateY(0); }
.tour-bubble-step {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: #f97316;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
}
.tour-bubble-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px;
  color: #fff;
}
.tour-bubble-text {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.82);
  margin: 0 0 12px;
}
.tour-bubble-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  margin: 8px 0 0;
  font-style: italic;
}
/* Arrow points at the target. `--arrow-offset` is a CSS variable
   set by positionBubble() so the tip tracks the target's centre
   even after the bubble itself is clamped to the viewport. */
.tour-bubble-arrow {
  position: absolute;
  width: 0; height: 0;
  border-style: solid;
}
.tour-bubble[data-side="top"]    .tour-bubble-arrow { bottom: -9px; left: var(--arrow-offset, 32px); transform: translateX(-10px); border-width: 10px 10px 0 10px; border-color: rgba(20,25,40,0.95) transparent transparent transparent; }
.tour-bubble[data-side="bottom"] .tour-bubble-arrow { top: -9px;    left: var(--arrow-offset, 32px); transform: translateX(-10px); border-width: 0 10px 10px 10px; border-color: transparent transparent rgba(20,25,40,0.95) transparent; }
.tour-bubble[data-side="left"]   .tour-bubble-arrow { right: -9px;  top: var(--arrow-offset, 24px);  transform: translateY(-10px); border-width: 10px 0 10px 10px; border-color: transparent transparent transparent rgba(20,25,40,0.95); }
.tour-bubble[data-side="right"]  .tour-bubble-arrow { left: -9px;   top: var(--arrow-offset, 24px);  transform: translateY(-10px); border-width: 10px 10px 10px 0; border-color: transparent rgba(20,25,40,0.95) transparent transparent; }

/* ===== Welcome / intro overlay (shown on first load) ===== */
.tour-welcome {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
  padding: 24px;
}
.tour-welcome.is-hidden { opacity: 0; pointer-events: none; }
.tour-welcome-box {
  background: linear-gradient(135deg, rgba(30,30,50,0.96), rgba(20,20,40,0.96));
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 20px;
  padding: 36px 40px;
  max-width: 520px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.tour-welcome-logo {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #f97316, #fbbf24);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0 0 8px;
}
.tour-welcome-tag {
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 20px;
}
.tour-welcome-text {
  color: rgba(255, 255, 255, 0.82);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 28px;
}
.tour-welcome-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: #f97316;
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.tour-welcome-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(249, 115, 22, 0.45);
}
.tour-welcome-skip {
  display: block;
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.5);
  background: none;
  border: none;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}
.tour-welcome-skip:hover { color: rgba(255, 255, 255, 0.85); }

/* ===== Progress bar ===== */
.tour-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, #f97316, #fbbf24);
  width: 0%;
  transition: width 0.25s ease;
  z-index: 10001;
  pointer-events: none;
}

/* Bottom control bar — rich nav: prev, step list menu, current
   title + counter, next, skip-to-end, close. Clicking the title
   opens a full step list so the user can jump anywhere. */
.tour-nav {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(15, 20, 35, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 9003;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(249,115,22,0.15);
  transition: opacity 0.3s ease, transform 0.3s ease;
  max-width: calc(100vw - 32px);
}
.tour-nav.is-hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(12px); }
.tour-nav-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.tour-nav-btn:hover { background: rgba(249, 115, 22, 0.25); border-color: #f97316; }
.tour-nav-btn:active { transform: scale(0.93); }
.tour-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.tour-nav-btn.primary {
  background: linear-gradient(135deg, #f97316, #a855f7);
  border-color: transparent;
}
.tour-nav-btn.primary:hover { filter: brightness(1.1); }

/* Title + counter pill in the middle — clickable, opens step list */
.tour-nav-title {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 180px;
  max-width: 260px;
  padding: 4px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background 0.15s;
}
.tour-nav-title:hover { background: rgba(255, 255, 255, 0.1); }
.tour-nav-step-lbl {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--accent, #f97316);
  text-transform: uppercase;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tour-nav-step-title {
  font-size: 13px;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* Full step list popover above the nav bar */
.tour-steplist {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: 9004;
  width: min(360px, 92vw);
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px;
  background: rgba(15, 20, 35, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.tour-steplist.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.tour-steplist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  color: rgba(255, 255, 255, 0.85);
}
.tour-steplist-item:hover { background: rgba(255, 255, 255, 0.06); }
.tour-steplist-item.is-active {
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.18), transparent);
  color: #fff;
}
.tour-steplist-num {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.tour-steplist-item.is-active .tour-steplist-num {
  background: var(--accent, #f97316);
  color: #fff;
}
.tour-steplist-txt { font-size: 13px; flex: 1; }
.tour-steplist-done .tour-steplist-num::after { content: '✓'; }
.tour-steplist-done .tour-steplist-num {
  background: rgba(16, 185, 129, 0.25);
  color: #10b981;
}
.tour-steplist-done .tour-steplist-num::after { content: ''; }

/* End CTA — floats in the centre as a card, does NOT block the
   dashboard. User can close it, keep exploring, or jump anywhere
   from the action buttons. */
.tour-end {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  z-index: 10002;
  width: min(440px, 90vw);
  background: rgba(20, 25, 40, 0.95);
  border: 1px solid rgba(249, 115, 22, 0.4);
  border-radius: 18px;
  padding: 28px 32px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.tour-end.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
.tour-end-close {
  position: absolute;
  top: 10px; right: 14px;
  width: 28px; height: 28px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  font-size: 18px;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}
.tour-end-close:hover { background: rgba(255,255,255,0.1); color: #fff; }

.tour-end-logo {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent, #f97316), #fbbf24);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0 0 10px;
}
.tour-end-text {
  color: rgba(255,255,255,0.82);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 22px;
}
.tour-end-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tour-end-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 10px;
  background: #ffffff;
  color: #1f2937;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.tour-end-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255,255,255,0.2);
}
.tour-end-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 13px;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.tour-end-secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(249,115,22,0.4);
}
.tour-end-row {
  display: flex;
  gap: 8px;
}
.tour-end-row .tour-end-secondary { flex: 1; }

/* Always-visible "restart tour" launcher — shows whenever the tour
   isn't running so the user can jump back in. Sits in the bottom
   right corner, out of the way of the real dashboard widgets. */
/* Floating right-middle action stack. Tour launcher + Chrome install
   pills vertically aligned at the right edge, centred vertically so
   they stay out of the top bar, bottom strip and any bottom nav. */
/* Right-edge vertical stack — three pills centred on the page's
   vertical middle. Each pill's CENTRE is anchored to its `top` via
   translateY(-50%), so the three stack cleanly with a constant
   centre-to-centre distance regardless of font / padding changes.
   Stack height ≈ 3 × pill (~44px) + 2 × 24px gap ≈ 180px.            */
.tour-install,
.tour-home,
.tour-launcher {
  position: fixed;
  right: 16px;
  transform: translateY(-50%);
  z-index: 9003;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  border-radius: 999px;
  /* Force identical width so all pills line up flush on the right
     edge regardless of label length. */
  min-width: 180px;
  height: 44px;
  box-sizing: border-box;
  text-decoration: none;
  white-space: nowrap;
  transition: box-shadow 0.2s, filter 0.2s, opacity 0.3s;
}

/* Vertical positions — 68px centre-to-centre gives ~24px breathing
   room between pills without cramming the viewport middle. */
.tour-install  { top: calc(50% - 68px); }
.tour-home     { top: 50%;              }
.tour-launcher { top: calc(50% + 68px); }

.tour-install {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
}
.tour-install:hover { filter: brightness(1.03); box-shadow: 0 16px 38px rgba(255,255,255,0.22); }
.tour-install svg { display: block; flex: 0 0 auto; }

.tour-home {
  background: rgba(20, 25, 40, 0.9);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.tour-home:hover { filter: brightness(1.15); border-color: rgba(249,115,22,0.55); }

.tour-launcher {
  background: linear-gradient(135deg, #f97316, #a855f7);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(168, 85, 247, 0.45);
}
.tour-launcher:hover { filter: brightness(1.08); box-shadow: 0 16px 38px rgba(249, 115, 22, 0.55); }
.tour-launcher.is-hidden { opacity: 0; pointer-events: none; }

/* On narrow screens collapse to a bottom-right stack but stay above
   the footer buttons (Notlar / Görevler). 52px centre-to-centre here
   since the pill height stays 44px. */
/* ---- Tablet (≤800px) — pills shrink, bubble narrower ---- */
@media (max-width: 800px) {
  .tour-install,
  .tour-home,
  .tour-launcher {
    min-width: 140px;
    height: 36px;
    padding: 6px 12px;
    font-size: 11px;
    right: 10px;
  }
  .tour-install  { top: calc(50% - 52px); }
  .tour-home     { top: 50%; }
  .tour-launcher { top: calc(50% + 52px); }
  .tour-bubble { max-width: 280px; font-size: 13px; }
  .tour-nav { padding: 6px 12px; gap: 8px; font-size: 12px; }
}

/* ---- Phone (≤600px) — pills at bottom, bubble full-width ---- */
@media (max-width: 600px) {
  .tour-install,
  .tour-home,
  .tour-launcher {
    position: fixed;
    top: auto;
    right: 8px;
    transform: none;
    min-width: 120px;
    height: 32px;
    padding: 5px 10px;
    font-size: 10px;
  }
  .tour-install  { bottom: 160px; }
  .tour-home     { bottom: 118px; }
  .tour-launcher { bottom: 76px;  }
  .tour-bubble {
    max-width: calc(100vw - 32px);
    font-size: 12px;
    padding: 12px;
  }
  .tour-bubble-title { font-size: 14px; }
  .tour-nav {
    padding: 4px 8px;
    gap: 6px;
    height: auto;
    min-height: 36px;
  }
  .tour-nav-btn { width: 28px; height: 28px; font-size: 14px; }
  .tour-nav-step-lbl { font-size: 10px; }
  .tour-nav-step-title { font-size: 11px; }
}

/* ---- Short viewport (Nest Hub) ---- */
@media (max-height: 650px) {
  .tour-install,
  .tour-home,
  .tour-launcher {
    height: 32px;
    padding: 4px 10px;
    font-size: 10px;
    min-width: 120px;
  }
  .tour-install  { top: calc(50% - 44px); }
  .tour-home     { top: 50%; }
  .tour-launcher { top: calc(50% + 44px); }
  .tour-bubble { max-width: 260px; font-size: 12px; }
  .tour-nav { min-height: 32px; padding: 3px 8px; }
}
