:root {
  --background: #fbfcfd;
  --border: #dcdfe3;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-sans: system-ui, -apple-system, sans-serif;
  --primary: #4a63c8;
  --radius: 6px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --surface-gradient: #e9ecef;
  --surface: #ffffff;
  --text-primary: #2f3a48;
  --text-secondary: #fbfbfb;
  --timeline-application: #2ea44f;
  --timeline-beans: #8b5cf6;
  --timeline-context: #004b8d;
  --timeline-startup: #7c8a95;
  --timeline-web: #d29800;
}

body {
  background: var(--background);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
}

.container {
  background: var(--surface);
  border-radius: var(--radius);
  box-sizing: border-box;
  font-family: var(--font-sans);
  margin: 0 auto;
  max-width: 1400px;
  padding: 20px;
}

/* Timeline Container */
#timeline {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  padding-top: 30px;
  position: relative;
}

/* Timeline Wrapper */
#timeline-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: 280px 1fr;
  margin: 10px 0;
  overflow-y: auto;
}

/* Names Column */
#timeline-names {
  background: var(--surface);
  border-right: 1px solid var(--border);
  color: var(--text-primary);
  font-family: monospace;
  font-size: 10px;
  min-width: 250px;
  top: 0;
  flex-direction: column;
}

/* Timeline Lines Column */
#timeline-lines {
  min-height: 200px;
  position: relative;
  flex-direction: column;
}

/* Column Headers */
.column-header {
  align-items: center;
  background: var(--primary);
  color: #fff;
  display: flex;
  font-size: 14px;
  font-weight: 600;
  height: 56px;
  padding: 0;
  top: 0;
  z-index: 2;
}

#timeline-names .column-header {
  padding-left: 10px;
}

#timeline-lines .column-header {
  overflow: hidden;
  padding: 0;
}

/* Timeline Ruler */
#timeline-ruler-header {
  position: relative;
}

.timeline-ruler {
  border-bottom: 1px solid var(--border);
  height: 25px;
  left: 0;
  position: absolute;
  right: 0;
  top: 40px;
}

/* Time Markers */
.time-marker {
  border-left: 1px solid var(--border);
  height: 100%;
  position: absolute;
  top: 0;
  width: 1px;
}

.time-marker span {
  color: var(--text-secondary);
  font-size: 9px;
  position: absolute;
  top: 30%;
  transform-origin: left top;
  transform: rotate(-45deg);
  white-space: nowrap;
}

/* Timeline Rows & Items */
.timeline-row {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 25px;
  overflow-x: auto;
  position: relative;
}

.timeline-item {
  border-radius: var(--radius);
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  height: 20px;
  margin: 2px 0;
  position: absolute;
  transition: all 0.2s ease;
}

.timeline-item:hover {
  background-color: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

/* Timeline Item Colors */
.timeline-item.application {
  background: var(--timeline-application);
}
.timeline-item.context {
  background: var(--timeline-context);
}
.timeline-item.beans {
  background: var(--timeline-beans);
}
.timeline-item.web {
  background: var(--timeline-web);
}
.timeline-item.startup {
  background: var(--timeline-startup);
}

/* Timeline Labels & Duration */
.timeline-label {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  max-width: 200px;
  overflow: hidden;
  position: absolute;
  right: calc(100% + 10px);
  text-align: right;
  text-overflow: ellipsis;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
}

.timeline-duration {
  color: var(--text-primary);
  font-family: monospace;
  font-size: 12px;
  left: calc(100% + 5px);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

/* Tooltip */
.tooltip {
  background: var(--text-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--background);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  max-width: 300px;
  padding: 8px 12px;
  pointer-events: none;
  position: absolute;
  transform: translate(var(--tooltip-x), var(--tooltip-y));
  white-space: nowrap;
  z-index: 1000;
}

/* Data & Upload Sections */
.data-section {
  background: linear-gradient(
    135deg,
    var(--surface) 0%,
    var(--surface-gradient) 100%
  );
  border-radius: var(--radius);
  border: 2px dashed var(--border);
  margin: 24px 0;
  padding: 32px;
  text-align: center;
}

.upload-label {
  color: var(--text-primary);
  display: block;
  font-size: 16px;
  margin-bottom: 10px;
}

#jsonFile {
  border-radius: 3px;
  border: 1px solid var(--border);
  margin: 5px auto;
}

/* Timeline Header */
.timeline-header {
  background: var(--primary);
  border-radius: var(--radius);
  color: var(--text-primary);
  display: flex;
  font-size: 13px;
  gap: 20px;
  margin: 10px 0 20px 250px;
  padding: 10px;
}

/* Names Column Labels */
.name-label {
  color: var(--text-primary);
  padding: 4px 10px;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 260px;
}

.collapsed {
  display: none;
}

/* Metadata Section */
#metadata-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.metadata-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.metadata-item {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
}

.metadata-label {
  color: var(--text-primary);
  font-size: 12px;
  margin-bottom: 4px;
}

.metadata-value {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
}

/* Input & JSON Editor */
.input-section {
  align-items: flex-start;
  display: flex;
  gap: 20px;
}

.json-editor {
  box-sizing: border-box;
  width: 100%;
}

.json-editor textarea {
  border-radius: 4px;
  border: 1px solid var(--border);
  box-sizing: border-box;
  font-family: var(--font-mono);
  height: 200px;
  padding: 10px;
  resize: vertical;
  width: 100%;
}

/* Intro Section */
.intro-section {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 20px 0;
  padding: 20px;
}

/* Legend */
.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.legend-item {
  align-items: center;
  display: flex;
  font-size: 14px;
  gap: 8px;
}

.legend-color {
  border-radius: var(--radius);
  height: 20px;
  width: 20px;
}

.legend-color.application {
  background: var(--timeline-application);
}
.legend-color.context {
  background: var(--timeline-context);
}
.legend-color.beans {
  background: var(--timeline-beans);
}
.legend-color.web {
  background: var(--timeline-web);
}
.legend-color.startup {
  background: var(--timeline-startup);
}

/* Instruction Text */
.instruction-text {
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 15px;
}

/* Filter Section */
.filter-section {
  margin: 10px 0;
  display: flex;
  gap: 10px;
}
