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

body {
    font-family: Arial, sans-serif;
    padding: 0;
    background-color: #f5f5f5;
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: #f5f5f5;
    padding: 20px;
    margin-bottom: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #333;
    margin-bottom: 15px;
}

.controls {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.controls-left {
    display: flex;
    gap: 10px;
}

.controls-right {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

button:hover {
    background-color: #45a049;
}

button.secondary {
    background-color: #008CBA;
}

button.secondary:hover {
    background-color: #007399;
}

button.primary {
    background-color: #673AB7;
}

button.primary:hover {
    background-color: #5E35B1;
}

#timeline {
    border: 1px solid #ccc;
    background-color: white;
    border-radius: 4px;
    margin: 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

#timeline.loading {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.timeline-loader {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
    margin: 20px;
    min-height: 200px;
}

.timeline-loader.visible {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enable item overflow so labels can extend beyond item boundaries */
.vis-item .vis-item-overflow {
    overflow: visible;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: -9999px;
}

#status {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    display: none;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

#status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Point shape styles using Unicode characters */
/* Hide the default dot and use unicode characters instead */
.vis-item.vis-point.point-shape-circle .vis-dot,
.vis-item.vis-point.point-shape-square .vis-dot,
.vis-item.vis-point.point-shape-diamond .vis-dot,
.vis-item.vis-point.point-shape-triangle .vis-dot,
.vis-item.vis-point.point-shape-star .vis-dot {
    width: 0 !important;
    height: 0 !important;
    border: none !important;
    background: transparent !important;
    font-size: 16px;
    line-height: 1;
    margin-right: 2px;
}

/* Add spacing between shape and label */
.vis-item.vis-point.point-shape-circle .vis-item-content,
.vis-item.vis-point.point-shape-square .vis-item-content,
.vis-item.vis-point.point-shape-diamond .vis-item-content,
.vis-item.vis-point.point-shape-triangle .vis-item-content,
.vis-item.vis-point.point-shape-star .vis-item-content {
    margin-left: 2px !important;
}

.vis-item.vis-point.point-shape-circle .vis-dot::after {
    content: '●';
    color: #4CAF50;
    font-size: 16px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding-right: 2px;
}

.vis-item.vis-point.point-shape-square .vis-dot::after {
    content: '■';
    color: #4CAF50;
    font-size: 16px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding-right: 2px;
}

.vis-item.vis-point.point-shape-diamond .vis-dot::after {
    content: '◆';
    color: #4CAF50;
    font-size: 16px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding-right: 2px;
}

.vis-item.vis-point.point-shape-triangle .vis-dot::after {
    content: '▲';
    color: #4CAF50;
    font-size: 16px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding-right: 2px;
}

.vis-item.vis-point.point-shape-star .vis-dot::after {
    content: '★';
    color: #4CAF50;
    font-size: 16px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding-right: 2px;
}

/* Custom color support for point events */
.vis-item.vis-point.custom-color.point-shape-circle .vis-dot::after,
.vis-item.vis-point.custom-color.point-shape-square .vis-dot::after,
.vis-item.vis-point.custom-color.point-shape-diamond .vis-dot::after,
.vis-item.vis-point.custom-color.point-shape-triangle .vis-dot::after,
.vis-item.vis-point.custom-color.point-shape-star .vis-dot::after {
    color: var(--point-color);
}

/* ============================================================================
   Modal System Styles
   ============================================================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
    background: none;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Two-column layout needs special handling */
.modal-body:has(.management-container.two-column) {
    padding: 0;
    overflow: hidden;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* ============================================================================
   Management Container Styles
   ============================================================================ */

.management-container {
    min-height: 200px;
}

.management-container.two-column {
    display: flex;
    gap: 0;
    height: 500px;
}

.management-sidebar {
    width: 280px;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    background-color: #fafafa;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.management-detail {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

#category-detail-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.management-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.management-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.empty-message {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

/* ============================================================================
   Category Sidebar Styles
   ============================================================================ */

.category-sidebar-list {
    flex: 1;
    overflow-y: auto;
}

.category-sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.2s;
}

.category-sidebar-item:hover {
    background-color: #f0f0f0;
}

.category-sidebar-item.selected {
    background-color: #e3f2fd;
    border-left: 3px solid #2196F3;
    padding-left: 12px;
}

.category-sidebar-visual {
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-sidebar-info {
    flex: 1;
    min-width: 0;
}

.category-sidebar-name {
    font-weight: 500;
    color: #333;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-sidebar-count {
    font-size: 12px;
    color: #666;
}

/* ============================================================================
   Detail Panel Styles
   ============================================================================ */

.detail-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.detail-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fafafa;
    flex-shrink: 0;
}

.detail-title-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.detail-visual {
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.detail-subtitle {
    margin: 4px 0 0 0;
    font-size: 14px;
    color: #666;
}

.detail-actions {
    display: flex;
    gap: 5px;
}

.detail-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    min-height: 0;
}

.detail-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.detail-section-header h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.detail-events {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ============================================================================
   Category List Styles
   ============================================================================ */

.category-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.category-item {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    background-color: #fafafa;
}

.category-item > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.category-visual {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid #ccc;
    display: inline-block;
}

.color-swatch.small {
    width: 16px;
    height: 16px;
}

.color-swatch.large {
    width: 32px;
    height: 32px;
}

.shape-icon {
    font-size: 20px;
    line-height: 1;
}

.shape-icon.large {
    font-size: 28px;
}

.category-details h4 {
    margin: 0 0 4px 0;
    font-size: 18px;
    color: #333;
}

.event-count {
    font-size: 14px;
    color: #666;
}

.category-actions {
    display: flex;
    gap: 5px;
}

.btn-icon {
    background-color: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 16px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: #d0d0d0;
}

.btn-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-icon:disabled:hover {
    background-color: #e0e0e0;
}

.btn-icon.btn-danger {
    background-color: #ffebee;
    color: #c62828;
}

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

.expand-icon {
    font-size: 12px;
}

/* ============================================================================
   Event List Styles
   ============================================================================ */

.event-list {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.event-list-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.event-item {
    display: flex;
    flex-direction: column;
    padding: 12px;
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.event-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.event-info-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.event-info-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.event-type-badge {
    font-size: 11px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.event-type-badge.point {
    background-color: #e3f2fd;
    color: #1976d2;
}

.event-type-badge.span {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.event-label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.event-date {
    font-size: 13px;
    color: #666;
    padding-left: 4px;
}

.event-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

/* ============================================================================
   Form Styles
   ============================================================================ */

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

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.form-color {
    width: 100%;
    height: 40px;
    padding: 2px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
}

.form-radio-group {
    display: flex;
    gap: 20px;
}

.form-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-radio input[type="radio"] {
    cursor: pointer;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-top: 8px;
}

.form-checkbox input[type="checkbox"] {
    cursor: pointer;
}

#point-fields,
#span-fields {
    margin-top: 20px;
}

.form-section-divider {
    border: 0;
    border-top: 2px solid #e0e0e0;
    margin: 30px 0 25px 0;
    position: relative;
}

.form-section-divider::after {
    content: attr(data-label);
    position: absolute;
    top: -10px;
    left: 0;
    background-color: white;
    padding-right: 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #666;
    letter-spacing: 0.5px;
}

/* ============================================================================
   Button Styles
   ============================================================================ */

.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

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

.btn-primary:hover {
    background-color: #45a049;
}

.btn-secondary {
    background-color: #008CBA;
    color: white;
}

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

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}
