:root {
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transition: background 0.25s ease, color 0.25s ease;
}

body.theme-dark {
    color-scheme: dark;
}

.app-page {
    padding: 40px 16px;
    background: #f6f8fb;
    color: #1f2633;
}

.app-page.theme-dark,
.theme-dark.app-page {
    background: #0f172a;
    color: #e2e8f0;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111827;
    color: #f8fafc;
    padding: 24px;
}

.login-page.theme-light,
.theme-light.login-page {
    background: #e2e8f0;
    color: #1f2633;
}

.login-card {
    width: min(420px, 90vw);
    background: rgba(15, 23, 42, 0.9);
    border-radius: 18px;
    padding: 36px;
    box-shadow: 0 24px 70px rgba(8, 15, 32, 0.6);
    transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.theme-light.login-page .login-card {
    background: #ffffff;
    color: #1f2633;
    box-shadow: 0 24px 70px rgba(205, 213, 224, 0.6);
}

.login-card h1 {
    margin: 0 0 24px;
    font-size: 26px;
    text-align: center;
}

.login-card .lang-switch a {
    color: #dbeafe;
}

.login-card .lang-switch a:hover {
    background: rgba(59, 130, 246, 0.3);
}

.login-card .lang-switch a.active {
    border-color: rgba(191, 219, 254, 0.6);
    background: rgba(59, 130, 246, 0.2);
    color: #f8fafc;
}

.login-card label {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
    color: #cbd5f5;
}

.theme-light.login-page .login-card label {
    color: #334155;
}

.theme-light.login-page .lang-switch a {
    color: #475569;
}

.theme-light.login-page .lang-switch a.active {
    border-color: #2563eb;
    color: #1f2633;
}

.login-card input {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.65);
    color: #f8fafc;
    font-size: 16px;
    transition: border 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.theme-light.login-page .login-card input {
    background: #f5f7fa;
    color: #1f2633;
    border-color: #cbd5f5;
}

.login-card input:focus {
    outline: 2px solid #2563eb;
}

.login-card button {
    margin-top: 20px;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.35);
}

.login-card .error {
    margin-top: 16px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.4);
    color: #fecaca;
    font-size: 14px;
}

.theme-light.login-page .login-card .error {
    background: rgba(248, 113, 113, 0.15);
    border-color: rgba(220, 38, 38, 0.35);
    color: #b91c1c;
}

.container {
    width: 96vw;
    max-width: 1280px;
    margin: 0 auto;
}

.card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
    padding: 40px;
    min-height: 80vh;
    transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.theme-dark .card {
    background: #111827;
    color: #e2e8f0;
    box-shadow: 0 10px 40px rgba(2, 6, 23, 0.6);
}

.lang-switch {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    font-size: 13px;
}

.lang-switch a {
    color: #475569;
    text-decoration: none;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: background 0.2s ease, border 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
}

.lang-switch a:hover {
    background: rgba(148, 163, 184, 0.2);
}

.lang-switch a.active {
    border-color: #1f5fff;
    background: rgba(31, 95, 255, 0.12);
    color: #1f2633;
}

.provider-toggle {
    position: relative;
    width: 70px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(148, 163, 184, 0.15);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    padding: 2px;
    transition: background 0.2s ease, border 0.2s ease;
}

.provider-toggle-label {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    pointer-events: none;
    padding: 0 8px;
}

.provider-toggle-thumb {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 2px;
    width: 32px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
    transition: transform 0.2s ease, background 0.2s ease;
}

.provider-toggle[data-provider="deepseek"] .provider-toggle-thumb {
    transform: translateX(36px);
    background: #1f5fff;
}

.provider-toggle:hover {
    border-color: #1f5fff;
}

.theme-dark .provider-toggle {
    border-color: rgba(96, 165, 250, 0.35);
    background: rgba(59, 130, 246, 0.2);
}

.theme-dark .provider-toggle-label {
    color: #cbd5f5;
}

.theme-dark .provider-toggle-thumb {
    background: #1e293b;
}

.theme-dark .provider-toggle[data-provider="deepseek"] .provider-toggle-thumb {
    background: #2563eb;
}

.theme-button {
    border: none;
    background: transparent;
    color: inherit;
    font-size: 16px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-button:hover {
    background: rgba(148, 163, 184, 0.2);
    transform: translateY(-1px);
}

.theme-button.active {
    background: rgba(31, 95, 255, 0.18);
    color: #1f2633;
}

.theme-dark .theme-button {
    color: #cbd5f5;
}

.login-card .theme-button {
    color: #dbeafe;
}

.theme-light.login-page .theme-button {
    color: #475569;
}

.theme-dark .lang-switch a {
    color: #cbd5f5;
}

.theme-dark .lang-switch a:hover,
.theme-dark .theme-button:hover {
    background: rgba(59, 130, 246, 0.18);
}

.theme-dark .lang-switch a.active,
.theme-dark .theme-button.active {
    border-color: rgba(96, 165, 250, 0.5);
    background: rgba(59, 130, 246, 0.25);
    color: #e2e8f0;
}

.notice {
    background: #fff4e5;
    border: 1px solid #f0c36d;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #8a5700;
}

.theme-dark .notice {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.45);
    color: #cbd5f5;
}

.tabs {
    display: flex;
    border-bottom: 1px solid #e3e8ef;
    margin-bottom: 24px;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    flex-wrap: wrap;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.theme-dark .tabs {
    border-bottom-color: rgba(148, 163, 184, 0.25);
}

.tab-button {
    border: none;
    background: none;
    padding: 12px 16px;
    font-size: 15px;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    color: #64748b;
    transition: background 0.2s ease, color 0.2s ease;
    flex: 0 0 auto;
}

.theme-dark .tab-button {
    color: #cbd5f5;
}

.tab-button.active {
    background: #1f5fff;
    color: #fff;
}

.theme-dark .tab-button.active {
    background: #2563eb;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

textarea {
    width: 100%;
    min-height: 120px;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    padding: 12px;
    font-size: 15px;
    resize: vertical;
    box-sizing: border-box;
    background: #ffffff;
    color: #1f2633;
    transition: border 0.2s ease, background 0.2s ease, color 0.2s ease;
}

textarea[readonly] {
    background: #f5f7fa;
}

.theme-dark textarea {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

.theme-dark textarea[readonly] {
    background: #1e293b;
}

label {
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
    color: #2f3b52;
}

.theme-dark label {
    color: #cbd5f5;
}

.reply-results {
    display: grid;
    gap: 16px;
}

.reply-block {
    background: #f5f7fa;
    border: 1px solid #d9e2ec;
    border-radius: 10px;
    padding: 16px;
    transition: background 0.2s ease, border 0.2s ease;
}

.theme-dark .reply-block {
    background: #1e293b;
    border-color: #334155;
}

.reply-heading {
    font-weight: 600;
    margin-bottom: 10px;
    color: #2f3b52;
}

.theme-dark .reply-heading {
    color: #e2e8f0;
}

.form-row {
    margin-bottom: 20px;
}

.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

button.primary {
    background: #1f5fff;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(31, 95, 255, 0.25);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

button.primary:disabled {
    background: #94a3da;
    cursor: not-allowed;
    box-shadow: none;
}

button.secondary {
    background: #e4e9f3;
    color: #2f3b52;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.theme-dark button.secondary {
    background: #1f2937;
    color: #e2e8f0;
}

.status {
    font-size: 14px;
    color: #465975;
    min-width: 80px;
}

.theme-dark .status {
    color: #cbd5f5;
}

@media (max-width: 640px) {
    .card {
        padding: 24px;
    }

    .tabs {
        flex-wrap: nowrap;
        gap: 6px;
    }

    .tab-button {
        font-size: 14px;
        padding: 10px 12px;
    }
}
