/* Translator页面样式 */

/* 错误提示样式 */
.error-message {
    background-color: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 0.85rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 工具区（第一屏） */
.tool-section {
    background: linear-gradient(135deg, #f5f3ff 0%, #fce7f3 100%);
    padding: 20px 0; /* 简化padding，上下一致 */
    display: flex;
    align-items: flex-start; /* 改为顶部对齐，不再居中 */
}

.tool-section .container {
    max-width: 70%; /* 缩小到70% */
    width: 100%;
}

/* 其他内容区域与工具区宽度一致 */
.intro-section .container,
.examples-section .container,
.other-section .container,
.faq-section .container {
    max-width: 70%; /* 与工具区保持一致 */
    width: 100%;
}

/* 文本内容区域也对齐 */
.intro-content,
.other-content {
    max-width: 100%; /* 不再限制宽度，跟随容器 */
    margin: 0;
}

.faq-list {
    max-width: 100%; /* 不再限制宽度，跟随容器 */
    margin: 0;
}

.back-link {
    margin-bottom: 6px; /* 从10px进一步缩小 */
}

.back-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem; /* 从0.85rem缩小 */
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.back-link a:hover {
    color: var(--primary-dark);
    gap: 8px;
}

.tool-title {
    font-size: 1.6rem; /* 从1.75rem进一步缩小 */
    color: var(--text);
    margin-bottom: 6px; /* 从8px缩小 */
    text-align: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tool-desc {
    font-size: 0.85rem; /* 从0.9rem缩小 */
    color: var(--text-light);
    text-align: center;
    margin-bottom: 15px; /* 从20px缩小 */
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.tool-container {
    background: var(--surface);
    border-radius: 16px;
    padding: 15px; /* 从20px进一步缩小 */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    /* 移除 max-width 限制，让它跟随 container 宽度 */
}

.translator-form {
    display: flex;
    flex-direction: column;
    gap: 10px; /* 从12px缩小 */
}

/* 输入输出水平布局 */
.io-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px; /* 从12px缩小 */
}

.input-section,
.output-section {
    display: flex;
    flex-direction: column;
}

.input-section label,
.output-section label {
    font-size: 0.8rem; /* 从0.85rem缩小 */
    font-weight: 600;
    margin-bottom: 4px; /* 从5px缩小 */
    color: var(--text);
}

.input-section textarea,
.output-section textarea {
    width: 100%;
    padding: 6px; /* 从8px缩小 */
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.8rem; /* 从0.85rem缩小 */
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

.input-section textarea:focus,
.output-section textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.output-section textarea {
    background: #f9fafb;
}

/* 选项区 */
.options-section {
    background: #f9fafb;
    padding: 10px; /* 从12px缩小 */
    border-radius: 12px;
}

.options-section h3 {
    font-size: 0.9rem; /* 从0.95rem缩小 */
    margin-bottom: 8px; /* 从10px缩小 */
    color: var(--text);
}

/* 选项网格布局 */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* 从200px缩小 */
    gap: 8px; /* 从10px缩小 */
}

.option-group {
    margin-bottom: 6px; /* 从8px缩小 */
}

.option-label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px; /* 从5px缩小 */
    color: var(--text);
    font-size: 0.8rem; /* 从0.85rem缩小 */
}

/* 表单元素样式 */
.form-select {
    width: 100%;
    padding: 5px 8px; /* 从6px 10px进一步缩小 */
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.8rem; /* 从0.85rem缩小 */
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 6px; /* 从8px缩小 */
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px; /* 从8px缩小 */
    cursor: pointer;
    padding: 6px; /* 从8px缩小 */
    border-radius: 6px;
    transition: background 0.3s;
    font-size: 0.85rem; /* 添加字体大小 */
}

.radio-label:hover,
.checkbox-label:hover {
    background: #f3f4f6;
}

.radio-label input[type="radio"],
.checkbox-label input[type="checkbox"] {
    width: 18px; /* 从20px缩小 */
    height: 18px; /* 从20px缩小 */
    cursor: pointer;
}

/* 子选项样式 */
.sub-options {
    margin-left: 25px; /* 从30px缩小 */
    margin-top: 10px; /* 从15px缩小 */
    padding-left: 15px; /* 从20px缩小 */
    border-left: 3px solid var(--primary);
    display: none;
}

input[type="radio"]:checked ~ .sub-options,
input[type="checkbox"]:checked ~ .sub-options {
    display: block;
}

.sub-item {
    margin-bottom: 10px; /* 从15px缩小 */
}

/* Range滑块 */
.range-group {
    display: flex;
    align-items: center;
    gap: 10px; /* 从15px缩小 */
}

.form-range {
    flex: 1;
    height: 5px; /* 从6px缩小 */
    border-radius: 3px;
    background: var(--border);
    outline: none;
    cursor: pointer;
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    width: 18px; /* 从20px缩小 */
    height: 18px; /* 从20px缩小 */
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.range-value {
    font-weight: 600;
    color: var(--primary);
    min-width: 25px; /* 从30px缩小 */
    text-align: center;
    font-size: 0.85rem; /* 添加字体大小 */
}

/* Toggle开关 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px; /* 从60px缩小 */
    height: 26px; /* 从30px缩小 */
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 26px; /* 从30px调整 */
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px; /* 从22px缩小 */
    width: 18px; /* 从22px缩小 */
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px); /* 从30px调整 */
}

/* 翻译按钮 */
.translate-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    padding: 8px 28px; /* 从10px 32px进一步缩小 */
    font-size: 0.9rem; /* 从0.95rem缩小 */
    font-weight: 600;
    border-radius: 10px; /* 从12px缩小 */
    cursor: pointer;
    transition: all 0.3s;
    align-self: center;
    box-shadow: 0 4px 14px 0 rgba(139, 92, 246, 0.4);
    position: relative;
    overflow: hidden;
}

.translate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.translate-btn:hover::before {
    left: 100%;
}

.translate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.5);
}

.translate-btn:active {
    transform: translateY(-1px);
}

/* 加载动画 - 跳动小球 */
.loading-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* 复制按钮 */
.copy-btn {
    margin-top: 5px; /* 从6px缩小 */
    background: var(--accent);
    color: white;
    border: none;
    padding: 6px 14px; /* 从8px 16px缩小 */
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem; /* 从0.85rem缩小 */
    font-weight: 600;
    transition: background 0.3s;
    width: 100%;
}

.copy-btn:hover {
    background: #d97706;
}

/* 介绍区（第二屏） */
.intro-section {
    padding: 20px 0; /* 从25px缩小 */
    background: var(--surface);
}

.intro-section h2 {
    font-size: 1.6rem; /* 从1.75rem缩小 */
    text-align: center;
    margin-bottom: 15px; /* 从20px缩小 */
    color: var(--text);
}

.intro-content {
    max-width: 100%; /* 移除宽度限制 */
    margin: 0;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-light);
}

/* 案例区（第三屏） */
.examples-section {
    padding: 20px 0; /* 从25px缩小 */
    background: #f9fafb;
}

.examples-section h2 {
    font-size: 1.6rem; /* 从1.75rem缩小 */
    text-align: center;
    margin-bottom: 15px; /* 从20px缩小 */
    color: var(--text);
}

.examples-grid {
    display: grid;
    gap: 12px; /* 从15px缩小 */
}

.example-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 12px; /* 从15px缩小 */
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px; /* 从15px缩小 */
    align-items: center;
}

.example-input,
.example-output {
    padding: 10px; /* 从12px缩小 */
    border-radius: 8px;
}

.example-input {
    background: #fef3c7;
}

.example-output {
    background: #d1fae5;
}

.example-input h4,
.example-output h4 {
    font-size: 0.8rem; /* 从0.85rem缩小 */
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 6px; /* 从8px缩小 */
}

.example-input p,
.example-output p {
    font-size: 1rem;
    color: var(--text);
}

.example-arrow {
    font-size: 1.3rem; /* 从1.5rem缩小 */
    color: var(--primary);
}

/* 其他内容区（第四屏） */
.other-section {
    padding: 20px 0; /* 从25px缩小 */
    background: var(--surface);
}

.other-content {
    max-width: 100%; /* 移除宽度限制 */
    margin: 0;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-light);
}

/* FAQ区（第五屏） */
.faq-section {
    padding: 20px 0; /* 从25px缩小 */
    background: #f9fafb;
}

.faq-section h2 {
    font-size: 1.6rem; /* 从1.75rem缩小 */
    text-align: center;
    margin-bottom: 15px; /* 从20px缩小 */
    color: var(--text);
}

.faq-list {
    max-width: 100%; /* 移除宽度限制 */
    margin: 0;
}

.faq-item {
    background: var(--surface);
    border-radius: 12px;
    padding: 12px; /* 从15px缩小 */
    margin-bottom: 10px; /* 从12px缩小 */
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s;
}

.faq-item:hover {
    box-shadow: var(--shadow-lg);
}

.faq-question {
    font-size: 0.95rem; /* 从1rem缩小 */
    color: var(--primary);
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px; /* 从10px缩小 */
    user-select: none;
}

.faq-icon {
    font-size: 0.75rem; /* 从0.8rem缩小 */
    transition: transform 0.3s;
    color: var(--primary);
}

.faq-answer {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-light);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    margin-top: 0;
}

.faq-item.active .faq-answer {
    margin-top: 10px; /* 从12px缩小 */
}

/* 相关推荐区 */
.related-section {
    padding: 30px 0;
    background: #f9fafb;
}

.related-section .container {
    max-width: 70%;
    width: 100%;
}

.related-section h2 {
    font-size: 1.6rem;
    text-align: center;
    margin-bottom: 20px;
    color: var(--text);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.related-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s ease;
    border: 2px solid #e8e4f3;
    display: flex;
    flex-direction: column;
}

.related-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(139, 92, 246, 0.15);
    border-color: var(--primary);
}

.related-card h3 {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 10px;
    font-weight: 600;
    line-height: 1.3;
    transition: color 0.3s;
}

.related-card:hover h3 {
    color: var(--primary);
}

.related-card p {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 响应式 */
@media (max-width: 768px) {
    /* 移动端容器铺满，左右留边距 */
    .tool-section .container,
    .intro-section .container,
    .examples-section .container,
    .other-section .container,
    .faq-section .container,
    .related-section .container,
    .comments-section .container {
        max-width: 100%;
        padding: 0 20px;
    }

    /* 移动端改为上下布局 */
    .io-grid {
        grid-template-columns: 1fr;
    }

    .tool-container {
        padding: 15px;
        border-radius: 12px;
    }

    .tool-title {
        font-size: 1.5rem;
    }

    .tool-desc {
        font-size: 0.9rem;
    }

    /* 输入输出框铺满 */
    .input-section textarea,
    .output-section textarea {
        width: 100%;
        font-size: 1rem;
    }

    .example-card {
        grid-template-columns: 1fr;
    }

    .example-arrow {
        transform: rotate(90deg);
        text-align: center;
    }

    .options-section {
        padding: 15px;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    /* 内容区铺满对齐 */
    .intro-content,
    .other-content,
    .faq-list {
        padding: 0;
    }
}
