/* Roadmap Viewer Styles – modern refresh */

:root {
  --rm-surface: #1a1e24;
  --rm-surface-elevated: #21262d;
  --rm-border: rgba(255, 255, 255, 0.06);
  --rm-border-accent: rgba(16, 172, 132, 0.35);
  --rm-radius-sm: 10px;
  --rm-radius-md: 14px;
  --rm-radius-lg: 20px;
  --rm-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  --rm-shadow-inset: inset 0 2px 20px rgba(0, 0, 0, 0.2);
}

body {
  font-family: "Rubik", sans-serif;
  font-weight: 400;
  background: var(--rm-surface);
  margin: 0;
  padding: 0;
  color: #fff;
  -webkit-font-smoothing: antialiased;
}

/* Full-width layout for roadmap viewer (overrides common.css) */
body .roadmap-viewer-layout {
  width: 100%;
}

.roadmap-viewer-layout {
  display: flex;
  height: 100vh;
  background: var(--rm-surface);
  color: #fff;
  font-family: "Rubik", sans-serif;
}

/* Left Panel - Roadmap Viewer */
.left-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--rm-surface);
  border-right: 1px solid var(--rm-border);
}

.panel-header {
  padding: 1rem 1.25rem;
  min-height: 72px;
  box-sizing: border-box;
  background: var(--rm-surface-elevated);
  border-bottom: 1px solid var(--rm-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  box-shadow: var(--rm-shadow-inset);
}

.panel-header-back {
  display: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-container {
  display: flex;
  align-items: center;
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.logo-link:hover {
  opacity: 0.9;
}

.logo-link:active {
  transform: scale(0.98);
}

.company-logo {
  height: 40px;
  width: auto;
  max-width: 200px;
  cursor: pointer;
}

.header-left h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.2;
}

.panel-content {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--rm-surface);
  box-shadow: var(--rm-shadow-inset);
}

/* Legend - glass card */
.roadmap-legend {
  position: absolute;
  left: 1.25rem;
  top: 1.25rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.875rem 1.125rem;
  background: rgba(26, 30, 36, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--rm-radius-md);
  border: 1px solid var(--rm-border);
  font-family: "Rubik", sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.5;
  color: #fff;
  letter-spacing: 0.01em;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-item i {
  color: var(--primary-color, #10ac84);
  width: 1rem;
  text-align: center;
  opacity: 0.95;
}

/* Show desktop/touch legend based on input type */
.legend-touch {
  display: none;
}
.legend-desktop {
  display: inline;
}

/* Legal links - bottom-right of left panel (grid view), does not affect layout */
.roadmap-viewer-legal {
  position: absolute;
  right: 1.25rem;
  bottom: 1rem;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.roadmap-viewer-legal__link {
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: color 0.2s ease;
}

.roadmap-viewer-legal__link:hover {
  color: var(--primary-color, #10ac84);
}

.roadmap-viewer-legal__sep {
  opacity: 0.5;
  user-select: none;
  font-size: 0.75rem;
}

.roadmap-viewer-legal__cookie-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.2s ease;
}

.roadmap-viewer-legal__cookie-btn:hover {
  color: var(--primary-color, #10ac84);
}

@media (hover: none) and (pointer: coarse) {
  .legend-touch {
    display: inline;
  }
  .legend-desktop {
    display: none;
  }
}

/* Right Panel - Inspector (elevated sidebar) */
.right-panel {
  width: 500px;
  min-width: 300px;
  max-width: 80vw;
  background: var(--rm-surface-elevated);
  border-left: 1px solid var(--rm-border);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.2);
}

/* Resize Handle - full height, modern bar */
.resize-handle {
  position: absolute;
  left: -5px;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--rm-border);
  cursor: col-resize;
  z-index: 10;
  transition:
    background 0.2s ease,
    width 0.2s ease,
    box-shadow 0.2s ease;
}

.resize-handle:hover {
  background: var(--primary-color, #10ac84);
  width: 6px;
  box-shadow: 0 0 16px rgba(16, 172, 132, 0.35);
}

.resize-handle:active {
  background: #0d8f6f;
}

.inspector-drawer-handle {
  display: none;
}

.inspector-drawer-close {
  display: none;
}

.right-panel-header {
  padding: 1rem 1.25rem;
  min-height: 72px;
  box-sizing: border-box;
  background: var(--rm-surface-elevated);
  border-bottom: 1px solid var(--rm-border);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.inspector-header-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition:
    color 0.2s ease,
    gap 0.2s ease,
    opacity 0.2s ease;
  position: relative;
  padding-left: 0.75rem;
}

.inspector-header-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 1em;
  background: var(--primary-color, #10ac84);
  border-radius: 2px;
}

.inspector-header-link:hover {
  color: var(--primary-color, #10ac84);
  gap: 0.65rem;
}

.inspector-header-link:active {
  opacity: 0.9;
}

.menu-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 1rem 0;
}

.node-content-panel {
  padding: 1.25rem 1.25rem 0;
}

.node-content-header {
  margin-bottom: 1.25rem;
}

.node-content-header h4 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: #fff;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--primary-color, #10ac84);
}

.node-content-body {
  font-size: 1rem;
  line-height: 1.65;
  font-weight: 400;
  color: #fff;
}

.placeholder-text {
  font-size: 1rem;
  line-height: 1.65;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  margin-top: 2rem;
  padding: 0 0.5rem;
}

/* Topic Content (inside inspector body) */
.topic-content {
  margin-top: 0.5rem;
}

.topic-content h3 {
  margin: 0 0 1.25rem 0;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-color, #10ac84);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary-color, #10ac84);
}

.topic-body {
  font-family: "Rubik", sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  font-weight: 400;
  color: #fff;
  text-align: left;
  max-width: none;
}

.topic-body h1,
.topic-body h2,
.topic-body h3,
.topic-body h4,
.topic-body h5,
.topic-body h6 {
  font-family: "Rubik", sans-serif;
  color: #fff;
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.topic-body h1 {
  font-size: 1.75rem;
  border-bottom: 2px solid var(--primary-color, #10ac84);
  padding-bottom: 0.5rem;
  margin-top: 0;
}

.topic-body h2 {
  font-size: 1.35rem;
  border-bottom: 1px solid var(--rm-border);
  padding-bottom: 0.35rem;
}

.topic-body h3 {
  font-size: 1.15rem;
  color: var(--primary-color, #10ac84);
}

.topic-body h4 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
}

.topic-body h5,
.topic-body h6 {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.topic-body p {
  margin-bottom: 1.25rem;
  color: #fff;
}

.topic-body ul,
.topic-body ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
  color: #fff;
}

.topic-body li {
  margin-bottom: 0.4rem;
  line-height: 1.6;
}

.topic-body ul li {
  list-style-type: disc;
}

.topic-body ol li {
  list-style-type: decimal;
}

.topic-body code {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  font-family:
    "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", "Source Code Pro",
    monospace;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--rm-border);
}

.topic-body pre {
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  padding: 1.25rem 1.5rem;
  border-radius: var(--rm-radius-sm);
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--rm-border);
  font-family:
    "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", "Source Code Pro",
    monospace;
  font-size: 0.875rem;
  line-height: 1.55;
}

.topic-body pre code {
  background: none;
  padding: 0;
  border: none;
  color: inherit;
}

.topic-body blockquote {
  border-left: 4px solid var(--primary-color, #10ac84);
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 var(--rm-radius-sm) var(--rm-radius-sm) 0;
  color: #fff;
  font-style: italic;
}

.topic-body a {
  color: var(--primary-color, #10ac84);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.topic-body a:hover {
  color: #14d4a0;
}

.topic-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  border-radius: var(--rm-radius-sm);
  overflow: hidden;
  border: 1px solid var(--rm-border);
}

.topic-body th,
.topic-body td {
  border: 1px solid var(--rm-border);
  padding: 0.75rem 1rem;
  text-align: left;
  color: #fff;
}

.topic-body th {
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.topic-body tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.topic-body tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.topic-loading {
  text-align: center;
  padding: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
}

.topic-error {
  text-align: center;
  padding: 2rem;
  color: #f87171;
}

/* Loading state - shown until we know if roadmap is public or protected */
.roadmap-loading {
  position: fixed;
  z-index: 1001;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: var(--rm-surface);
}

.roadmap-loading__content {
  position: relative;
  width: 100%;
  height: 100%;
}

.roadmap-loading__logo {
  position: absolute;
  left: 50%;
  top: calc(50% - 5rem);
  transform: translateX(-50%);
  height: 44px;
  width: auto;
  max-width: 200px;
  opacity: 0.95;
}

.roadmap-loading__dots {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.roadmap-loading__dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-color, #10ac84);
  animation: roadmap-loading-bounce 1.4s ease-in-out infinite both;
}

.roadmap-loading__dot:nth-child(1) {
  animation-delay: -0.32s;
}

.roadmap-loading__dot:nth-child(2) {
  animation-delay: -0.16s;
}

.roadmap-loading__dot:nth-child(3) {
  animation-delay: 0s;
}

@keyframes roadmap-loading-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Modal - modern overlay */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content {
  background: var(--rm-surface-elevated);
  margin: 15vh auto;
  padding: 0;
  border: 1px solid var(--rm-border);
  border-radius: var(--rm-radius-lg);
  width: 400px;
  max-width: 90%;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

.modal-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--rm-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.modal-logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-logo {
  height: 50px;
  width: auto;
  max-width: 250px;
}

.modal-header h3 {
  margin: 0;
  font-family: "Rubik", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  text-align: center;
}

.modal-body {
  padding: 1.25rem 1.5rem;
}

.modal-body label {
  display: block;
  margin-bottom: 0.5rem;
  font-family: "Rubik", sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #fff;
}

.modal-body input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--rm-border);
  border-radius: var(--rm-radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-family: "Rubik", sans-serif;
  font-size: 1rem;
  font-weight: 400;
  box-sizing: border-box;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.modal-body input:focus {
  outline: none;
  border-color: var(--primary-color, #10ac84);
  box-shadow: 0 0 0 3px rgba(16, 172, 132, 0.2);
}

.modal-footer {
  padding: 1rem 1.5rem 1.5rem;
  border-top: none;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--rm-radius-sm);
  cursor: pointer;
  font-family: "Rubik", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition:
    background-color 0.2s ease,
    transform 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary-color, #10ac84);
  color: #fff;
}

.btn-primary:hover {
  background: #0e9a73;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid var(--rm-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Responsive Design */
@media (max-width: 768px) {
  .roadmap-viewer-layout {
    flex-direction: column;
    width: 100%;
    min-width: 0;
    height: 100vh;
    height: 100dvh;
  }

  .left-panel {
    flex: 0 0 100%;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    min-width: 0;
  }

  .panel-content {
    min-height: 200px;
  }

  .header-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .logo-link {
    display: flex;
    align-items: center;
  }

  .company-logo {
    height: 30px;
  }

  .header-left h2 {
    font-size: 1.2rem;
  }

  .roadmap-legend {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    left: 0.5rem;
    top: 0.5rem;
    border-radius: var(--rm-radius-sm);
  }

  /* Inspector as overlay drawer - hidden by default, slides up over view */
  .right-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 85vh;
    max-height: 85vh;
    min-height: 0;
    margin: 0;
    border-left: none;
    border-top: 1px solid var(--rm-border);
    border-radius: var(--rm-radius-lg) var(--rm-radius-lg) 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
    z-index: 100;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .right-panel.right-panel--open {
    transform: translateY(0);
  }

  .inspector-drawer-handle {
    display: block;
    flex-shrink: 0;
    width: 100%;
    padding: 0.75rem 0 0.5rem;
    cursor: grab;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
  }

  .inspector-drawer-handle::after {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 2px;
  }

  .inspector-drawer-handle:active {
    cursor: grabbing;
  }

  .inspector-drawer-close {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s ease;
  }

  .right-panel.right-panel--open .inspector-drawer-close {
    display: flex !important;
  }

  .inspector-drawer-close:hover {
    background: rgba(255, 255, 255, 0.2);
  }

  .inspector-drawer-close:active {
    background: rgba(255, 255, 255, 0.25);
  }

  .right-panel-header {
    position: relative;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    padding-inline-end: 3.5rem;
    padding-inline-start: 1rem;
  }

  .inspector-header-link--desktop {
    display: none !important;
  }

  .panel-header-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 0.4rem 0.6rem;
    border-radius: var(--rm-radius-sm);
    transition:
      color 0.2s ease,
      background 0.2s ease;
  }

  .panel-header-back:hover {
    color: var(--primary-color, #10ac84);
    background: rgba(255, 255, 255, 0.06);
  }

  .menu-content,
  .node-content-panel,
  .node-content-body,
  #nodeContentDisplay,
  .topic-content,
  .topic-body {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }

  .node-content-panel {
    padding: 1rem;
    padding-inline-end: max(1rem, env(safe-area-inset-right));
  }

  .node-content-header h4 {
    font-size: 1.2rem;
  }

  .topic-body {
    overflow-wrap: break-word;
  }

  .topic-body pre {
    max-width: 100%;
  }

  .resize-handle {
    display: none;
  }

  .modal-content {
    width: 95%;
    margin: 10vh auto;
    border-radius: var(--rm-radius-md);
  }

  .modal-logo {
    height: 40px;
    max-width: 200px;
  }

  .modal-header {
    padding: 0.75rem;
    gap: 0.75rem;
  }
}
