:root {
  /* CANVAS */
  --wf-canvas-bg: #f5f5f5;
  --wf-canvas-text: #1a1a1a;

  /* FLOW SECTIONS */
  --wf-flow-bg: #ffffff;
  --wf-flow-border: #e5e5e5;
  --wf-flow-title: #1a1a1a;
  --wf-flow-description: #666666;

  /* DEVICE FRAMES */
  --wf-device-bg: #ffffff;
  --wf-device-bezel: #1a1a1a;
  --wf-device-bezel-inner: #333333;
  --wf-device-title: #888888;
  --wf-device-radius: 36px;

  /* STATUS BAR */
  --wf-status-bar-bg: transparent;
  --wf-status-bar-text: #000000;
  --wf-status-bar-height: 44px;

  /* DESKTOP / BROWSER */
  --wf-browser-bar-bg: #e5e5e5;
  --wf-browser-bar-height: 36px;
  --wf-browser-dots-red: #ff5f57;
  --wf-browser-dots-yellow: #febc2e;
  --wf-browser-dots-green: #28c840;
  --wf-browser-url-bg: #ffffff;
  --wf-browser-url-text: #666666;

  /* SPACING (internal use) */
  --wf-space-xs: 4px;
  --wf-space-sm: 8px;
  --wf-space-md: 12px;
  --wf-space-lg: 16px;
  --wf-space-xl: 24px;
  --wf-space-2xl: 32px;
  --wf-space-3xl: 48px;
  --wf-space-4xl: 64px;

  /* TYPOGRAPHY (internal use) */
  --wf-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --wf-font-size-xs: 10px;
  --wf-font-size-sm: 12px;
  --wf-font-size-md: 14px;
  --wf-font-size-lg: 16px;
  --wf-font-size-xl: 20px;

  /* SHADOWS */
  --wf-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --wf-shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --wf-shadow-lg: 0 10px 25px rgba(0,0,0,0.15);

  /* SEMANTIC COLORS */
  --wf-text-secondary: #666666;
  --wf-text-tertiary: #999999;
  --wf-bg-canvas: #f5f5f5;
  --wf-bg-component: #ffffff;
  --wf-bg-subtle: #f5f5f5;
  --wf-accent: #007AFF;
  --wf-border: #e5e5e5;

  /* BORDER RADIUS */
  --wf-radius-md: 8px;
  --wf-radius-lg: 12px;
}

/* BASE STYLES */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--wf-font-family);
  background: var(--wf-canvas-bg);
  color: var(--wf-canvas-text);
  line-height: 1.5;
}

/* CANVAS */

.wf-canvas {
  padding: var(--wf-space-3xl) var(--wf-space-2xl);
  min-height: 100vh;
}

/* FLOW */

.wf-flow {
  display: block;
  background: var(--wf-flow-bg);
  border-radius: 12px;
  padding: var(--wf-space-2xl);
  margin-bottom: var(--wf-space-3xl);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid var(--wf-flow-border);
}

.wf-flow-header {
  margin-bottom: var(--wf-space-xl);
  padding-bottom: var(--wf-space-lg);
  border-bottom: 1px solid var(--wf-flow-border);
}

.wf-flow-title {
  font-size: var(--wf-font-size-xl);
  font-weight: 600;
  color: var(--wf-flow-title);
  margin: 0 0 var(--wf-space-xs) 0;
}

.wf-flow-description {
  font-size: var(--wf-font-size-sm);
  color: var(--wf-flow-description);
  margin: 0;
}

.wf-flow-screens {
  display: flex;
  gap: var(--wf-space-3xl);
  overflow-x: auto;
  padding: var(--wf-space-md) var(--wf-space-sm);
  padding-bottom: var(--wf-space-lg);
}

/* MOBILE DEVICE */

.wf-device {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--wf-space-sm);
}

.wf-device-title {
  font-size: var(--wf-font-size-sm);
  font-weight: 500;
  color: var(--wf-device-title);
  text-align: center;
}

.wf-device-frame {
  background: var(--wf-device-bg);
  border-radius: var(--wf-device-radius);
  box-shadow:
    0 0 0 2px var(--wf-device-bezel),
    0 0 0 4px var(--wf-device-bezel-inner),
    var(--wf-shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* STATUS BAR */

.wf-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--wf-space-sm) var(--wf-space-xl);
  height: var(--wf-status-bar-height);
  background: var(--wf-status-bar-bg);
  color: var(--wf-status-bar-text);
  font-size: var(--wf-font-size-sm);
  font-weight: 500;
}

.wf-status-bar--dark {
  color: #ffffff;
}

.wf-status-bar--notch {
  position: relative;
  padding-top: 12px;
}

.wf-status-bar-time {
  font-weight: 600;
}

.wf-status-bar-icons {
  display: flex;
  gap: var(--wf-space-xs);
}

.wf-status-bar-icons svg {
  width: 16px;
  height: 16px;
}

/* NOTCH */

.wf-status-bar-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 28px;
  background: #000000;
  border-radius: 0 0 16px 16px;
  z-index: 10;
}

.wf-status-bar--notch .wf-status-bar-notch::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 5px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2.5px;
}

/* Adjust status bar content when notch is present */
.wf-status-bar--notch .wf-status-bar-time,
.wf-status-bar--notch .wf-status-bar-icons {
  position: relative;
  z-index: 1;
}

/* CONTENT */

.wf-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--wf-device-bg);
  overflow-y: auto;
  height: 100%;
}

.wf-content--center {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.wf-content--padding {
  padding: var(--wf-space-lg);
}

/* DESKTOP FRAME */

.wf-desktop {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--wf-space-sm);
}

.wf-desktop-title {
  font-size: var(--wf-font-size-sm);
  font-weight: 500;
  color: var(--wf-device-title);
  text-align: center;
}

.wf-desktop-frame {
  background: var(--wf-device-bg);
  border-radius: 8px;
  box-shadow: var(--wf-shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.wf-browser-bar {
  display: flex;
  align-items: center;
  gap: var(--wf-space-md);
  padding: var(--wf-space-sm) var(--wf-space-md);
  background: var(--wf-browser-bar-bg);
  height: var(--wf-browser-bar-height);
}

.wf-browser-dots {
  display: flex;
  gap: var(--wf-space-xs);
}

.wf-browser-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.wf-browser-dots span:nth-child(1) { background: var(--wf-browser-dots-red); }
.wf-browser-dots span:nth-child(2) { background: var(--wf-browser-dots-yellow); }
.wf-browser-dots span:nth-child(3) { background: var(--wf-browser-dots-green); }

.wf-browser-url {
  flex: 1;
  background: var(--wf-browser-url-bg);
  padding: var(--wf-space-xs) var(--wf-space-md);
  border-radius: 4px;
  font-size: var(--wf-font-size-sm);
  color: var(--wf-browser-url-text);
}

.wf-desktop-content {
  flex: 1;
  overflow-y: auto;
}

/* TOPBAR GLOBAL (navigation between pages) */

.wf-topbar-global {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--wf-space-md) var(--wf-space-xl);
  background: #ffffff;
  border-bottom: 1px solid #e5e5e5;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 56px;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.95);
}

.wf-topbar-global-logo {
  font-size: var(--wf-font-size-lg);
  font-weight: 700;
  color: #1a1a1a;
  text-decoration: none;
  letter-spacing: -0.3px;
}

.wf-topbar-global-nav {
  display: flex;
  align-items: center;
  gap: var(--wf-space-sm);
}

/* Prev/Next arrows */
.wf-topbar-arrows {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: var(--wf-space-xs);
}

.wf-topbar-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: #666;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.wf-topbar-arrow:hover {
  background: #f0f0f0;
  color: #1a1a1a;
}

.wf-topbar-arrow svg {
  width: 16px;
  height: 16px;
}

.wf-topbar-arrow--disabled {
  color: #ddd;
  pointer-events: none;
}

/* Dropdown for flows */
.wf-dropdown {
  position: relative;
}

.wf-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: var(--wf-space-sm);
  padding: var(--wf-space-sm) var(--wf-space-md);
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  font-size: var(--wf-font-size-sm);
  font-weight: 500;
  color: #1a1a1a;
  cursor: pointer;
  min-width: 180px;
  justify-content: space-between;
  transition: background 0.15s, border-color 0.15s;
}

.wf-dropdown-toggle:hover {
  background: #ebebeb;
}

.wf-dropdown-toggle svg {
  width: 16px;
  height: 16px;
  color: #666;
  transition: transform 0.2s;
}

.wf-dropdown-counter {
  font-size: 10px;
  color: #999;
  margin-left: var(--wf-space-xs);
}

.wf-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  min-width: 240px;
  max-height: 400px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

/* Click-to-open dropdown (JS adds this class) */
.wf-dropdown-menu.wf-dropdown-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.wf-dropdown-open + .wf-dropdown-toggle svg,
.wf-dropdown-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.wf-dropdown-item {
  display: block;
  padding: var(--wf-space-sm) var(--wf-space-md);
  font-size: var(--wf-font-size-sm);
  color: #1a1a1a;
  text-decoration: none;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.1s;
}

.wf-dropdown-item:last-child {
  border-bottom: none;
}

.wf-dropdown-item:hover {
  background: #f5f5f5;
}

.wf-dropdown-item.active {
  background: #f0f0f0;
  font-weight: 500;
  position: relative;
}

.wf-dropdown-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: #1a1a1a;
  border-radius: 0 2px 2px 0;
}

.wf-dropdown-item-title {
  display: block;
}

.wf-dropdown-item-desc {
  display: block;
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}

/* Design system / Components link */
.wf-topbar-global-link {
  font-size: var(--wf-font-size-sm);
  color: #666;
  text-decoration: none;
  padding: var(--wf-space-sm) var(--wf-space-md);
  border-radius: 6px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.wf-topbar-global-link:hover {
  background: #f5f5f5;
  color: #1a1a1a;
}

.wf-topbar-global-link.active {
  background: #1a1a1a;
  color: #ffffff;
}

body.wf-has-topbar {
  padding-top: 56px;
}

/* Mobile hamburger button — hidden on desktop */
.wf-topbar-burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: none;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  cursor: pointer;
  color: #1a1a1a;
  transition: background 0.15s;
}
.wf-topbar-burger:hover {
  background: #f0f0f0;
}
.wf-topbar-burger svg {
  width: 18px;
  height: 18px;
}

/* RESPONSIVE */

@media (max-width: 640px) {
  .wf-topbar-global {
    padding: var(--wf-space-sm) var(--wf-space-md);
    height: 48px;
  }

  body.wf-has-topbar {
    padding-top: 48px;
  }

  .wf-topbar-global-logo {
    font-size: var(--wf-font-size-md);
  }

  /* Show hamburger on mobile */
  .wf-topbar-burger {
    display: flex;
  }

  /* Collapse nav into a slide-down panel */
  .wf-topbar-global-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(255,255,255,0.98);
    border-bottom: 1px solid #e5e5e5;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    padding: var(--wf-space-sm);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  }

  .wf-topbar-global-nav.wf-topbar-nav-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  /* Arrows centered in mobile panel */
  .wf-topbar-arrows {
    justify-content: center;
    margin-right: 0;
    padding: var(--wf-space-xs) 0;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: var(--wf-space-xs);
  }

  /* Dropdown takes full width on mobile */
  .wf-dropdown {
    width: 100%;
  }

  .wf-dropdown-toggle {
    width: 100%;
    min-width: unset;
  }

  .wf-dropdown-menu {
    position: static;
    margin-top: var(--wf-space-xs);
    box-shadow: none;
    border: 1px solid #e5e5e5;
    max-height: 240px;
  }

  /* Special links stacked as full-width buttons */
  .wf-topbar-global-link {
    display: block;
    text-align: center;
    padding: var(--wf-space-sm) var(--wf-space-md);
    border-radius: 6px;
    margin-top: var(--wf-space-xs);
  }

  .wf-canvas {
    padding: var(--wf-space-md);
  }

  .wf-flow {
    padding: var(--wf-space-md);
  }

  .wf-flow-screens {
    gap: var(--wf-space-md);
  }
}

.wf-annotation {
  position: absolute;
  top: 36px;
  right: 12px;
  max-width: 320px;
  max-height: 400px;
  overflow-y: auto;
  padding: var(--wf-space-md);
  background: #1a1a1a;
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 100;
}

.wf-annotation-item {
  padding: var(--wf-space-sm) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.wf-annotation-item:first-child {
  padding-top: 0;
}

.wf-annotation-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.wf-annotation-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #f59e0b;
  color: #1a1a1a;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  margin-right: var(--wf-space-sm);
  flex-shrink: 0;
}

.wf-annotation::before {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 12px;
  border: 6px solid transparent;
  border-bottom-color: #1a1a1a;
}

/* Pulse indicator on screen */
.wf-annotation-pulse {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 10px;
  height: 10px;
  background: #f59e0b;
  border-radius: 50%;
  z-index: 101;
  cursor: pointer;
  animation: wf-pulse 2s ease-in-out infinite;
}

.wf-annotation-pulse::before {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid #f59e0b;
  border-radius: 50%;
  opacity: 0;
  animation: wf-pulse-ring 2s ease-in-out infinite;
}

@keyframes wf-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes wf-pulse-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Show annotation on pulse hover */
.wf-annotation-pulse:hover ~ .wf-annotation,
.wf-annotation:hover {
  opacity: 1;
  visibility: visible;
}

/* Container needs relative positioning */
.wf-device,
.wf-desktop {
  position: relative;
}

/* Toggle for annotations */
.wf-annotation-toggle {
  position: fixed;
  bottom: var(--wf-space-xl);
  right: var(--wf-space-xl);
  display: flex;
  align-items: center;
  gap: var(--wf-space-sm);
  padding: var(--wf-space-xs) var(--wf-space-md);
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 16px;
  font-size: 11px;
  color: #666;
  cursor: pointer;
  box-shadow: var(--wf-shadow-sm);
  z-index: 1000;
}

.wf-annotation-toggle:hover {
  background: #fafafa;
}

.wf-annotation-toggle input {
  accent-color: #f59e0b;
  width: 14px;
  height: 14px;
}

body.wf-hide-annotations .wf-annotation,
body.wf-hide-annotations .wf-annotation-pulse {
  display: none;
}

/* ══════════════════════════════════════════════
   WATERMARK FOOTER
   ══════════════════════════════════════════════ */

.wf-watermark {
  padding: var(--wf-space-xl) var(--wf-space-md);
  text-align: center;
  border-top: 1px solid #eee;
  margin-top: var(--wf-space-2xl);
}

.wf-watermark-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #bbb;
  text-decoration: none;
  transition: color 0.2s;
  letter-spacing: 0.2px;
}

.wf-watermark-link:hover {
  color: #888;
}

.wf-watermark-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.wf-watermark-link span {
  font-weight: 600;
  color: #999;
  transition: color 0.2s;
}

.wf-watermark-link:hover span {
  color: #666;
}
