/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 返回按钮 - 优化样式 */
.back-button {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    text-decoration: none;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.back-button::before {
    content: '←';
    margin-right: 0.75rem;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.back-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.back-button:hover::before {
    transform: translateX(-3px);
}

.back-button:hover::after {
    left: 100%;
}

.back-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 主要内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

/* 输入区域样式 */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.input-group textarea,
.input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.input-group textarea {
    min-height: 120px;
    resize: vertical;
    font-family: monospace;
}

.input-group textarea:focus,
.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Placeholder样式 - 降低对比度 */
.input-group textarea::placeholder,
.input-group input::placeholder {
    color: #999;
    opacity: 0.7;
    font-style: italic;
}

/* 焦点状态下隐藏placeholder */
.input-group textarea:focus::placeholder,
.input-group input:focus::placeholder {
    opacity: 0.3;
}

/* 按钮样式 */
.button-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e1e5e9;
}

.btn-secondary:hover {
    background: #e9ecef;
}

/* 示例区域样式 */
.example-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #e1e5e9;
}

/* 示例区域头部 - 可点击折叠/展开 */
.example-header {
    cursor: pointer;
    user-select: none;
    margin-bottom: 0.5rem;
}

.example-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #555;
    margin: 0;
    font-size: 1rem;
}

.toggle-icon {
    transition: transform 0.3s ease;
    font-size: 0.8em;
    display: inline-block;
    width: 1em;
    text-align: center;
}

/* 示例内容区域 */
.example-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

/* 收起状态 */
.example-section.collapsed .example-content {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.example-section.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

/* 展开状态 */
.example-section:not(.collapsed) .example-content {
    max-height: 500px; /* 足够容纳内容的高度 */
    opacity: 1;
    margin-top: 0.5rem;
}

.example-data {
    margin-bottom: 1rem;
}

.example-data pre {
    background: white;
    padding: 0.75rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    border: 1px solid #e1e5e9;
}

/* 示例按钮样式 */
.example-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.example-buttons .btn {
    flex: 1;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* 主要操作按钮样式 */
.button-group.main-buttons {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.button-group.main-buttons .btn {
    flex: 1;
}

/* 结果显示区域 */
.results-container {
    max-height: 400px;
    overflow-y: auto;
}

.result-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-sum {
    font-weight: 600;
    color: #2c5aa0;
    margin-bottom: 0.5rem;
}

/* 结果信息样式 */
.result-info {
    background: #e3f2fd;
    color: #1565c0;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    border-left: 4px solid #2196f3;
    font-weight: 500;
    text-align: center;
}

.result-numbers {
    font-family: monospace;
    background: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.no-results {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

/* 信息区域 */
.info-section {
    margin-top: 2rem;
}

.info-item {
    margin-bottom: 1rem;
}

.info-item h4 {
    color: #667eea;
    margin-bottom: 0.5rem;
}

.info-item p {
    color: #666;
    font-size: 0.9rem;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* 错误消息 */
.error-message {
    background: #ffe6e6;
    color: #d63031;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #d63031;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .card {
        padding: 1.5rem;
    }

    .button-group {
        flex-direction: column;
    }

    /* 移动端返回按钮优化 */
    .back-button {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        margin-bottom: 1rem;
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .back-button::before {
        margin-right: 0.5rem;
    }
}

@media (max-width: 480px) {
    .back-button {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .card {
        padding: 1rem;
    }
}
