﻿/* 基础样式重置与变量定义 */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #f9fafb;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --card-radius: 12px;
    --transition: all 0.3s ease;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
}

/* 主容器样式 */
.api-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px 100px;
    color: #1f2937;
}

/* 标题样式 */
.api-title {
    font-size: 1.8rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.section-title {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin: 25px 0 15px;
    display: flex;
    align-items: center;
}

    .section-title i {
        margin-right: 10px;
        font-size: 1.1em;
    }

/* 表单区域样式 */
.form-section {
    background: white;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 20px;
    margin-bottom: 20px;
    transition: var(--transition);
}

    .form-section:hover {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    }

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4b5563;
}

/* 表单控件样式 */
.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 1rem;
    transition: var(--transition);
    background-color: #f9fafb;
}

    .form-control:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px 12px;
    padding-right: 40px;
}

/* 单选按钮组样式 */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
    min-width: 120px;
}

    .radio-label:hover {
        border-color: var(--primary-color);
    }

.radio-input {
    margin-right: 8px;
}

    .radio-input:checked + span {
        color: var(--primary-color);
        font-weight: 500;
    }

/* 滑块控件样式 */
.slider-container {
    margin-top: 15px;
}

.slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #e5e7eb;
    border-radius: 4px;
    outline: none;
    margin: 15px 0;
}

    .slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: var(--primary-color);
        cursor: pointer;
        transition: var(--transition);
    }

        .slider::-webkit-slider-thumb:hover {
            transform: scale(1.2);
        }

.slider-value {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-align: center;
}

    .btn i {
        margin-right: 8px;
    }

.btn-primary {
    background: var(--primary-color);
    color: white;
}

    .btn-primary:hover {
        background: var(--primary-hover);
    }

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

    .btn-secondary:hover {
        background: #f0f5ff;
    }

.btn-block {
    display: block;
    width: 100%;
}

/* 结果区域样式 */
.result-area {
    background: white;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.api-output {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    background: #f8fafc;
    margin-bottom: 15px;
    resize: vertical;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

/* 文档区域样式 */
.documentation {
    background: white;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 20px;
}

    .documentation h3 {
        font-size: 1.2rem;
        color: var(--primary-color);
        margin: 25px 0 15px;
        display: flex;
        align-items: center;
    }

        .documentation h3 i {
            margin-right: 10px;
        }

    .documentation h4 {
        font-size: 1.1rem;
        color: #4b5563;
        margin: 20px 0 10px;
    }

/* 表格样式 */
.parameter-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.9rem;
}

    .parameter-table th, .parameter-table td {
        padding: 12px 15px;
        text-align: left;
        border-bottom: 1px solid #e5e7eb;
    }

    .parameter-table th {
        background: #f9fafb;
        color: #4b5563;
        font-weight: 600;
    }

    .parameter-table tr:hover td {
        background: #f8fafc;
    }

/* 代码块样式 */
pre.api-output {
    background: #1e293b;
    color: #f8fafc;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 15px 0;
}

/* 响应式调整 */
@media (min-width: 768px) {
    .api-container {
        padding: 30px 20px 120px;
    }

    .api-title {
        font-size: 2rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .form-section {
        padding: 25px;
    }

    .radio-group {
        gap: 15px;
    }

    .radio-label {
        padding: 12px 20px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-section {
    animation: fadeIn 0.3s ease forwards;
}

    .form-section:nth-child(odd) {
        animation-delay: 0.1s;
    }

    .form-section:nth-child(even) {
        animation-delay: 0.2s;
    }

/* 无障碍优化 */
[role="radiogroup"] {
    display: flex;
    gap: 10px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* 状态颜色 */
.status-success {
    color: var(--success-color);
}

.status-error {
    color: var(--error-color);
}

.status-warning {
    color: var(--warning-color);
}

.status-info {
    color: var(--info-color);
}

/* 自定义分隔符输入框动画 */
#custom-separator-group {
    transition: all 0.3s ease;
}

/* 滑块控件增强样式 */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
    outline: none;
    margin: 15px 0;
}

    input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: var(--primary-color);
        cursor: pointer;
        transition: all 0.2s ease;
    }

        input[type="range"]::-webkit-slider-thumb:hover {
            transform: scale(1.2);
            box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
        }

/* 文本区域样式增强 */
textarea.api-output {
    transition: all 0.3s ease;
    line-height: 1.6;
}

    textarea.api-output:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    }

/* 按钮悬停效果增强 */
.btn {
    position: relative;
    overflow: hidden;
}

    .btn::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 5px;
        height: 5px;
        background: rgba(255, 255, 255, 0.5);
        opacity: 0;
        border-radius: 100%;
        transform: scale(1, 1) translate(-50%);
        transform-origin: 50% 50%;
    }

    .btn:hover::after {
        animation: ripple 1s ease-out;
    }

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }

    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}
