/* 历史记录样式 - Metro UI 风格 */

/* 历史记录按钮 */
.history-btn {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 1);
    padding: calc(var(--spacing-unit) * 1) calc(var(--spacing-unit) * 2);
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 15px;
    font-weight: 400;
}

.history-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.history-btn svg {
    flex-shrink: 0;
}

/* 历史记录浮层 */
.history-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
}

.history-overlay.active {
    opacity: 1;
    visibility: visible;
}

.history-panel {
    position: fixed;
    top: 64px;
    right: calc(var(--spacing-unit) * 3);
    width: 480px;
    max-width: calc(100vw - calc(var(--spacing-unit) * 6));
    max-height: calc(100vh - calc(var(--spacing-unit) * 12));
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.15s, opacity 0.15s, visibility 0.15s;
}

.history-overlay.active .history-panel {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* 头部 */
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(var(--spacing-unit) * 3);
    border-bottom: 2px solid var(--border-color);
}

.history-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.history-close:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Tab 切换 */
.history-tabs {
    display: flex;
    gap: 0;
    padding: 0;
    border-bottom: 2px solid var(--border-color);
}

.history-tab {
    flex: 1;
    padding: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 3);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    transition: all 0.15s;
    margin-bottom: -2px;
}

.history-tab:hover {
    color: var(--text-primary);
    background: var(--bg-color);
}

.history-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: transparent;
}

/* 内容区域 */
.history-content {
    flex: 1;
    overflow-y: auto;
    padding: calc(var(--spacing-unit) * 2);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* 历史记录项 */
.history-item {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 1);
    padding: calc(var(--spacing-unit) * 2);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-bottom: none;
    cursor: pointer;
    transition: background 0.15s;
}

.history-item:first-child {
    border-top: 1px solid var(--border-color);
}

.history-item:last-child {
    border-bottom: 1px solid var(--border-color);
}

.history-item:hover {
    background: var(--bg-color);
}

.history-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: calc(var(--spacing-unit) * 2);
}

.history-item-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
}

.history-item-time {
    flex-shrink: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.history-item-meta {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 2);
    font-size: 13px;
    color: var(--text-secondary);
}

.history-item-code {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 0.5);
}

.history-item-files {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 0.5);
}

.history-item-password {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 1);
}

.password-toggle {
    display: flex;
    align-items: center;
    padding: calc(var(--spacing-unit) * 0.5) calc(var(--spacing-unit) * 1);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
    transition: all 0.15s;
}

.password-toggle:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.password-text {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
}

/* 空状态 */
.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: calc(var(--spacing-unit) * 10) calc(var(--spacing-unit) * 3);
    color: var(--text-secondary);
}

.history-empty svg {
    margin-bottom: calc(var(--spacing-unit) * 2);
    opacity: 0.5;
}

.history-empty-text {
    font-size: 15px;
}

/* 底部操作 */
.history-footer {
    padding: calc(var(--spacing-unit) * 2);
    border-top: 2px solid var(--border-color);
}

.history-clear-btn {
    width: 100%;
    padding: calc(var(--spacing-unit) * 1.5);
    background: var(--danger-color);
    border: none;
    border-radius: var(--border-radius);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.history-clear-btn:hover {
    opacity: 0.9;
}

.history-clear-btn:disabled {
    background: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .history-btn span {
        display: none;
    }
    
    .history-btn {
        padding: calc(var(--spacing-unit) * 1);
    }
    
    .history-panel {
        top: 0;
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        max-height: 100%;
        border: none;
        border-radius: var(--border-radius);
    }
    
    .history-header {
        padding: calc(var(--spacing-unit) * 2);
    }
    
    .history-title {
        font-size: 18px;
    }
    
    .history-content {
        padding: calc(var(--spacing-unit) * 1);
    }
    
    .history-item {
        padding: calc(var(--spacing-unit) * 2);
    }
    
    .history-footer {
        padding: calc(var(--spacing-unit) * 2);
    }
}

/* 滚动条样式 - Metro UI */
.history-content::-webkit-scrollbar {
    width: 8px;
}

.history-content::-webkit-scrollbar-track {
    background: transparent;
}

.history-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--border-radius);
}

.history-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
