/* =====================
Reset / Base
===================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

/* =====================
Variables
===================== */
:root {
  --bg: #0a0a0f;
  --bg-subtle: #12121a;
  --fg: #e8e8ed;
  --fg-muted: #6b6b7b;
  --accent: #ff6b6b;
  --accent-2: #4ecdc4;
  --accent-3: #ffe66d;
  --accent-4: #a78bfa;
  --panel-bg: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --highlight-glow: 0 0 20px rgba(255, 107, 107, 0.4);
  --sidebar-width: 320px;
}

/* =====================
Layout
===================== */
html {
  height: 100%;
}

body {
  min-height: 100%;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  background: var(--bg);
  color: var(--fg);
  background-image: 
    radial-gradient(ellipse at top, rgba(167, 139, 250, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(255, 107, 107, 0.05) 0%, transparent 50%);
}

.layout {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  min-height: 100vh;
}

.main {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* =====================
Header
===================== */
.header {
  text-align: center;
}

.header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-4) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  margin: 0.5rem 0 0;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* =====================
Info Panel
===================== */
.info-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  backdrop-filter: blur(10px);
}

.info-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.label {
  color: var(--fg-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.value {
  font-size: 0.9rem;
  color: var(--accent-2);
  font-weight: 500;
}

#element-tag {
  color: var(--accent);
}

#element-class {
  color: var(--accent-3);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#element-id {
  color: var(--accent-4);
}

/* =====================
Playground
===================== */
.playground {
  position: relative;
  width: min(600px, 90vw);
  height: 350px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.box {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.box span {
  pointer-events: none;
}

.box:hover {
  transform: scale(1.02);
}

.box-1 {
  top: 30px;
  left: 30px;
  width: 140px;
  height: 140px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
  color: white;
  box-shadow: 0 8px 32px rgba(255, 107, 107, 0.3);
}

.box-2 {
  top: 60px;
  left: 120px;
  width: 160px;
  height: 120px;
  background: linear-gradient(135deg, #4ecdc4 0%, #44b8b0 100%);
  color: white;
  box-shadow: 0 8px 32px rgba(78, 205, 196, 0.3);
  z-index: 1;
}

.box-3 {
  top: 180px;
  right: 40px;
  width: 180px;
  height: 130px;
  background: linear-gradient(135deg, #5c7cfa 0%, #4c6ef5 100%);
  color: white;
  box-shadow: 0 8px 32px rgba(92, 124, 250, 0.3);
}

.box-4 {
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 100px;
  background: linear-gradient(135deg, #a78bfa 0%, #9775fa 100%);
  color: white;
  box-shadow: 0 8px 32px rgba(167, 139, 250, 0.3);
}

.box-4:hover {
  transform: translateX(-50%) scale(1.02);
}

.nested {
  position: absolute;
  bottom: -15px;
  right: -15px;
  width: 70px;
  height: 50px;
  background: linear-gradient(135deg, #ffe66d 0%, #ffd43b 100%);
  color: #333;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(255, 230, 109, 0.4);
}

/* =====================
Highlight Effect
===================== */
.highlighted {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  box-shadow: var(--highlight-glow) !important;
}

/* =====================
Pointer Events Demo
===================== */
.no-pointer {
  pointer-events: none;
  opacity: 0.5;
}

.no-pointer::after {
  content: 'pointer-events: none';
  position: absolute;
  bottom: 5px;
  font-size: 0.6rem;
  opacity: 0.8;
}

/* =====================
Footer
===================== */
.footer {
  margin-top: auto;
}

.btn {
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.75rem 1.5rem;
  background: var(--panel-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  color: var(--accent);
}

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

/* =====================
Sidebar
===================== */
.sidebar {
  background: var(--bg-subtle);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-2);
}

.sidebar-header p {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--fg-muted);
}

/* =====================
Click Output
===================== */
.click-output {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  height: 200px;
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.empty-icon {
  font-size: 2rem;
  opacity: 0.5;
}

.click-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--panel-bg);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.click-coords {
  font-size: 0.8rem;
  color: var(--accent);
}

.click-count {
  font-size: 0.7rem;
  color: var(--fg-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.entries-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.element-entry {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  animation: slideIn 0.3s ease forwards;
  opacity: 0;
  transform: translateX(10px);
}

@keyframes slideIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.entry-index {
  font-size: 0.65rem;
  color: var(--fg-muted);
  background: rgba(255, 255, 255, 0.05);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}

.entry-content {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1.4;
}

.entry-tag {
  color: var(--accent);
  font-weight: 600;
}

.entry-id {
  color: var(--accent-4);
}

.entry-class {
  color: var(--accent-3);
  word-break: break-all;
}

/* =====================
Responsive
===================== */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  
  .sidebar {
    height: auto;
    max-height: 40vh;
    border-left: none;
    border-top: 1px solid var(--border);
    position: static;
  }
}
