/* Version History Modal Styles */

.version-history-container {
    width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.version-history-container .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.version-history-list {
    padding: var(--space-4);
}

/* Loading state */
.version-history-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    color: var(--text-secondary);
    gap: var(--space-3);
}

.version-history-loading .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty state */
.version-history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    color: var(--text-secondary);
    text-align: center;
}

.version-history-empty svg {
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.version-history-empty p {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 var(--space-2);
    color: var(--text-primary);
}

.version-history-empty span {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Error state */
.version-history-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    color: var(--error-color, #dc3545);
    text-align: center;
}

.version-history-error svg {
    margin-bottom: var(--space-4);
    opacity: 0.7;
}

.version-history-error p {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 var(--space-2);
}

.version-history-error span {
    font-size: 12px;
    opacity: 0.8;
}

/* Date group */
.version-history-date-group {
    margin-bottom: var(--space-4);
}

.version-history-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: var(--space-2) 0;
    margin-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* History entry */
.version-history-entry {
    display: flex;
    align-items: flex-start;
    padding: var(--space-2) 0;
    gap: var(--space-3);
    position: relative;
    cursor: pointer;
}

.version-history-entry:hover {
    background: var(--bg-hover);
    margin: 0 calc(-1 * var(--space-2));
    padding-left: var(--space-2);
    padding-right: var(--space-2);
    border-radius: var(--radius-sm);
}

/* Timeline */
.version-history-timeline {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 20px;
    flex-shrink: 0;
}

.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-color);
    border: 2px solid var(--bg-primary);
    box-shadow: 0 0 0 2px var(--accent-color);
    z-index: 1;
}

.timeline-dot.action-create {
    background: var(--success-color, #28a745);
    box-shadow: 0 0 0 2px var(--success-color, #28a745);
}

.timeline-dot.action-update {
    background: var(--accent-color, #2196f3);
    box-shadow: 0 0 0 2px var(--accent-color, #2196f3);
}

.timeline-dot.action-delete {
    background: var(--error-color, #dc3545);
    box-shadow: 0 0 0 2px var(--error-color, #dc3545);
}

.timeline-dot.action-restore {
    background: var(--warning-color, #ffc107);
    box-shadow: 0 0 0 2px var(--warning-color, #ffc107);
}

.timeline-line {
    width: 2px;
    flex: 1;
    min-height: 20px;
    background: var(--border-color);
    margin-top: var(--space-1);
}

.version-history-entry:last-child .timeline-line {
    display: none;
}

/* Content */
.version-history-content {
    flex: 1;
    min-width: 0;
}

.version-history-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
}

.version-history-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.version-history-action {
    font-size: 12px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
}

.version-history-action.action-create {
    color: var(--success-color, #28a745);
    background: rgba(40, 167, 69, 0.1);
}

.version-history-action.action-update {
    color: var(--accent-color, #2196f3);
    background: rgba(33, 150, 243, 0.1);
}

.version-history-action.action-delete {
    color: var(--error-color, #dc3545);
    background: rgba(220, 53, 69, 0.1);
}

.version-history-action.action-restore {
    color: var(--warning-color, #f59e0b);
    background: rgba(245, 158, 11, 0.1);
}

.version-history-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 11px;
    color: var(--text-tertiary);
}

.version-history-user {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.version-history-version {
    opacity: 0.7;
}

/* Restore button */
.version-history-restore {
    position: relative; /* Required for data-tooltip CSS */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    opacity: 0;
    transition:
        opacity 0.15s,
        background 0.15s,
        color 0.15s;
    flex-shrink: 0;
}

.version-history-entry:hover .version-history-restore {
    opacity: 1;
}

.version-history-restore:hover {
    background: var(--accent-color);
    color: white;
}

.version-history-restore:active {
    transform: scale(0.95);
}

/* Loading more (infinite scroll) */
.version-history-loading-more {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.version-history-loading-more .spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
