/* === CYBERPUNK THEME === */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Orbitron:wght@400;700;900&display=swap');

:root {
  --cyber-bg: #0a0a0f;
  --cyber-surface: #12121a;
  --cyber-cyan: #00f0ff;
  --cyber-magenta: #ff00aa;
  --cyber-purple: #a855f7;
  --cyber-yellow: #facc15;
  --cyber-grid: rgba(0, 240, 255, 0.03);
  --glow-cyan: 0 0 20px rgba(0, 240, 255, 0.5), 0 0 40px rgba(0, 240, 255, 0.2);
  --glow-magenta: 0 0 20px rgba(255, 0, 170, 0.5), 0 0 40px rgba(255, 0, 170, 0.2);
  --sidebar-width: 260px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--cyber-bg);
  background-image:
    linear-gradient(var(--cyber-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--cyber-grid) 1px, transparent 1px);
  background-size: 50px 50px;
  min-height: 100vh;
  font-family: 'JetBrains Mono', monospace;
  color: #e0e0e0;
}

/* === SIDEBAR NAVIGATION === */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, rgba(12, 12, 18, 0.98) 0%, rgba(8, 8, 12, 0.99) 100%);
  border-right: 1px solid rgba(0, 240, 255, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}

.sidebar__header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.05) 0%, transparent 100%);
}

.sidebar__logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  font-weight: 900;
  color: var(--cyber-cyan);
  text-shadow: var(--glow-cyan);
  letter-spacing: 2px;
}

.sidebar__version {
  font-size: 11px;
  color: var(--cyber-magenta);
  background: rgba(255, 0, 170, 0.15);
  padding: 3px 8px;
  border: 1px solid rgba(255, 0, 170, 0.3);
}

.sidebar__title {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--cyber-purple);
  padding: 12px 20px 8px;
  border-bottom: 1px solid rgba(168, 85, 247, 0.2);
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  list-style: none;
  margin: 0;
  padding: 8px 0;
  display: block;
}

.sidebar__item {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  border-left: none;
}

.sidebar__item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  text-decoration: none;
  color: #a0a0a0;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.sidebar__item a:hover {
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.1) 0%, transparent 100%);
  color: var(--cyber-cyan);
  border-left-color: var(--cyber-cyan);
}

.sidebar__item--active a {
  background: linear-gradient(90deg, rgba(255, 0, 170, 0.15) 0%, transparent 100%);
  color: var(--cyber-magenta);
  border-left-color: var(--cyber-magenta);
}

.sidebar__item--active a:hover {
  background: linear-gradient(90deg, rgba(255, 0, 170, 0.2) 0%, transparent 100%);
  color: var(--cyber-magenta);
  border-left-color: var(--cyber-magenta);
}

.sidebar__item-index {
  font-size: 11px;
  font-weight: 700;
  color: var(--cyber-yellow);
  min-width: 22px;
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.4);
}

.sidebar__item-title {
  font-size: 12px;
  line-height: 1.3;
}

.sidebar__footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(0, 240, 255, 0.2);
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.03) 0%, transparent 100%);
}

.sidebar__footer a {
  font-size: 11px;
  color: var(--cyber-cyan);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar__footer a::before {
  content: '◆';
  font-size: 8px;
}

.sidebar__footer a:hover {
  color: var(--cyber-magenta);
  text-shadow: var(--glow-magenta);
}

/* === MAIN CONTENT === */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 20px 30px;
  min-height: 100vh;
}

/* Nav links (prev/next) */
.nav-links {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-links li {
  background: linear-gradient(135deg, rgba(18, 18, 26, 0.9) 0%, rgba(10, 10, 15, 0.95) 100%);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-left: 3px solid var(--cyber-cyan);
  padding: 8px 14px;
  font-size: 13px;
  transition: all 0.2s ease;
}

.nav-links li:hover {
  border-color: var(--cyber-magenta);
  border-left-color: var(--cyber-magenta);
  box-shadow: var(--glow-magenta);
}

.nav-links li a {
  color: #c0c0c0;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-links li a:hover {
  color: var(--cyber-magenta);
}

.nav-links li b {
  color: var(--cyber-yellow);
  margin-right: 5px;
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.6);
}

/* Responsive: collapse sidebar on small screens */
@media (max-width: 900px) {
  .sidebar {
    width: 60px;
    --sidebar-width: 60px;
  }

  .sidebar__header {
    padding: 12px;
    justify-content: center;
  }

  .sidebar__version,
  .sidebar__title,
  .sidebar__item-title,
  .sidebar__footer a span {
    display: none;
  }

  .sidebar__logo {
    font-size: 14px;
    letter-spacing: 0;
  }

  .sidebar__item a {
    justify-content: center;
    padding: 12px 8px;
  }

  .sidebar__item-index {
    min-width: auto;
  }

  .sidebar__footer {
    text-align: center;
    padding: 12px 8px;
  }

  .sidebar__footer a::before {
    display: none;
  }

  .sidebar__footer a::after {
    content: '⬡';
    font-size: 16px;
  }

  .main-content {
    margin-left: 60px;
    padding: 15px 20px;
  }
}

#content {
  width: 100%;
}

/* === HEADINGS & NAVIGATION === */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.3);
}

h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--cyber-cyan);
  text-shadow: var(--glow-cyan);
  letter-spacing: 1px;
  margin: 0;
}

.version-badge {
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--cyber-magenta);
  background: rgba(255, 0, 170, 0.15);
  padding: 6px 12px;
  border: 1px solid rgba(255, 0, 170, 0.4);
  text-decoration: none;
  text-shadow: 0 0 10px rgba(255, 0, 170, 0.5);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.version-badge:hover {
  color: var(--cyber-yellow);
  border-color: var(--cyber-yellow);
  background: rgba(250, 204, 21, 0.15);
  text-shadow: 0 0 15px rgba(250, 204, 21, 0.7);
}

p {
  color: #a0a0a0;
  line-height: 1.6;
  margin-bottom: 15px;
  padding-left: 12px;
  border-left: 2px solid rgba(168, 85, 247, 0.4);
}

p code {
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid var(--cyber-purple);
  padding: 2px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--cyber-purple);
}

/* === LAYOUT JSON PANEL === */
.layoutJSON {
  background: linear-gradient(135deg, rgba(18, 18, 26, 0.95) 0%, rgba(10, 10, 15, 0.98) 100%);
  border: 1px solid var(--cyber-cyan);
  border-left: 4px solid var(--cyber-magenta);
  margin-top: 30px;
  padding: 5px 20px 10px;
  position: relative;
  font-family: 'JetBrains Mono', monospace;
  box-shadow:
    var(--glow-cyan),
    inset 0 0 60px rgba(0, 240, 255, 0.03);
  margin-bottom: 10px;
}

.layoutJSON::before {
  content: '◢ GRID_MATRIX';
  position: absolute;
  top: -12px;
  left: 20px;
  background: var(--cyber-bg);
  padding: 2px 12px;
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--cyber-cyan);
  text-shadow: var(--glow-cyan);
  z-index: 1;
}

/* Collapsible toggle - checkbox hidden, label styled as corner */
.layoutJSON__checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.layoutJSON__toggle {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, transparent 50%, var(--cyber-magenta) 50%);
  box-shadow: var(--glow-magenta);
  cursor: pointer;
  z-index: 2;
  transition: all 0.2s ease;
}

.layoutJSON__toggle:hover {
  background: linear-gradient(135deg, transparent 50%, var(--cyber-yellow) 50%);
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.5), 0 0 40px rgba(250, 204, 21, 0.2);
}

/* Collapsed state - pure CSS via :checked */
.layoutJSON__checkbox:checked ~ .columns,
.layoutJSON__checkbox:checked ~ .layoutItem,
.layoutJSON__checkbox:checked ~ code,
.layoutJSON__checkbox:checked ~ br {
  display: none;
}

.layoutJSON:has(.layoutJSON__checkbox:checked) {
  padding: 13px 20px;
}

.layoutJSON:has(.layoutJSON__checkbox:checked)::before {
  content: '◢ GRID_MATRIX [collapsed]';
}

.layoutJSON:has(.layoutJSON__checkbox:checked) .layoutJSON__toggle {
  background: linear-gradient(135deg, transparent 50%, var(--cyber-cyan) 50%);
  box-shadow: var(--glow-cyan);
}

.layoutJSON > code {
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid var(--cyber-purple);
  padding: 3px 10px;
  margin: 0 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--cyber-purple);
  text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.layoutJSON__footnote {
  font-size: 10px;
  color: #666;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 240, 255, 0.1);
}

.layoutJSON__footnote code {
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.3);
  padding: 1px 5px;
  font-size: 9px;
  color: var(--cyber-purple);
}

.layoutJSON__checkbox:checked ~ .layoutJSON__footnote {
  display: none;
}

.columns {
  -moz-columns: 180px;
  -webkit-columns: 180px;
  columns: 180px;
  margin-top: 15px;
  column-gap: 15px;
  max-height: 200px;
  overflow-y: auto;
}

.layoutItem {
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.08) 0%, transparent 100%);
  border-left: 2px solid var(--cyber-cyan);
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  transition: all 0.2s ease;
  position: relative;
  break-inside: avoid;
  white-space: nowrap;
}

.layoutItem:hover {
  background: linear-gradient(90deg, rgba(255, 0, 170, 0.15) 0%, transparent 100%);
  border-left-color: var(--cyber-magenta);
  transform: translateX(4px);
  box-shadow: var(--glow-magenta);
}

.layoutItem b {
  color: var(--cyber-yellow);
  font-weight: 700;
  font-size: 12px;
  text-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
}

/* === GRID LAYOUT === */
.react-grid-layout {
  background: var(--cyber-surface);
  margin-top: 10px;
  border: 1px solid rgba(0, 240, 255, 0.2);
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
}

.react-grid-item {
  box-sizing: border-box;
}

.react-grid-item:not(.react-grid-placeholder) {
  background: linear-gradient(145deg, rgba(18, 18, 26, 0.9) 0%, rgba(30, 30, 45, 0.9) 100%);
  border: 1px solid var(--cyber-cyan);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 4px 20px rgba(0, 0, 0, 0.5);
  transition: transform 200ms ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.react-grid-item.react-draggable-dragging,
.react-grid-item.resizing {
  transition: none !important;
}

.react-grid-item:not(.react-grid-placeholder):hover {
  border-color: var(--cyber-magenta);
  box-shadow:
    var(--glow-magenta),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.react-grid-item.resizing {
  opacity: 0.9;
  border-color: var(--cyber-yellow);
  box-shadow: 0 0 30px rgba(250, 204, 21, 0.4);
}

.react-grid-item.static {
  background: linear-gradient(145deg, rgba(168, 85, 247, 0.2) 0%, rgba(100, 50, 150, 0.2) 100%);
  border-color: var(--cyber-purple);
}

.react-grid-item .text {
  font-family: 'Orbitron', sans-serif;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
  height: 24px;
  color: var(--cyber-cyan);
  text-shadow: var(--glow-cyan);
}

.react-grid-item .minMax {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--cyber-purple);
}

.react-grid-item .add {
  cursor: pointer;
  color: var(--cyber-magenta);
}

.react-grid-dragHandleExample {
  cursor: grab;
  display: block;
}

/* === RESIZE HANDLES === */
.react-grid-item > .react-resizable-handle::after {
  border-right: 2px solid var(--cyber-cyan) !important;
  border-bottom: 2px solid var(--cyber-cyan) !important;
  width: 7px;
  height: 7px;
  filter: drop-shadow(0 0 4px var(--cyber-cyan));
}

.react-grid-item:hover > .react-resizable-handle::after {
  border-color: var(--cyber-magenta) !important;
  filter: drop-shadow(0 0 6px var(--cyber-magenta));
}

.react-grid-item > .react-resizable-handle:hover::after {
  border-color: var(--cyber-yellow) !important;
  filter: drop-shadow(0 0 8px var(--cyber-yellow));
  width: 9px;
  height: 9px;
}

/* === TOOLBOX === */
.toolbox {
  background: linear-gradient(180deg, rgba(18, 18, 26, 0.95) 0%, rgba(10, 10, 15, 0.98) 100%);
  border: 1px solid var(--cyber-purple);
  border-top: 3px solid var(--cyber-magenta);
  width: 100%;
  height: 120px;
  overflow: scroll;
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.2);
}

.hide-button {
  cursor: pointer;
  position: absolute;
  font-size: 20px;
  top: 0px;
  right: 5px;
  color: var(--cyber-magenta);
  text-shadow: var(--glow-magenta);
  transition: all 0.2s ease;
}

.hide-button:hover {
  color: var(--cyber-cyan);
  text-shadow: var(--glow-cyan);
}

.toolbox__title {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--cyber-cyan);
  text-shadow: var(--glow-cyan);
  letter-spacing: 2px;
}

.toolbox__items {
  display: block;
}

.toolbox__items__item {
  display: inline-block;
  text-align: center;
  line-height: 40px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  padding: 10px;
  margin: 5px;
  border: 1px solid var(--cyber-cyan);
  background: linear-gradient(145deg, rgba(0, 240, 255, 0.1) 0%, transparent 100%);
  color: var(--cyber-cyan);
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  transition: all 0.2s ease;
}

.toolbox__items__item:hover {
  border-color: var(--cyber-magenta);
  background: linear-gradient(145deg, rgba(255, 0, 170, 0.2) 0%, transparent 100%);
  color: var(--cyber-magenta);
  box-shadow: var(--glow-magenta);
  transform: scale(1.1);
}

/* === DROPPABLE === */
.droppable-element {
  width: 150px;
  text-align: center;
  background: linear-gradient(145deg, rgba(255, 0, 170, 0.15) 0%, rgba(168, 85, 247, 0.1) 100%);
  border: 1px dashed var(--cyber-magenta);
  margin: 10px 0;
  padding: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--cyber-magenta);
  transition: all 0.3s ease;
  animation: pulse-border 2s infinite;
}

.droppable-element:hover {
  border-style: solid;
  box-shadow: var(--glow-magenta);
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--cyber-magenta); }
  50% { border-color: var(--cyber-cyan); }
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--cyber-cyan), var(--cyber-magenta));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--cyber-magenta), var(--cyber-cyan));
}

/* === CYBERPUNK BUTTONS === */
button {
  position: relative;
  padding: 12px 24px;
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cyber-cyan);
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.1) 0%, rgba(18, 18, 26, 0.95) 50%, rgba(0, 240, 255, 0.05) 100%);
  border: 1px solid var(--cyber-cyan);
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  margin: 5px;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

button::after {
  content: '▶';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8px;
  opacity: 0;
  transition: all 0.3s ease;
  color: var(--cyber-magenta);
}

button:hover {
  color: var(--cyber-magenta);
  border-color: var(--cyber-magenta);
  box-shadow:
    var(--glow-magenta),
    inset 0 0 30px rgba(255, 0, 170, 0.1);
  text-shadow: 0 0 10px rgba(255, 0, 170, 0.5);
  padding-right: 35px;
}

button:hover::before {
  left: 100%;
}

button:hover::after {
  opacity: 1;
  right: 15px;
}

button:active {
  transform: scale(0.98);
  box-shadow:
    0 0 10px rgba(255, 0, 170, 0.8),
    inset 0 0 20px rgba(255, 0, 170, 0.2);
}

/* Corner accents for buttons */
button span.corner-tl,
button span.corner-br {
  position: absolute;
  width: 6px;
  height: 6px;
  border: 1px solid var(--cyber-yellow);
}

button span.corner-tl {
  top: 3px;
  left: 3px;
  border-right: none;
  border-bottom: none;
}

button span.corner-br {
  bottom: 3px;
  right: 3px;
  border-left: none;
  border-top: none;
}

/* Secondary button variant */
button.secondary {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.1) 0%, rgba(18, 18, 26, 0.95) 50%, rgba(168, 85, 247, 0.05) 100%);
  border-color: var(--cyber-purple);
  color: var(--cyber-purple);
}

button.secondary:hover {
  border-color: var(--cyber-yellow);
  color: var(--cyber-yellow);
  box-shadow:
    0 0 20px rgba(250, 204, 21, 0.5),
    inset 0 0 30px rgba(250, 204, 21, 0.1);
  text-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
}

/* Glitch effect on focus */
button:focus {
  outline: none;
  animation: glitch 0.3s ease;
}

@keyframes glitch {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}
