/* ===== 基础重置 ===== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa, #e4ecf7);
    display: flex;
    justify-content: center;
    padding: 40px 20px;
    overflow-x: hidden;
    transition: background 0.3s ease;
}

.container {
    width: 1100px;
    max-width: 100%;
}

/* ============================= */
/* Header */
/* ============================= */

.header {
    position: relative;
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 32px;
    font-weight: 600;
}

/* ===== 极简滑块暗黑按钮 ===== */

.theme-toggle {
    position: absolute;
    right: 0;
    top: 0;
    width: 42px;
    height: 24px;
    border-radius: 20px;
    border: none;
    background: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    top: 3px;
    left: 3px;
    border-radius: 50%;
    background: white;
    transition: transform 0.3s ease;
}

body.dark .theme-toggle {
    background: #444;
}

body.dark .theme-toggle::before {
    transform: translateX(18px);
}

/* ============================= */
/* 布局 */
/* ============================= */

.translate-container {
    display: flex;
    gap: 40px;
}

.panel {
    flex: 1;
    min-width: 0;
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
    transition: background 0.3s ease;
}

.panel h3 {
    margin-bottom: 15px;
    font-size: 18px;
    color: #333;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ============================= */
/* 输入框 */
/* ============================= */

textarea {
    width: 100%;
    min-height: 220px;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 15px;
    font-size: 15px;
    resize: none;
    outline: none;
    transition: all 0.2s ease;
}

textarea:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74,144,226,0.15);
}

/* ============================= */
/* 输出区 */
/* ============================= */

.result-box {
    min-height: 220px;
}

.placeholder {
    color: #888;
}

.translation-text {
    font-size: 20px;
    font-weight: 500;
    margin: 20px 0;
    line-height: 1.6;
}

.terms-box {
    background: #f4f6f9;
    padding: 15px;
    border-radius: 12px;
    font-size: 14px;
    color: #555;
}

/* ============================= */
/* 极简复制按钮 */
/* ============================= */

.copy-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: transparent;
    position: relative;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    opacity: 1;
}

.copy-btn::before,
.copy-btn::after {
    content: "";
    position: absolute;
    border: 1.5px solid currentColor;
    border-radius: 4px;
}

.copy-btn::before {
    width: 14px;
    height: 14px;
    top: 7px;
    left: 9px;
}

.copy-btn::after {
    width: 14px;
    height: 14px;
    top: 5px;
    left: 5px;
}

.copy-btn.copied {
    color: #4caf50;
}

/* ============================= */
/* 按钮区域 */
/* ============================= */

.controls {
    margin-top: 40px;
    display: flex;
    justify-content: center;
}

.translate-btn {
    position: relative;
    background: black;
    color: white;
    border: none;
    padding: 16px 60px;
    border-radius: 999px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    min-width: 200px;
}

.translate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.translate-btn:active {
    transform: scale(0.97);
}

.translate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loading {
    display: none;
    align-items: center;
    gap: 8px;
}

.translate-btn.loading .btn-text {
    display: none;
}

.translate-btn.loading .btn-loading {
    display: inline-flex;
}

/* ============================= */
/* spinner */
/* ============================= */

.spinner {
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================= */
/* 结果动画 */
/* ============================= */

.result-content {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.result-content.show {
    opacity: 1;
    transform: translateY(0);
}

/* ============================= */
/* 🌙 暗黑模式 */
/* ============================= */

body.dark {
    background: linear-gradient(135deg, #1e1e1e, #111);
    color: #eee;
}

body.dark .panel {
    background: #2a2a2a;
}

body.dark textarea {
    background: #1f1f1f;
    color: white;
    border: 1px solid #444;
}

body.dark .terms-box {
    background: #333;
    color: #ddd;
}

body.dark .translate-btn {
    background: white;
    color: black;
}

/* ============================= */
/* 响应式 */
/* ============================= */

@media (max-width: 900px) {
    .translate-container {
        flex-direction: column;
        gap: 25px;
    }
}

@media (max-width: 600px) {

    body {
        padding: 15px;
    }

    h1 {
        font-size: 22px;
        margin-bottom: 25px;
    }

    .panel {
        padding: 20px;
    }

    textarea {
        font-size: 15px;
    }

    .translation-text {
        font-size: 16px;
    }

    .translate-btn {
        width: 100%;
        max-width: 320px;
    }
}
