/* 🎯 Node Styles */
.node {
  cursor: pointer;
  transition: opacity 0.3s ease-out;
  overflow: visible;
}

.node-content {
  width: var(--node-width);
  min-height: var(--node-height);
  background: var(--node-bg);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: var(--sp-4) var(--sp-3) var(--sp-3);
  padding-top: calc(var(--emoji-offset) - var(--sp-4));
  box-shadow: var(--shadow-base);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.2s ease-in-out;
  color: var(--node-text);
  cursor: pointer;
  overflow: visible;
}

.node-content:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-200);
}

.node-content:focus-visible {
  outline: 2px solid var(--brand-300);
  outline-offset: 3px;
  border-color: var(--brand-300);
}

.node-content.hidden {
  opacity: 0.4;
}

.node-content.folded {
  border-style: dashed;
  position: relative;
}

.node-content.folded .node-emoji-button {
  background: var(--gray-50);
  border-style: dashed;
}

.node-content.folded .node-control-btn {
  background: var(--gray-50);
}

.node-folded-preview {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  padding: 4px 8px;
  background: var(--node-bg);
  border: 1px dashed var(--gray-200);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  z-index: 5;
  transition: all 0.2s ease-out;
  white-space: nowrap;
  pointer-events: auto;
  opacity: 1;
}

/* Ensure smooth transitions */
.node-folded-preview.removing {
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
}

.node-folded-preview::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  width: 8px;
  height: 8px;
  background: var(--node-bg);
  border-left: 1px dashed var(--gray-200);
  border-top: 1px dashed var(--gray-200);
  transform: translateX(-50%) rotate(45deg);
}

/* Hide preview when no folded children */
.node-content:not(.folded) .node-folded-preview,
.node-content.folded:not([data-has-folded-children="true"]) .node-folded-preview {
  display: none;
  pointer-events: none;
}

.node-folded-preview-item {
  cursor: pointer;
  font-size: 1em;
  padding: 2px;
  border-radius: 6px;
  transition: all 0.15s ease-out;
  color: var(--gray-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  line-height: 1;
  position: relative;
}

.node-folded-preview-item:hover {
  background: var(--gray-50);
  transform: scale(1.2);
  color: var(--text-primary);
  z-index: 1;
}

.node-folded-preview-item[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  animation: fadeIn 0.2s 0.3s forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* 🎨 Node Controls */
.node-controls {
  position: absolute;
  top: var(--sp-2);
  right: var(--sp-2);
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.2s ease-out;
  z-index: 10;
}

.node-content:hover .node-controls {
  opacity: 1;
  transform: translateY(0);
}

.node-content:focus-within .node-controls,
.node-content:focus-visible .node-controls {
  opacity: 1;
  transform: translateY(0);
}

.node-control-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: white;
  color: var(--gray-600);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease-in-out;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.node-control-btn:hover {
  background: var(--gray-50);
  color: var(--brand-500);
  border-color: var(--brand-200);
}

.node-control-btn.delete-btn:hover {
  background: var(--error-50);
  color: var(--error-500);
  border-color: var(--error-100);
}

.node-control-btn .material-icons-round {
  font-size: 18px;
}

.node-control-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.node-control-btn.loading .material-icons-round {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 🎯 Node Title */
.node-title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin: var(--sp-2) 0;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
  text-align: center;
  line-clamp: 2; /* fallback */
}

/* 🎨 Node Emoji Button */
.node-emoji-button {
  position: absolute;
  top: calc(-1 * var(--emoji-offset) / 1.8);
  left: 50%;
  transform: translateX(-50%);
  width: calc(var(--emoji-size) * 1.1);
  height: calc(var(--emoji-size) * 1.1);
  background: var(--surface-primary);
  border: 2px solid var(--gray-200);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--emoji-size) * 0.7);
  line-height: 1;
  transition: all 0.2s ease-in-out;
  box-shadow: var(--shadow-sm);
  z-index: 20;
  cursor: pointer;
}

.node-emoji-button:hover {
  transform: translateX(-50%) scale(1.1);
  border-color: var(--brand-200);
  box-shadow: var(--shadow-md);
}

.node-emoji-button .plus {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: var(--brand-500);
  color: white;
  border-radius: 50%;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.2s ease-out;
}

.node-emoji-button:hover .plus {
  opacity: 1;
  transform: scale(1);
}

.node-emoji-button.loading::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border: 2px solid var(--brand-200);
  border-radius: 50%;
  border-top-color: transparent;
  animation: emoji-loading 1s linear infinite;
}

@keyframes emoji-loading {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 📱 Panel Styles */
.panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.panel-overlay.active {
  opacity: 1;
}

.detail-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(600px, 90vw);
  max-height: 85vh;
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  z-index: 1001;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.detail-panel.active {
  opacity: 1;
}

/* 🐞 Debug Panel - Slide-in Drawer */
.debug-panel-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 1500;
  pointer-events: none;
  transition: background 0.3s ease-out;
}

.debug-panel-overlay.active {
  background: rgba(15, 23, 42, 0.15);
  pointer-events: auto;
}

.debug-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  transform: translateX(100%);
  width: min(480px, 90vw);
  height: 100vh;
  background: var(--node-bg, white);
  border-left: 1px solid var(--gray-200);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
  z-index: 1501;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.debug-panel.active {
  transform: translateX(0);
}

/* Keep main content stable when drawer opens */
body.debug-drawer-open .container {
  transform: none;
}

.container {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.debug-panel-header {
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  border-bottom: 1px solid var(--gray-200);
}

.debug-panel-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.debug-panel-actions {
  display: flex;
  gap: var(--sp-2);
}

.debug-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  background: white;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease-out;
}

.debug-action-btn:hover {
  background: var(--gray-50);
  color: var(--brand-500);
  border-color: var(--brand-200);
}

.debug-panel-tabs {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--gray-200);
}

.debug-tab {
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s ease-out;
}

.debug-tab.active {
  background: var(--brand-50);
  color: var(--brand-600);
  border-color: var(--brand-200);
}

.debug-panel-content {
  padding: var(--sp-4);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.debug-section {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.debug-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.debug-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  font-size: var(--text-sm);
  color: var(--gray-700);
}

.debug-input {
  width: 100%;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: var(--text-sm);
  background: white;
  color: var(--gray-700);
}

.debug-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--gray-600);
}

.debug-toggle input {
  accent-color: var(--brand-500);
}

.debug-hint {
  font-size: var(--text-xs);
  color: var(--gray-500);
}

.debug-log-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.debug-log-entry {
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: var(--sp-3);
  background: white;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.debug-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.debug-log-title {
  font-weight: 600;
  color: var(--text-primary);
}

.debug-log-status {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--brand-600);
}

.debug-log-status.error {
  color: var(--error-500);
}

.debug-log-meta {
  font-size: var(--text-xs);
  color: var(--gray-500);
}

.debug-log-details summary {
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-600);
}

.debug-log-block {
  margin-top: var(--sp-2);
  padding: var(--sp-2);
  border-radius: 10px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  font-size: var(--text-xs);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.debug-log-block.raw {
  background: var(--gray-100);
}

.debug-trace-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.debug-trace-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.debug-trace-label {
  font-size: var(--text-xs);
  color: var(--gray-600);
}

.debug-trace-bar {
  height: 8px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}

.debug-trace-segment.request {
  background: var(--brand-300);
}

.debug-trace-segment.parse {
  background: var(--brand-500);
}

.debug-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-3);
}

.debug-metric-card {
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: var(--sp-3);
  background: white;
}

.debug-metric-label {
  font-size: var(--text-xs);
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.debug-metric-value {
  margin-top: var(--sp-1);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.debug-empty {
  padding: var(--sp-4);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--gray-500);
}

.debug-eval-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.debug-eval-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  justify-content: space-between;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: var(--sp-2) var(--sp-3);
  background: white;
}

.debug-eval-text {
  flex: 1;
  min-width: 0;
  color: var(--gray-700);
  font-size: var(--text-sm);
  line-height: 1.4;
}

.debug-eval-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.debug-eval-badge.pass {
  background: var(--brand-50);
  color: var(--brand-700);
  border-color: var(--brand-200);
}

.debug-eval-badge.fail {
  background: var(--error-50);
  color: var(--error-600);
  border-color: var(--error-100);
}

.debug-eval-swatch {
  width: 36px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.debug-tab:focus-visible,
.debug-action-btn:focus-visible,
.debug-input:focus-visible,
.debug-log-details summary:focus-visible {
  outline: 2px solid var(--brand-300);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .debug-panel {
    max-height: 90vh;
  }

  .debug-panel-tabs {
    flex-wrap: wrap;
  }

  body.debug-drawer-open .container {
    transform: none;
  }
}

@media (pointer: coarse) {
  .settings-cog,
  .debug-button,
  .export-button,
  .node-control-btn,
  .panel-header-actions button,
  .panel-primary-action,
  .section-actions button,
  .item-actions button,
  .debug-action-btn,
  .import-close-btn,
  .export-option {
    min-width: 44px;
    min-height: 44px;
  }

  .node-emoji-button {
    width: max(calc(var(--emoji-size) * 1.1), 52px);
    height: max(calc(var(--emoji-size) * 1.1), 52px);
  }

  .quick-help-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .node,
  .node-content,
  .node-control-btn,
  .node-emoji-button,
  .notification,
  .export-dropdown,
  .detail-panel,
  .panel-overlay,
  .confirm-dialog,
  .confirm-dialog-overlay,
  .import-dialog,
  .import-dialog-overlay,
  .debug-panel,
  .debug-panel-overlay,
  .container {
    transition: none !important;
    animation: none !important;
  }

  .skeleton-line {
    animation: none !important;
    background: var(--gray-100) !important;
  }
}

.detail-panel-header {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.detail-panel-title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.detail-panel-title .node-emoji {
  font-size: 1.5em;
  line-height: 1;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--sp-2);
}

.panel-header-actions button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: white;
  color: var(--gray-600);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease-in-out;
  border: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.panel-header-actions button:hover {
  background: var(--gray-50);
  color: var(--brand-500);
  border-color: var(--brand-200);
}

.panel-header-actions .panel-primary-action {
  width: auto;
  min-height: 36px;
  padding: 0 var(--sp-3);
  border-radius: 8px;
  border-color: var(--brand-200);
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: var(--text-sm);
  font-weight: 600;
  gap: var(--sp-1);
}

.panel-header-actions .panel-primary-action:hover {
  background: var(--brand-100);
  color: var(--brand-700);
  border-color: var(--brand-300);
}

.panel-primary-action .material-icons-round {
  font-size: 18px;
}

.panel-primary-action-label {
  line-height: 1;
}

.panel-header-actions button:disabled,
.panel-primary-action:disabled,
.section-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  background: var(--gray-100);
  color: var(--gray-500);
  border-color: var(--gray-200);
}

.panel-header-actions button:disabled:hover,
.panel-primary-action:disabled:hover,
.section-actions button:disabled:hover {
  background: var(--gray-100);
  color: var(--gray-500);
  border-color: var(--gray-200);
}

.detail-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

.detail-panel-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.section-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.section-actions {
  display: flex;
  gap: var(--sp-2);
}

.section-actions button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: white;
  color: var(--gray-600);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease-in-out;
  border: 1px solid var(--gray-200);
}

.section-actions button:hover {
  background: var(--gray-50);
  color: var(--brand-500);
  border-color: var(--brand-200);
}

.section-content {
  color: var(--text-primary);
}

.objective-content {
  padding: var(--sp-4);
  background: var(--brand-50);
  border-radius: 8px;
  color: var(--brand-700);
  font-size: var(--text-base);
  line-height: 1.6;
}

.details-content {
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
}

.action-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.action-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-2);
  border-radius: 6px;
  transition: background 0.2s ease-out;
}

.action-item:hover {
  background: var(--gray-50);
}

.item-checkbox {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.item-text {
  flex: 1;
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-primary);
}

.item-actions {
  display: flex;
  gap: var(--sp-1);
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.action-item:hover .item-actions {
  opacity: 1;
}

.item-actions button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: white;
  color: var(--gray-600);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease-in-out;
  border: 1px solid var(--gray-200);
}

.item-actions button:hover {
  background: var(--gray-50);
  color: var(--brand-500);
  border-color: var(--brand-200);
}

.item-actions button .material-icons-round {
  font-size: 16px;
}

.empty-state {
  text-align: center;
  padding: var(--sp-8);
  color: var(--gray-400);
  font-size: var(--text-base);
}

.section-loading-state {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.section-loading-label {
  font-size: var(--text-sm);
  color: var(--gray-600);
  font-weight: 500;
}

.content-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.skeleton-line {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton-line.short {
  width: 72%;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.cheat-sheet-content {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.cheat-sheet-oneliner {
  padding: var(--sp-3);
  border-radius: 10px;
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 500;
  line-height: 1.5;
}

.cheat-sheet-block {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.cheat-sheet-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cheat-source-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--text-xs);
  color: var(--brand-700);
  background: var(--brand-100);
  border: 1px solid var(--brand-200);
}

.cheat-sheet-list {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.cheat-sheet-list-item {
  color: var(--text-primary);
  line-height: 1.5;
}

.cheat-sheet-related {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.cheat-sheet-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--gray-200);
  background: white;
  color: var(--gray-700);
  font-size: var(--text-sm);
  line-height: 1.3;
}

button.cheat-sheet-chip {
  cursor: pointer;
  transition: all 0.2s ease-out;
}

button.cheat-sheet-chip:hover {
  border-color: var(--brand-300);
  color: var(--brand-600);
  background: var(--brand-50);
}

.cheat-sheet-expansions {
  padding-top: var(--sp-2);
  border-top: 1px solid var(--gray-100);
}

.cheat-expand-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.cheat-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  border: 1px solid var(--gray-200);
  background: white;
  color: var(--gray-700);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.2s ease-out;
}

.cheat-expand-btn.active {
  border-color: var(--brand-300);
  color: var(--brand-700);
  background: var(--brand-50);
}

.cheat-expand-btn:hover {
  border-color: var(--brand-300);
  color: var(--brand-700);
}

.cheat-expand-btn.loading {
  opacity: 0.8;
}

.cheat-expand-paragraph {
  color: var(--text-primary);
  line-height: 1.6;
}

.cheat-qa-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.cheat-qa-item {
  padding: var(--sp-3);
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.cheat-qa-question {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.cheat-qa-answer {
  color: var(--gray-700);
  line-height: 1.5;
}

.cheat-expand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.cheat-export-btn {
  border: 1px solid var(--gray-200);
  background: white;
  color: var(--gray-700);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: var(--text-xs);
  cursor: pointer;
}

.cheat-export-btn:hover {
  border-color: var(--brand-300);
  color: var(--brand-700);
}

.cheat-flashcards {
  display: grid;
  gap: var(--sp-2);
}

.cheat-flashcard {
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
}

.cheat-flashcard-front {
  padding: var(--sp-3);
  font-weight: 600;
  color: var(--text-primary);
  background: var(--gray-50);
}

.cheat-flashcard-back {
  padding: var(--sp-3);
  color: var(--gray-700);
  line-height: 1.5;
}

.cheat-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-2);
}

.cheat-compare-col {
  padding: var(--sp-2);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-50);
}

.cheat-compare-heading {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: var(--sp-1);
}

.cheat-sheet-meta {
  font-size: var(--text-xs);
  color: var(--gray-500);
}

/* 🔔 Notification Styles */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease-out;
}

.notification-error {
  border-left: 4px solid var(--error-500);
}

.notification-info {
  border-left: 4px solid var(--brand-500);
}

/* 🔗 Link Styles */
.link {
  fill: none;
  stroke: var(--gray-200);
  stroke-width: 1.5;
  stroke-opacity: 0.4;
  transition: all 0.2s ease-out;
}

.link:hover {
  stroke: var(--brand-400);
  stroke-opacity: 0.8;
}

/* 📤 Export Dialog */
.export-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--sp-2);
  width: 280px;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.2s ease-out;
  z-index: 100;
}

.export-dropdown.active {
  opacity: 1;
  transform: translateY(0);
}

.export-option {
  width: 100%;
  border: none;
  border-radius: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  cursor: pointer;
  transition: all 0.2s ease-out;
}

.export-option:hover {
  background: var(--gray-50);
}

.export-option:focus-visible,
.import-dropzone:focus-visible,
.import-close-btn:focus-visible,
.node-control-btn:focus-visible,
.node-emoji-button:focus-visible,
.panel-header-actions button:focus-visible,
.panel-primary-action:focus-visible,
.section-actions button:focus-visible,
.item-actions button:focus-visible {
  outline: 2px solid var(--brand-300);
  outline-offset: 2px;
}

.export-option .material-icons-round {
  color: var(--gray-400);
}

.export-option-info {
  flex: 1;
}

.export-option-title {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.export-option-desc {
  font-size: var(--text-sm);
  color: var(--gray-500);
}

/* 🎭 Confirm Dialog */
.confirm-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.2s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-dialog-overlay.active {
  opacity: 1;
}

.confirm-dialog {
  width: min(400px, 90vw);
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.2s ease-out;
}

.confirm-dialog-overlay.active .confirm-dialog {
  transform: scale(1);
}

.confirm-dialog-header {
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  border-bottom: 1px solid var(--gray-200);
}

.confirm-dialog-header .material-icons-round {
  color: var(--error-500);
  font-size: 24px;
}

.confirm-dialog-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.confirm-dialog-message {
  padding: var(--sp-4);
  color: var(--gray-600);
  font-size: var(--text-base);
  line-height: 1.6;
}

.confirm-dialog-actions {
  padding: var(--sp-4);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  border-top: 1px solid var(--gray-200);
}

.confirm-dialog-btn {
  height: 40px;
  padding: 0 var(--sp-4);
  border: none;
  border-radius: 8px;
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  transition: all 0.2s ease-out;
}

.confirm-dialog-btn.cancel {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}

.confirm-dialog-btn.cancel:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

.confirm-dialog-btn.confirm {
  background: var(--error-500);
  color: white;
}

.confirm-dialog-btn.confirm:hover {
  background: var(--error-600);
}

/* 📥 Import Dialog */
.import-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.2s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

.import-dialog-overlay.active {
  opacity: 1;
}

.import-dialog {
  width: min(420px, 90vw);
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.2s ease-out;
}

.import-dialog-overlay.active .import-dialog {
  transform: scale(1);
}

.import-dialog-header {
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
}

.import-dialog-header h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.import-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease-out;
}

.import-close-btn:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.import-dialog-content {
  padding: var(--sp-4);
}

.import-dropzone {
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease-out;
  background: var(--gray-50);
}

.import-dropzone:hover,
.import-dropzone.dragover {
  border-color: var(--brand-500);
  background: var(--brand-50);
}

.import-dropzone .material-icons-round {
  font-size: 48px;
  color: var(--gray-400);
  margin-bottom: var(--sp-2);
}

.import-dropzone:hover .material-icons-round,
.import-dropzone.dragover .material-icons-round {
  color: var(--brand-500);
}

.import-dropzone p {
  margin: var(--sp-1) 0;
  color: var(--gray-600);
}

.import-hint {
  font-size: var(--text-sm);
  color: var(--gray-400);
}

.import-options {
  margin-top: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.import-option {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s ease-out;
}

.import-option:hover {
  background: var(--gray-50);
}

.import-option input[type="radio"] {
  accent-color: var(--brand-500);
}

.import-option span {
  color: var(--gray-700);
  font-size: var(--text-sm);
}

/* 🎛️ Settings Preset Buttons */
.settings-preset-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2);
}

.settings-preset-btn {
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: white;
  color: var(--gray-600);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-out;
  text-align: center;
}

.settings-preset-btn:hover {
  border-color: var(--brand-300);
  color: var(--brand-500);
  background: var(--brand-50);
}

.settings-preset-btn.active {
  border-color: var(--brand-500);
  color: var(--brand-600);
  background: var(--brand-50);
}

/* Settings group styling improvements */
.settings-group-presets {
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-2);
  border-bottom: 1px solid var(--gray-200);
} 