/* History Floating Panel */

.history-panel-float {
    position: fixed;
    bottom: calc(var(--status-bar-height, 30px) + 10px);
    left: calc(var(--toolbar-width, 48px) + 10px);
    width: 320px;
    max-height: 400px;
    background: var(--bg-panel, rgba(20, 20, 22, 0.88));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-medium, rgba(255, 255, 255, 0.10));
    border-radius: var(--radius-lg);
    z-index: 1200;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    animation: slideInLeft var(--duration-normal) var(--ease-out);
}

.history-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-medium, rgba(255, 255, 255, 0.10));
    flex-shrink: 0;
}

.history-panel-title {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.60));
}

.history-panel-close {
    width: 22px;
    height: 22px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    color: var(--text-muted, rgba(255, 255, 255, 0.35));
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}

.history-panel-close:hover {
    color: var(--text-primary, rgba(255, 255, 255, 0.92));
    border-color: var(--border-medium, rgba(255, 255, 255, 0.10));
}

.history-panel-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* History List */

.history-list {
    overflow-y: auto;
    max-height: 340px;
    padding: 4px 0;
}

.history-entry {
    display: flex;
    align-items: stretch;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    position: relative;
    transition: background var(--duration-fast) var(--ease-out);
}

.history-entry:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.04));
}

.history-entry-reverted {
    opacity: 0.4;
}

.history-entry-reverted .history-entry-desc {
    text-decoration: line-through;
}

.history-entry-color {
    width: 3px;
    min-height: 100%;
    border-radius: 2px;
    flex-shrink: 0;
    margin-right: 8px;
}

.history-entry-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.history-entry-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.history-entry-user {
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary, rgba(255, 255, 255, 0.92));
}

.history-entry-time {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-muted, rgba(255, 255, 255, 0.35));
}

.history-entry-desc {
    font-family: var(--font-sans);
    font-size: 11px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.60));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-revert-btn {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    align-self: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    color: var(--text-muted, rgba(255, 255, 255, 0.35));
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}

.history-entry:hover .history-revert-btn {
    opacity: 1;
}

.history-revert-btn:hover {
    color: var(--accent-primary, #D4AF37);
    border-color: var(--accent-primary, #D4AF37);
}

/* Empty state */
#history-empty {
    padding: 24px 16px;
    text-align: center;
    font-family: var(--font-sans);
    font-size: 12px;
    color: var(--text-muted, rgba(255, 255, 255, 0.35));
    letter-spacing: 0.3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#history-empty svg {
    opacity: 0.3;
}
