/* 谷歌生草机 Web 版 - 样式 */
/* 基于原项目 PyQt5 + qfluentwidgets 的 UI 风格重新设计 */

:root {
    --primary: #0078d4;
    --primary-hover: #106ebe;
    --primary-active: #005a9e;
    --bg: #f5f5f5;
    --bg-card: #ffffff;
    --bg-input: #fafafa;
    --text: #1a1a1a;
    --text-secondary: #666666;
    --border: #e0e0e0;
    --border-focus: #0078d4;
    --success: #107c10;
    --warning: #ff8c00;
    --error: #d13438;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========== 顶部导航 ========== */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-title .icon {
    font-size: 24px;
}

.header-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ========== 主容器 ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* ========== 卡片 ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* ========== 输入区域 ========== */
.input-section {
    display: flex;
    gap: 16px;
}

.input-main {
    flex: 1;
}

.input-textarea {
    width: 100%;
    min-height: 200px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    background: var(--bg-input);
    transition: border-color var(--transition);
    line-height: 1.6;
}

.input-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.1);
}

.input-textarea:disabled {
    background: #f0f0f0;
    cursor: not-allowed;
}

/* 侧边控件 */
.input-sidebar {
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-input);
    transition: border-color var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
}

.form-input:disabled {
    background: #f0f0f0;
    cursor: not-allowed;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-primary:active:not(:disabled) {
    background: var(--primary-active);
}

.btn-secondary {
    background: #f0f0f0;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: #e5e5e5;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
    background: rgba(0, 120, 212, 0.05);
}

.btn-danger {
    background: var(--error);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #c43133;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* ========== 操作栏 ========== */
.action-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    flex-wrap: wrap;
}

/* ========== 进度条 ========== */
.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 200px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-fill.error {
    background: var(--error);
}

.progress-text {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 60px;
    text-align: right;
}

.lang-label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    padding: 4px 10px;
    background: #f0f0f0;
    border-radius: 4px;
}

/* ========== 结果表格 ========== */
.result-table-wrapper {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.result-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.result-table th {
    background: #f8f8f8;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

.result-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
    line-height: 1.5;
}

.result-table .src-cell {
    width: 42%;
    border-right: 1px solid #f0f0f0;
}

.result-table .dst-cell {
    width: 42%;
    border-right: 1px solid #f0f0f0;
}

.result-table .action-cell {
    width: 16%;
    white-space: nowrap;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.btn-copy {
    padding: 3px 8px;
    font-size: 12px;
}

.result-row:hover {
    background: #f8faff;
}

.result-row:nth-child(even) {
    background: #fafafa;
}

.result-row:nth-child(even):hover {
    background: #f8faff;
}

.result-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
}

/* ========== 设置面板 ========== */
.settings-panel {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 600px;
    overflow: hidden;
}

.settings-panel.collapsed .settings-body {
    display: none;
}

.settings-body {
    padding: 20px;
}

.settings-body .form-group {
    margin-bottom: 12px;
}

.settings-body .form-group:last-child {
    margin-bottom: 0;
}

.toggle-icon {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 12px;
}

.lang-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0;
}

.lang-checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}

.lang-checkbox-label:hover {
    border-color: var(--primary);
    background: rgba(0, 120, 212, 0.05);
}

.lang-checkbox-label:has(input:checked) {
    background: rgba(0, 120, 212, 0.08);
    border-color: var(--primary);
}

.lang-checkbox {
    accent-color: var(--primary);
}

/* ========== 模态弹窗 ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition);
}

.modal-close:hover {
    background: #f0f0f0;
    color: var(--text);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.7;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ========== Toast 提示 ========== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    z-index: 2000;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}

.toast-visible {
    transform: translateX(-50%) translateY(0);
}

.toast-info {
    background: var(--primary);
}

.toast-success {
    background: var(--success);
}

.toast-warning {
    background: var(--warning);
}

.toast-error {
    background: var(--error);
}

/* ========== 页脚 ========== */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 13px;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .input-section {
        flex-direction: column;
    }

    .input-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .input-sidebar .form-group {
        flex: 1;
        min-width: 120px;
    }

    .input-sidebar .btn {
        width: 100%;
    }

    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .progress-container {
        flex-direction: column;
        align-items: stretch;
    }

    .result-actions {
        flex-wrap: wrap;
    }

    .result-actions .btn {
        flex: 1;
        min-width: 100px;
    }
}