* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    padding: 0;
    margin: 0;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: white;
}

header {
    padding: 15px 20px;
    border-bottom: 2px solid #333;
    flex-shrink: 0;
}

h1 {
    color: #333;
    font-size: 1.5em;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.controls {
    display: flex;
    flex-direction: column;
    width: 280px;
    background-color: #f9f9f9;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    flex-shrink: 0;
}

.form-section, .selection-controls, .data-controls {
    padding: 15px;
    border-bottom: 1px solid #ddd;
}

.form-section h2, .selection-controls h3, .data-controls h3 {
    margin-bottom: 12px;
    color: #555;
    font-size: 1em;
    font-weight: bold;
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    margin-bottom: 3px;
    font-weight: bold;
    color: #555;
    font-size: 12px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4CAF50;
}

.color-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 5px;
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.2s, transform 0.1s;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.selected {
    border-color: #333;
    box-shadow: 0 0 0 1px white, 0 0 0 3px #333;
}

.form-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

button {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.3s;
    width: 100%;
}

button[type="submit"] {
    background-color: #4CAF50;
    color: white;
}

button[type="submit"]:hover {
    background-color: #45a049;
}

#cancel-btn,
#deselect-btn,
#move-up-btn,
#move-down-btn,
#export-btn,
#import-btn {
    background-color: #e0e0e0;
    color: #333;
}

#cancel-btn:hover,
#deselect-btn:not(:disabled):hover,
#move-up-btn:not(:disabled):hover,
#move-down-btn:not(:disabled):hover,
#export-btn:hover,
#import-btn:hover {
    background-color: #d0d0d0;
}

#delete-btn {
    background-color: #f44336;
    color: white;
}

#delete-btn:hover {
    background-color: #da190b;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.selection-controls {
    display: flex;
    flex-direction: column;
}

.selection-controls p {
    margin-bottom: 10px;
    color: #666;
    font-size: 11px;
    line-height: 1.4;
}

.selection-controls button,
.data-controls button {
    margin-bottom: 6px;
}

.timeline-container {
    flex: 1;
    overflow: auto;
    background-color: #fafafa;
}

#timeline-svg {
    display: block;
    min-width: 100%;
}

/* SVG Styles */
.entity-rect {
    stroke: #333;
    stroke-width: 2;
    cursor: pointer;
    transition: opacity 0.2s;
}

.entity-rect:hover {
    opacity: 0.8;
}

.entity-rect.selected {
    stroke: #F57C00;
    stroke-width: 4;
    filter: brightness(1.1);
}

.entity-rect.contiguous {
    stroke-width: 1;
}

.entity-label {
    font-size: 16px;
    fill: white;
    pointer-events: none;
    user-select: none;
}

.entity-dates {
    font-size: 13px;
    fill: white;
    pointer-events: none;
    user-select: none;
}

.timeline-axis {
    stroke: #333;
    stroke-width: 2;
}

.year-marker {
    stroke: #666;
    stroke-width: 1;
}

.year-label {
    font-size: 11px;
    fill: #333;
    text-anchor: middle;
}

.selection-rect {
    fill: rgba(33, 150, 243, 0.2);
    stroke: #2196F3;
    stroke-width: 1;
    stroke-dasharray: 5,5;
    pointer-events: none;
}
