/* 键盘测试工具样式 */

/* 统计面板 */
.stats-panel {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    padding: 15px 25px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    min-width: 100px;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.stat-label {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 5px;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.action-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: #f0f0f0;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.action-btn:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

/* 按键显示区域 */
.key-display-section {
    margin-bottom: 20px;
}

.key-display-title {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.key-display-area {
    min-height: 200px;
    border: 3px dashed #ddd;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
    outline: none;
}

.key-display-area:focus {
    border-color: #667eea;
    border-style: solid;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

.key-display-area.active {
    border-color: #28a745;
    border-style: solid;
    background: linear-gradient(145deg, #e8f5e9 0%, #c8e6c9 100%);
}

/* 占位符 */
.key-display-placeholder {
    text-align: center;
    padding: 30px;
}

.placeholder-icon {
    font-size: 4em;
    margin-bottom: 15px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.placeholder-text {
    font-size: 1.3em;
    color: #495057;
    margin-bottom: 10px;
}

.placeholder-hint {
    font-size: 0.9em;
    color: #868e96;
}

/* 按键信息面板 */
.key-info-panel {
    width: 100%;
    padding: 20px;
}

.key-main-display {
    text-align: center;
    margin-bottom: 20px;
}

.key-visual {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    min-height: 80px;
    padding: 15px 25px;
    font-size: 2.5em;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    animation: keyPress 0.3s ease;
}

@keyframes keyPress {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.key-name {
    font-size: 1.5em;
    color: #333;
    margin-top: 15px;
    font-weight: 600;
}

.key-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.key-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.detail-label {
    font-size: 0.9em;
    color: #666;
}

.detail-value {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.95em;
    color: #333;
    font-weight: 600;
    background: #e9ecef;
    padding: 4px 10px;
    border-radius: 4px;
}

/* 组合键显示 */
.combo-display {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.combo-title {
    font-size: 0.95em;
    color: #666;
    margin-bottom: 12px;
}

.combo-keys {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    align-items: center;
}

.combo-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95em;
    animation: comboKeyIn 0.2s ease;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

@keyframes comboKeyIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.combo-placeholder {
    color: #adb5bd;
    font-style: italic;
}

.combo-separator {
    color: #adb5bd;
    font-size: 1.2em;
}

/* 可视化键盘 */
.keyboard-section {
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.keyboard-container {
    background: linear-gradient(145deg, #2d3436 0%, #1a1a2e 100%);
    border-radius: 16px;
    padding: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 移动端滚动提示 */
.keyboard-container::after {
    content: '';
    display: none;
}

@media (max-width: 768px) {
    .keyboard-container::after {
        content: '← 左右滚动查看完整键盘 →';
        display: block;
        text-align: center;
        color: rgba(255, 255, 255, 0.5);
        font-size: 12px;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
}

.keyboard-row {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
    justify-content: center;
}

.function-row {
    margin-bottom: 15px;
}

.key {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    height: 45px;
    padding: 5px 10px;
    background: linear-gradient(145deg, #3d3d3d 0%, #2a2a2a 100%);
    color: #fff;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: default;
    transition: all 0.15s ease;
    box-shadow: 0 3px 0 #1a1a1a, 0 4px 8px rgba(0, 0, 0, 0.3);
    user-select: none;
}

.key:hover {
    background: linear-gradient(145deg, #4a4a4a 0%, #353535 100%);
}

.key.pressed {
    background: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 1px 0 #4a5568, 0 2px 4px rgba(0, 0, 0, 0.3);
    transform: translateY(2px);
    cursor: default;
}

.key.tested {
    border: 2px solid #28a745;
}

/* 特殊按键尺寸 */
.key-esc { min-width: 50px; }
.key-function { min-width: 42px; font-size: 12px; }
.key-spacer { width: 20px; }
.key-spacer-small { width: 10px; }
.key-backspace { min-width: 100px; font-size: 12px; }
.key-tab { min-width: 70px; font-size: 12px; }
.key-backslash { min-width: 70px; }
.key-caps { min-width: 85px; font-size: 11px; }
.key-enter { min-width: 105px; font-size: 12px; }
.key-shift-left { min-width: 115px; font-size: 12px; }
.key-shift-right { min-width: 135px; font-size: 12px; }
.key-ctrl { min-width: 60px; font-size: 12px; }
.key-meta { min-width: 55px; font-size: 12px; }
.key-alt { min-width: 55px; font-size: 12px; }
.key-menu { min-width: 50px; }
.key-space { min-width: 300px; }
.key-arrow { min-width: 45px; font-size: 16px; }

/* 方向键区 */
.arrow-keys-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
    gap: 5px;
}

.arrow-keys-row {
    display: flex;
    gap: 5px;
}

/* 按键历史 */
.key-history-section {
    margin-bottom: 20px;
}

.history-controls {
    margin-bottom: 10px;
}

.history-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: #f0f0f0;
    color: #333;
    cursor: pointer;
    font-size: 13px;
}

.history-btn:hover {
    background: #e0e0e0;
}

.key-history-list {
    max-height: 200px;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #fff;
    border-radius: 6px;
    margin-bottom: 5px;
    font-size: 13px;
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-key {
    font-weight: 600;
    color: #667eea;
    min-width: 60px;
}

.history-code {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    color: #868e96;
    background: #f1f3f4;
    padding: 2px 8px;
    border-radius: 4px;
    flex: 1;
    text-align: center;
    margin: 0 10px;
}

.history-time {
    color: #868e96;
    font-size: 12px;
}

.history-placeholder {
    text-align: center;
    color: #adb5bd;
    padding: 20px;
}

/* 按键排行 */
.key-ranking-section {
    margin-bottom: 20px;
}

.ranking-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.ranking-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: linear-gradient(145deg, #fff 0%, #f8f9fa 100%);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.ranking-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.ranking-key {
    font-weight: 600;
    color: #333;
}

.ranking-count {
    background: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.ranking-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    color: #adb5bd;
    padding: 30px;
}

/* AI 面板 */
.ai-panel {
    background: linear-gradient(145deg, #f8f9fa 0%, #fff 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.ai-panel-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.ai-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.ai-tab {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: #e9ecef;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.ai-tab:hover {
    background: #dee2e6;
}

.ai-tab.active {
    background: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.ai-content {
    margin-bottom: 15px;
}

.ai-input-box {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.ai-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.ai-input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.ai-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.ai-hint {
    font-size: 13px;
    color: #868e96;
    margin-bottom: 10px;
}

.use-current-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    border-radius: 6px;
    background: transparent;
    color: #667eea;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
}

.use-current-btn:hover {
    background: #667eea;
    color: #fff;
}

.ai-result {
    margin-top: 15px;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    display: none;
}

.ai-result.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-result-content {
    line-height: 1.7;
    color: #333;
}

.ai-result-content p {
    margin-bottom: 10px;
}

.ai-result-content ul, .ai-result-content ol {
    margin: 10px 0;
    padding-left: 20px;
}

.ai-result-content li {
    margin-bottom: 5px;
}

.ai-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: #666;
}

.ai-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* 复制提示 */
.copy-tip {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(145deg, #28a745 0%, #20c997 100%);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.copy-tip.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .stats-panel {
        gap: 10px;
    }
    
    .stat-item {
        padding: 10px 15px;
        min-width: 70px;
    }
    
    .stat-value {
        font-size: 1.5em;
    }
    
    .keyboard-container {
        padding: 10px;
    }
    
    .key {
        min-width: 30px;
        height: 35px;
        font-size: 11px;
    }
    
    .key-backspace { min-width: 60px; }
    .key-tab { min-width: 50px; }
    .key-caps { min-width: 60px; }
    .key-enter { min-width: 70px; }
    .key-shift-left { min-width: 70px; }
    .key-shift-right { min-width: 90px; }
    .key-space { min-width: 150px; }
    
    .key-details {
        grid-template-columns: 1fr;
    }
    
    .ai-input-box {
        flex-direction: column;
    }
    
    .ai-btn {
        width: 100%;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .key-display-area {
        background: linear-gradient(145deg, #2d3436 0%, #1a1a2e 100%);
        border-color: #4a5568;
    }
    
    .key-display-area:focus {
        border-color: #667eea;
    }
    
    .placeholder-text, .placeholder-hint {
        color: #a0aec0;
    }
    
    .combo-display, .key-history-section, .key-ranking-section {
        background: #2d3436;
    }
    
    .combo-title, .section-title {
        color: #e2e8f0;
    }
    
    .key-details {
        background: #2d3436;
    }
    
    .key-detail-item {
        background: #1a1a2e;
    }
    
    .detail-label {
        color: #a0aec0;
    }
    
    .detail-value {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .history-item, .ranking-item {
        background: #1a1a2e;
    }
    
    .ai-panel {
        background: #2d3436;
        border-color: #4a5568;
    }
    
    .ai-input {
        background: #1a1a2e;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .ai-result {
        background: #1a1a2e;
        border-color: #4a5568;
    }
    
    .ai-result-content {
        color: #e2e8f0;
    }
}
