/* ==========================================================================
   GLASBOX ARCHITEKT — Override Layer
   ─────────────────────────────────────────────────────────────────────────
   Loaded AFTER main.css. Only overrides what's needed:
   1. Force sidebar into drawer mode at ALL widths (collapsed on desktop)
   2. Show burger + topbar-logo on desktop
   3. Architekt-specific components (progress, steps, toggles, layout, etc.)
   
   Design tokens: inherits 100% from main.css (--bg, --amber, --border, etc.)
   ========================================================================== */

/* ==========================================================================
   1) SIDEBAR → ALWAYS DRAWER (override desktop sticky → fixed drawer)
   ========================================================================== */

/* Force sidebar to be a hidden drawer on ALL screen widths */
.sidebar {
  position: fixed !important;
  top: 0;
  left: 0;
  height: 100vh;
  height: 100dvh;
  width: 288px;
  transform: translateX(-105%);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  background: linear-gradient(
    180deg,
    var(--bg-elev) 0%,
    color-mix(in srgb, var(--bg-elev) 90%, transparent) 35%,
    transparent 100%
  );
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: none;
  border-right: none;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

.sidebar .nav-menu {
  mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
}

.sidebar.open {
  transform: translateX(0);
}

/* Burger + close button always visible */
#burgerBtn, .burger-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  position: relative;
  z-index: calc(var(--z-topbar) + 1);
}

.sidebar-close {
  display: inline-flex !important;
}

/* Topbar logo always visible (since sidebar is hidden) */
.topbar-logo {
  display: flex !important;
  align-items: center;
  gap: 6px;
}


/* ==========================================================================
   2) ARCHITEKT INTRO SCREEN
   ========================================================================== */

.arch-intro {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--topbar-h) - 100px);
}

.arch-intro__inner {
  max-width: 620px;
}

.arch-intro__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  color: var(--amber);
  margin-bottom: 20px;
}

.arch-intro__badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  animation: arch-blink 2s ease-in-out infinite;
}

@keyframes arch-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}


/* ==========================================================================
   3) PROGRESS BAR
   ========================================================================== */

.arch-progress {
  margin-bottom: 24px;
}

.arch-progress__track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 14px;
}

.arch-progress__fill {
  height: 100%;
  width: 0%;
  background: var(--amber);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.arch-progress__steps {
  display: flex;
  gap: 4px;
}

.arch-progress__step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.arch-progress__step:hover {
  background: color-mix(in srgb, var(--bg-elev-2) 78%, transparent);
  border-color: var(--border);
}

.arch-progress__step.active {
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  border-color: color-mix(in srgb, var(--amber) 22%, var(--border));
  color: var(--text);
}

.arch-progress__step.completed {
  color: var(--text);
  opacity: 0.7;
}

.arch-progress__step-num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  color: var(--amber);
}

.arch-progress__step-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ==========================================================================
   4) TWO-COLUMN LAYOUT
   ========================================================================== */

.arch-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.arch-layout__left {
  min-width: 0;
}

.arch-layout__right {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  min-width: 0;
}

@media (max-width: 980px) {
  .arch-layout {
    grid-template-columns: 1fr;
  }

  .arch-layout__right {
    position: static;
    order: -1;  /* HUD above steps on mobile */
  }
}


/* ==========================================================================
   5) STEP PANELS
   ========================================================================== */

.arch-step[hidden] {
  display: none !important;
}

.arch-step__header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.arch-step__badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 22%, var(--border));
  border-radius: 8px;
  padding: 6px 10px;
  flex-shrink: 0;
  margin-top: 2px;
}

.arch-step__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px;
}


/* ==========================================================================
   6) PROJECT TYPE CARDS
   ========================================================================== */

.arch-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.arch-type-card {
  text-align: left;
}

.arch-type-card[aria-checked="true"] {
  border-color: color-mix(in srgb, var(--amber) 40%, var(--border));
  background: color-mix(in srgb, var(--amber) 8%, var(--bg-elev));
}

.arch-type-card[aria-checked="true"] .module-top .icon {
  color: var(--amber);
}


/* ==========================================================================
   7) SLIDER (Range Input)
   ========================================================================== */

.arch-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  border: none;
  padding: 0;
  margin: 10px 0;
}

.arch-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--amber);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.arch-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--amber);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.arch-slider__output {
  display: block;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-top: 8px;
}

/* Mobile traffic segments: hidden on desktop */
.arch-fieldset--mobile {
  display: none;
}

@media (max-width: 768px) {
  .arch-fieldset--mobile {
    display: block;
  }

  /* Hide range slider on mobile */
  .arch-slider,
  .arch-slider__output,
  .arch-slider__ticks {
    display: none !important;
  }
}


/* ==========================================================================
   8) FEATURE TOGGLES (Step 2)
   ========================================================================== */

.arch-toggles {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.arch-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.arch-toggle:hover {
  border-color: var(--border-strong);
}

.arch-toggle__left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.arch-toggle__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Custom switch track */
.arch-toggle__switch {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--border);
  flex-shrink: 0;
  position: relative;
  transition: background 0.2s ease;
}

.arch-toggle__switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  transition: transform 0.2s ease, background 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.arch-toggle__input:checked ~ .arch-toggle__switch {
  background: var(--amber);
}

.arch-toggle__input:checked ~ .arch-toggle__switch::after {
  transform: translateX(16px);
  background: #fff;
}

/* Active toggle card highlight */
.arch-toggle:has(.arch-toggle__input:checked) {
  border-color: color-mix(in srgb, var(--amber) 30%, var(--border));
  background: color-mix(in srgb, var(--amber) 6%, var(--bg-elev));
}

.arch-toggle__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .arch-toggle {
    flex-direction: column;
    align-items: flex-start;
  }

  .arch-toggle__meta {
    align-items: flex-start;
    flex-direction: row;
    gap: 8px;
  }
}


/* ==========================================================================
   9) WARNINGS ZONE
   ========================================================================== */

.arch-warnings {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.arch-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  animation: fadeUp 0.22s ease-out;
}

.arch-warning--critical {
  border-color: rgba(239, 68, 68, 0.30);
  background: rgba(239, 68, 68, 0.06);
}

.arch-warning--info {
  border-color: color-mix(in srgb, var(--amber) 25%, var(--border));
  background: color-mix(in srgb, var(--amber) 5%, transparent);
}

.arch-warning__icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.arch-warning__close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  opacity: 0.5;
}

.arch-warning__close:hover {
  opacity: 1;
}


/* ==========================================================================
   10) HUD METRICS (Right Column)
   ========================================================================== */

.arch-hud__row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.arch-hud__metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (max-width: 600px) {
  .arch-hud__row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .arch-hud__metric {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}


/* ==========================================================================
   11) GRAPH CONTAINER
   ========================================================================== */

.arch-graph {
  overflow: hidden;
  border-radius: var(--radius);
}

.arch-graph svg {
  display: block;
  width: 100%;
}


/* ==========================================================================
   12) ROI CHART
   ========================================================================== */

.arch-roi {
  border-radius: var(--radius);
}


/* ==========================================================================
   13) TECH STACK PILLS
   ========================================================================== */

.arch-techstack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.arch-techstack .pill {
  font-size: 11px;
  padding: 4px 10px;
}


/* ==========================================================================
   14) MOBILE STICKY HUD (built by UIController.js)
   ========================================================================== */

.arch-mobile-hud {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  padding: 0 16px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  display: none;
  align-items: center;
  justify-content: space-between;
  z-index: var(--z-topbar);
  font-family: var(--font-mono);
  font-size: 12px;
}

@media (max-width: 768px) {
  .arch-mobile-hud {
    display: flex;
  }
}

.arch-mobile-hud__chf {
  font-weight: 700;
  color: var(--amber);
}


/* ==========================================================================
   15) REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .arch-intro__badge-dot {
    animation: none;
  }

  .arch-progress__fill {
    transition: none;
  }
}


/* ==========================================================================
   16) TOPBAR & OVERLAY STACKING SAFETY
   Loaded last — final word on pointer-event cascade.
   ========================================================================== */

.topbar {
  pointer-events: auto;
  z-index: var(--z-modal);
}

.topbar-left,
.topbar-right,
.topbar .icon-btn,
.topbar .topbar-logo {
  pointer-events: auto;
}

/* ==========================================================================
   FIX LAST: Kill invisible success screen shield
   ========================================================================== */
   #successScreen {
    pointer-events: none !important;
    visibility: hidden;
  }
  
  /* Włączamy klikalność tylko wtedy, gdy ekran faktycznie ma się pojawić */
  #successScreen.active,
  #successScreen.show,
  #successScreen[style*="opacity: 1"] {
    pointer-events: auto !important;
    visibility: visible;
  }