:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #0ea5e9;
  --border: #334155;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

body.light-mode {
  --bg: #f8fafc;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --border: #e2e8f0;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-main);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 2rem 1rem;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(to right, var(--accent), #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

header p {
  color: var(--muted);
  margin-top: 0.5rem;
  font-size: 1.1rem;
}

main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  width: 100%;
  display: grid;
  gap: 2rem;
  flex: 1;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.panel:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border-color: #475569;
}

h2 {
  margin-top: 0;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}

h2::before {
  content: '';
  display: block;
  width: 4px;
  height: 1.25rem;
  background: var(--accent);
  border-radius: 2px;
}

.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: border-color 0.2s;
  font-size: 0.9rem;
  color: var(--muted);
}

label:hover {
  border-color: var(--border);
}

label:has(input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
}

input[type="text"],
input[type="number"] {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  width: 100%;
}

input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

/* File Input Styling */
input[type="file"] {
  width: 100%;
  padding: 2rem;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--muted);
}

input[type="file"]:hover {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.05);
}

button {
  background: var(--accent);
  color: #0f172a;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--border);
  color: var(--muted);
}

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.view-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
}

.view-tabs button {
  background: transparent;
  color: var(--muted);
  border-radius: 8px 8px 0 0;
  padding: 0.75rem 1.5rem;
}

.view-tabs button.active {
  background-color: var(--bg);
  color: var(--accent);
  border: 1px solid var(--border);
  border-bottom-color: var(--bg);
  margin-bottom: -1px;
}

.view-tabs button:hover:not(.active) {
  color: var(--text);
  background-color: rgba(255,255,255,0.05);
}

#treeView, #jsonView {
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-height: 600px;
  overflow: auto;
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

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

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}
input[type="text"], input[type="number"] {
  flex: 1;
  background: #0a1124;
  color: var(--text);
  border: 1px solid #1b2747;
  border-radius: 8px;
  padding: 8px 10px;
}
button {
  border: 1px solid #1b2747;
  background: #0b1226;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}
button:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(96,165,250,0.15); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
#stats { color: var(--muted); }

.view-tabs { display: flex; gap: 8px; margin: 8px 0 12px; }
.view-tabs button {
  background: #0b1226;
  border: 1px solid #1b2747;
  padding: 8px 12px;
  border-radius: 8px;
}
.view-tabs button.active { border-color: var(--accent); }

.output {
  background: #0a1124;
  border: 1px solid #1b2747;
  border-radius: 12px;
  padding: 12px;
  max-height: 60vh;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
}
.hidden { display: none; }

/* Vue arborescente */
.treeView { display: block; }
.tree-actions { display: flex; gap: 8px; margin-bottom: 8px; }

.tree {
  background: #0a1124;
  border: 1px solid #1b2747;
  border-radius: 12px;
  padding: 10px 12px;
  max-height: 60vh;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.tree details { margin-left: 18px; }
.tree details > summary {
  cursor: pointer;
  list-style: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tree summary::-webkit-details-marker { display: none; }
.tree .folder::before {
  content: "📁";
  display: inline-block;
}
.tree .file::before {
  content: "📄";
  display: inline-block;
}
.tree .meta {
  color: var(--muted);
  margin-left: 8px;
}
.tree .badge {
  border: 1px solid #1b2747;
  border-radius: 6px;
  padding: 1px 6px;
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
  background: #09112a;
}
