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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    min-height: 100vh;
    color: #334155;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: #334155;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    color: #64748b;
    font-weight: 400;
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 35px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* 输入区域 */
.input-section {
    margin-bottom: 35px;
}

.input-group, .output-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #475569;
    font-size: 15px;
}

textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    resize: vertical;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #334155;
    min-height: 120px;
    line-height: 1.5;
}

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

#outputText {
    background-color: #f8fafc;
    color: #475569;
    border-color: #cbd5e1;
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid #3b82f6;
    color: #3b82f6;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* 统计信息 */
.stats-group {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.stat-item {
    background: #f1f5f9;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    border: 1px solid #e2e8f0;
}

.stat-label {
    font-weight: 600;
    color: #64748b;
    font-size: 13px;
}

.stat-value {
    color: #334155;
    font-weight: 700;
}

/* 示例区域 */
.examples-section {
    margin-top: 35px;
    padding-top: 25px;
    border-top: 1px solid #e2e8f0;
}

.examples-section h3 {
    margin-bottom: 18px;
    color: #475569;
    font-size: 18px;
    font-weight: 600;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.example-btn {
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    color: #475569;
    text-align: center;
}

.example-btn:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* 底部样式 */
.footer {
    text-align: center;
    margin-top: 35px;
    color: #64748b;
    opacity: 0.8;
    font-size: 0.9rem;
    padding: 20px 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 25px 20px;
    }
    
    .button-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .stats-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .stat-item {
        width: 100%;
        text-align: center;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    textarea {
        font-size: 14px;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .main-content {
        padding: 20px 15px;
    }
    
    .subtitle {
        font-size: 1rem;
    }
}

/* 加载动画 */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

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

/* 成功状态 */
.success {
    border-color: #10b981 !important;
    background-color: #f0fdf4 !important;
    color: #065f46 !important;
}

/* 错误状态 */
.error {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    color: #991b1b !important;
}

/* 消息提示 */
.message {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 500;
    display: none;
}

.message.success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.message.error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.message.info {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

/* 辅助类 */
.text-muted {
    color: #64748b !important;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}