/* ============================================
   CLAWSIGHT - Modern Clean Style (moltbook-inspired)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Main palette */
  --bg-dark: #1a1a1b;
  --bg-secondary: #2d2d2e;
  --bg-light: #fafafa;
  --bg-white: #ffffff;

  /* Accent colors */
  --accent-primary: #e01b24;
  --accent-primary-hover: #ff3b3b;
  --accent-primary-dark: #c41018;
  --accent-secondary: #00d4aa;
  --accent-secondary-hover: #00b894;
  --accent-blue: #4a9eff;
  --accent-gold: #ffd700;
  --accent-orange: #ff6b35;

  /* Text */
  --text-primary: #1a1a1b;
  --text-secondary: #7c7c7c;
  --text-muted: #888888;
  --text-dim: #555555;
  --text-white: #ffffff;

  /* Borders */
  --border-light: #e0e0e0;
  --border-dark: #333333;
  --border-darker: #444444;

  /* Fonts */
  --font-mono: 'IBM Plex Mono', monospace;

  /* Sizes */
  --header-height: 60px;
  --footer-height: 48px;
  --tree-width: 380px;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* ============================================
   Base Styles
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-light);
  display: flex;
  flex-direction: column;
}

::selection {
  background: var(--accent-secondary);
  color: var(--bg-dark);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ============================================
   Header
   ============================================ */

.header {
  height: var(--header-height);
  background: var(--bg-dark);
  border-bottom: 4px solid var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: relative;
  z-index: 100;
}

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

.logo-icon {
  width: 42px;
  height: 42px;
  color: var(--accent-primary);
  transition: transform 0.2s ease;
}

.logo-icon:hover {
  transform: scale(1.1) rotate(-5deg);
}

.claw-icon {
  filter: drop-shadow(0 2px 4px rgba(224, 27, 36, 0.3));
}

.logo-text h1 {
  font-family: Verdana, sans-serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--accent-primary);
  margin-bottom: 0;
}

.logo-text h1:hover {
  color: var(--accent-primary-hover);
}

.logo-text .subtitle {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo-text .subtitle::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent-secondary);
  border-radius: 50%;
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border: 1px solid var(--border-dark);
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  border-color: var(--accent-secondary);
  color: var(--text-white);
  background: var(--bg-secondary);
}

.btn-primary {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: var(--text-white);
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
  box-shadow: 0 4px 12px rgba(224, 27, 36, 0.3);
}

.btn-icon {
  color: inherit;
  font-weight: 400;
}

.panel-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: var(--radius-sm);
}

.panel-btn:hover {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
  background: rgba(0, 212, 170, 0.05);
}

/* ============================================
   Main Container
   ============================================ */

.main-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  height: calc(100vh - var(--header-height) - var(--footer-height));
}

/* ============================================
   Tree Panel
   ============================================ */

.tree-panel {
  width: var(--tree-width);
  min-width: 280px;
  max-width: 500px;
  background: var(--bg-white);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  resize: horizontal;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-dark);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-white);
}

.panel-controls {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.blink {
  color: var(--accent-secondary);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.search-container {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-white);
}

.search-prefix {
  color: var(--accent-secondary);
  margin-right: 8px;
  font-size: 14px;
  font-weight: 600;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.search-input:focus {
  color: var(--text-primary);
}

.tree-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
  background: var(--bg-white);
}

/* ============================================
   Tree Nodes
   ============================================ */

.tree-node {
  user-select: none;
}

.tree-item {
  display: flex;
  align-items: center;
  padding: 8px 12px 8px 8px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  min-height: 36px;
}

.tree-item:hover {
  background: var(--bg-light);
  border-left-color: var(--border-light);
}

.tree-item.active {
  background: rgba(0, 212, 170, 0.08);
  border-left-color: var(--accent-secondary);
}

.tree-item.active .tree-key {
  color: var(--accent-secondary);
  font-weight: 600;
}

.tree-toggle {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 10px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.tree-toggle.expanded {
  transform: rotate(90deg);
}

.tree-toggle.empty {
  visibility: hidden;
}

.tree-icon {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tree-icon.folder {
  color: var(--accent-primary);
}

.tree-icon.key {
  color: var(--accent-blue);
}

.tree-icon.array {
  color: var(--accent-secondary);
}

.tree-key {
  color: var(--text-primary);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-value-preview {
  margin-left: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.tree-value-preview.sensitive {
  color: var(--accent-primary);
  font-style: italic;
}

.tree-item.has-sensitive .tree-key {
  color: var(--accent-orange);
}

.tree-children {
  display: none;
}

.tree-children.expanded {
  display: block;
}

.tree-item.hidden {
  display: none;
}

.tree-item.match .tree-key {
  color: var(--accent-primary);
  font-weight: 600;
}

.tree-item.parent-of-match {
  background: rgba(74, 158, 255, 0.05);
  border-left-color: var(--accent-blue);
}

.tree-item.parent-of-match .tree-key {
  color: var(--accent-blue);
}

/* ============================================
   Detail Panel
   ============================================ */

.detail-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-light);
  overflow: hidden;
}

.detail-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* Welcome Message */
.welcome-message {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.ascii-art {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-primary);
  margin-bottom: 12px;
  line-height: 1.2;
  overflow-x: auto;
}

.ascii-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  text-align: center;
}

.ascii-subtitle a {
  color: var(--accent-secondary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.ascii-subtitle a:hover {
  color: var(--accent-primary);
  text-decoration: underline;
}

.twitter-cta {
  margin-bottom: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.twitter-cta a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  margin-left: 8px;
  background: var(--bg-dark);
  color: var(--text-white);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-dark);
  transition: all 0.2s ease;
}

.twitter-cta a:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(224, 27, 36, 0.3);
}

.twitter-icon {
  font-size: 14px;
  font-weight: 700;
}

/* Privacy Button */
.privacy-btn {
  background: transparent;
  border: 1px solid var(--border-dark);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.privacy-btn:hover {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
}

.modal-header-privacy {
  background: var(--accent-secondary);
}

.privacy-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.terminal-output {
  text-align: left;
  background: var(--bg-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 32px;
  font-size: 13px;
}

.terminal-output p {
  margin: 4px 0;
  color: var(--text-muted);
}

.terminal-output .prompt {
  color: var(--accent-secondary);
}

.terminal-output .output {
  color: var(--text-muted);
}

.terminal-output .highlight {
  color: var(--accent-primary);
  font-weight: 600;
}

.stats-container {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 20px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-white);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  color: var(--accent-primary);
  font-size: 24px;
  font-weight: 700;
}

.stat-item:nth-child(2) .stat-value {
  color: var(--accent-secondary);
}

.stat-item:nth-child(3) .stat-value {
  color: var(--accent-blue);
}

/* ============================================
   Detail View Content
   ============================================ */

.detail-section {
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  overflow: hidden;
}

.detail-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-dark);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-white);
  text-transform: uppercase;
}

.detail-section-content {
  padding: 16px;
}

.detail-path {
  font-size: 13px;
  color: var(--accent-secondary);
  margin-bottom: 16px;
  padding: 10px 14px;
  background: rgba(0, 212, 170, 0.08);
  border-left: 3px solid var(--accent-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-mono);
  word-break: break-all;
}

.detail-description {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}

.detail-type {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.type-badge {
  padding: 4px 12px;
  background: rgba(74, 158, 255, 0.1);
  border: 1px solid var(--accent-blue);
  color: var(--accent-blue);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.type-optional {
  color: var(--text-secondary);
  font-size: 12px;
}

.detail-values {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.value-option {
  padding: 6px 12px;
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.value-option.default {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
  background: rgba(0, 212, 170, 0.08);
}

.value-range {
  color: var(--text-secondary);
  font-size: 14px;
}

.detail-current {
  font-size: 14px;
  padding: 12px 16px;
  background: var(--bg-light);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
  word-break: break-all;
}

.detail-current.not-set {
  color: var(--text-secondary);
  font-style: italic;
}

.detail-current.is-set {
  color: var(--accent-secondary);
  border-color: var(--accent-secondary);
  border-style: solid;
  background: rgba(0, 212, 170, 0.05);
}

.detail-notes {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.detail-notes ul {
  margin-top: 8px;
  padding-left: 20px;
}

.detail-notes li {
  margin: 6px 0;
}

.detail-notes code {
  background: var(--bg-light);
  padding: 2px 6px;
  border: 1px solid var(--border-light);
  color: var(--accent-blue);
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.detail-example {
  background: var(--bg-dark);
  color: var(--accent-secondary);
  padding: 12px 16px;
  border-left: 3px solid var(--accent-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============================================
   Footer
   ============================================ */

.footer {
  height: var(--footer-height);
  background: var(--bg-dark);
  border-top: 1px solid var(--border-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  font-size: 12px;
  color: var(--text-muted);
  position: relative;
}

.footer-left,
.footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 10;
}

.footer-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
}

.separator {
  color: var(--border-dark);
}

.version {
  color: var(--text-secondary);
}

.status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-secondary);
  border-radius: 50%;
  animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.tagline {
  color: var(--text-muted);
  letter-spacing: 1px;
  font-size: 11px;
}

.timestamp {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

/* ============================================
   Remove CRT Effects (clean modern look)
   ============================================ */

.crt-overlay,
.scanlines,
.noise,
.vignette {
  display: none;
}

/* ============================================
   Error Modal
   ============================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: 90%;
  overflow: hidden;
  animation: modalSlide 0.2s ease;
}

@keyframes modalSlide {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--accent-primary);
  color: var(--text-white);
}

.modal-icon {
  font-size: 20px;
}

.modal-title {
  font-weight: 600;
  font-size: 16px;
  flex: 1;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-white);
  font-size: 24px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
  line-height: 1;
}

.modal-close:hover {
  opacity: 1;
}

.modal-body {
  padding: 20px;
}

.error-message {
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.error-line-container {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.error-line-number {
  background: var(--accent-primary);
  color: var(--text-white);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  min-width: 60px;
  text-align: center;
}

.error-line-content {
  flex: 1;
  background: var(--bg-light);
  border: none;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-primary);
  outline: none;
}

.modal-footer {
  padding: 16px 20px;
  background: var(--bg-light);
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--border-light);
}

/* ============================================
   Validation Warnings
   ============================================ */

.validation-warnings {
  margin-top: 24px;
  border: 1px solid var(--accent-orange);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  overflow: hidden;
}

.validation-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--accent-orange);
  color: var(--text-white);
  font-weight: 600;
  font-size: 13px;
}

.warning-icon {
  font-size: 16px;
}

.warning-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
}

.warning-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  line-height: 1.5;
}

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

.warning-item.warning-error {
  background: rgba(224, 27, 36, 0.05);
  border-left: 3px solid var(--accent-primary);
}

.warning-item.warning-warning {
  background: rgba(255, 107, 53, 0.05);
  border-left: 3px solid var(--accent-orange);
}

.warning-item.warning-tip {
  background: rgba(74, 158, 255, 0.05);
  border-left: 3px solid var(--accent-blue);
}

.warning-path {
  display: inline-block;
  background: var(--bg-dark);
  color: var(--accent-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  margin-right: 8px;
}

.warning-message {
  color: var(--text-primary);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 900px) {
  .main-container {
    flex-direction: column;
  }

  .tree-panel {
    width: 100%;
    max-width: none;
    height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    resize: vertical;
  }

  .logo-text h1 {
    font-size: 20px;
  }

  .footer-center {
    display: none;
  }
}

@media (max-width: 600px) {
  .header {
    padding: 0 12px;
    flex-wrap: wrap;
    height: auto;
    padding: 12px;
    gap: 12px;
  }

  .header-actions {
    width: 100%;
    justify-content: center;
  }

  .stats-container {
    flex-direction: column;
    gap: 16px;
  }

  .detail-content {
    padding: 16px;
  }
}
