/* General Page Styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f3f4f6;
  color: #1f2937;
  padding: 1.5rem;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

header {
  margin-bottom: 1.5rem;
}

header h1 {
  font-size: 1.75rem;
  color: #4f46e5;
  margin-bottom: 0.25rem;
}

header p {
  color: #6b7280;
  font-size: 0.95rem;
}

/* Layout Grid */
.main-layout {
  display: flex;
  gap: 1.5rem;
  flex-grow: 1;
  min-height: 0; /* allows flex children to shrink */
}

/* Sidebar Editor Panel */
.sidebar {
  width: 300px;
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar h2 {
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
  color: #374151;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #4b5563;
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}

.form-group textarea {
  resize: vertical;
  min-height: 85px;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: 2px solid #4f46e5;
  border-color: transparent;
}

/* Buttons */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.btn {
  width: 100%;
  padding: 0.625rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary {
  background-color: #4f46e5;
  color: white;
}

.btn-primary:hover {
  background-color: #4338ca;
}

.btn-secondary {
  background-color: #e5e7eb;
  color: #374151;
}

.btn-secondary:hover {
  background-color: #d1d5db;
}

.btn-danger {
  background-color: #ef4444;
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.hidden {
  display: none !important;
}

/* SVG Canvas styling */
.canvas-container {
  flex-grow: 1;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
}

svg {
  user-select: none;
}

/* SVG Elements styles */
.timeline-axis {
  stroke: #d1d5db;
  stroke-width: 6;
  stroke-linecap: round;
}

.connector-line {
  stroke: #818cf8;
  stroke-width: 2;
  stroke-dasharray: 4;
}

.timeline-dot-handle {
  fill: #4f46e5;
  stroke: white;
  stroke-width: 3;
  cursor: ew-resize;
  transition: r 0.2s, fill 0.2s;
}

.timeline-dot-handle:hover {
  r: 12;
  fill: #4338ca;
}

.event-card-bg {
  fill: #ffffff;
  stroke: #e5e7eb;
  stroke-width: 1.5;
  rx: 8;
  cursor: move;
  transition: stroke 0.2s;
}

.event-group:hover .event-card-bg,
.event-group.selected .event-card-bg {
  stroke: #4f46e5;
  stroke-width: 2;
}

.event-title-text {
  font-size: 13px;
  font-weight: 600;
  fill: #1f2937;
  cursor: move;
}

.event-date-text {
  font-size: 11px;
  fill: #6b7280;
  cursor: move;
}

.dragging .timeline-dot-handle {
  fill: #ec4899;
}
.dragging .event-card-bg {
  stroke: #ec4899;
}
