/* ===== 全局重置和基础样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #F8F9F7;
    min-height: 100vh;
    padding: 20px;
    /* 性能优化 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ===== 容器和布局 ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

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

/* ===== 标题样式 ===== */
h1 {
    color: #16191F;
}

h2 {
    color: #16191F;
}

/* ===== 按钮和链接 ===== */
.back-btn {
    padding: 10px 20px;
    background: #3B82F6;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.back-btn:hover {
    background: #2563EB;
}

/* ===== 表单元素 ===== */
label {
    display: block;
    margin: 15px 0 8px;
    font-weight: 500;
}

textarea,
input,
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea {
    min-height: 100px;
    font-family: 'Courier New', monospace;
    resize: vertical;
}

textarea:focus,
input:focus,
select:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== 按钮系统 ===== */
.btn-group {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-size: 0.95rem;
    /* 性能优化：使用 will-change 提示浏览器 */
    will-change: background;
}

button:active {
    transform: scale(0.98);
}

.btn-primary {
    background: #3B82F6;
    color: white;
}

.btn-primary:hover {
    background: #2563EB;
}

.btn-secondary {
    background: #e2e8f0;
    color: #16191F;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

/* ===== 结果显示区域 ===== */
.result-container {
    margin-top: 10px;
}

.result {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 15px;
    min-height: 60px;
    font-family: 'Courier New', monospace;
    word-break: break-all;
    white-space: pre-wrap;
    line-height: 1.6;
}

/* 复制按钮 - 与操作按钮统一样式 */
.btn-copy {
    padding: 12px 24px;
    background: #e2e8f0;
    color: #16191F;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.btn-copy:hover {
    background: #cbd5e1;
}

.btn-copy:active {
    transform: scale(0.98);
}

/* 风格2: 图标风格 (取消注释使用) */
/*
.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(255, 255, 255, 0.9);
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    z-index: 10;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn::before {
    content: '📋';
    font-size: 16px;
}

.copy-btn:hover {
    background: #3B82F6;
    color: white;
    border-color: #3B82F6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.copy-btn:hover::before {
    content: '✓';
}
*/

/* 风格3: 毛玻璃效果 (取消注释使用) */
/*
.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.7);
    color: #475569;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    z-index: 10;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.copy-btn:hover {
    background: rgba(59, 130, 246, 0.9);
    color: white;
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
*/

/* 风格4: 极简线框 (取消注释使用) */
/*
.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    background: transparent;
    color: #94a3b8;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 400;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    z-index: 10;
}

.copy-btn:hover {
    color: #3B82F6;
    border-color: #3B82F6;
    background: rgba(59, 130, 246, 0.05);
}
*/

/* ===== 消息提示 ===== */
.message {
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    display: none;
}

.message-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.message-error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ===== 面板样式 ===== */
.panel {
    background: #f8fafc;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.panel h2 {
    color: #16191F;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

/* ===== 历史记录 ===== */
.history-panel {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin-top: 30px;
}

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

.history-header h3 {
    color: #16191F;
    font-size: 1.1rem;
    margin: 0;
}

.history-clear-btn {
    padding: 6px 12px;
    background: transparent;
    color: #64748b;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.history-clear-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: #3B82F6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.history-item-time {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 5px;
}

.history-item-content {
    font-size: 0.85rem;
    color: #16191F;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-empty {
    text-align: center;
    color: #94a3b8;
    padding: 40px 20px;
    font-size: 0.9rem;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-group button {
        width: 100%;
    }
}
