:root {
    --primary-color: #007AFF;
    --background-color: #F5F5F7;
    --card-background: #FFFFFF;
    --text-color: #1D1D1F;
    --border-radius: 12px;
}

body {
    margin: 0;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.5;
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

h1 {
    text-align: center;
    font-size: 2em;
    font-weight: 600;
    margin: 0 0 20px;
}

.main-container {
    display: flex;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    flex: 1;
    min-height: 0;
    width: 100%;
}

.input-section, .output-section {
    flex: 1;
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.section-title {
    font-size: 1.2em;
    font-weight: 500;
    margin: 0 0 15px 0;
    color: var(--text-color);
}

.input-area {
    flex: 1;
    min-height: 0;
    padding: 15px;
    border: 1px solid #E5E5E5;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-family: inherit;
    margin-bottom: 20px;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
    background: white;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    outline: none;
}

.input-area:empty::before {
    content: attr(placeholder);
    color: #999;
}

.input-area:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    align-self: flex-end;
    min-width: 120px;
}

button:hover {
    background-color: #0066DD;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:active {
    transform: translateY(0);
    box-shadow: none;
}

#result {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.loading {
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    body {
        padding: 15px;
    }

    .input-section, .output-section {
        padding: 15px;
    }
}

.corrected-text {
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: white;
    border-radius: 0 var(--border-radius) var(--border-radius) var(--border-radius);
    border: 1px solid #e5e5e5;
    overflow-y: auto;
    scroll-behavior: smooth;
    margin-top: 0;
    flex: 1;
    min-height: 0;
}

.highlight {
    background-color: #fff3cd;
    padding: 0 2px;
    border-radius: 2px;
    border-bottom: 2px solid #ffc107;
}

#result.loading {
    padding: 20px;
    background-color: #F8F8F8;
}

.highlighted-text {
    flex: 1;
    min-height: 400px;
    padding: 15px;
    border: 1px solid #E5E5E5;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-family: inherit;
    background: white;
    overflow-y: auto;
    margin-bottom: 20px;
    box-sizing: border-box;
    white-space: pre-wrap;
}

.highlight-old {
    background-color: #ffe6e6;
    padding: 0 2px;
    border-radius: 2px;
    border-bottom: 2px solid #ff8080;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.highlight-old:hover {
    background-color: #ffd6d6;
}

.change-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 10px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.change-item:last-child {
    border-bottom: none;
}

.change-number {
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.change-content {
    flex: 1;
    line-height: 1.6;
}

.highlight-item {
    background-color: #f8f8f8;
    border-radius: var(--border-radius);
}

.change-checkbox {
    margin-top: 4px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

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

#applyChanges {
    margin-top: 20px;
    align-self: flex-end;
    width: auto;
}

#applyChanges:disabled {
    background-color: #E5E5E5;
    color: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#applyChanges:not(:disabled):hover {
    background-color: #0066DD;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.final-text {
    padding: 15px;
    background: #f8f8f8;
    border-radius: var(--border-radius);
    margin-top: 20px;
    white-space: pre-wrap;
}

.result-tabs {
    margin-bottom: 0;
    border-bottom: none;
    display: flex;
    gap: 4px;
    position: relative;
    padding: 0 4px;
    height: 45px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0 24px;
    height: 100%;
    font-size: 14px;
    color: #999;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    font-weight: 500;
    border-radius: 8px 8px 0 0;
    opacity: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: var(--primary-color);
    background-color: rgba(0, 122, 255, 0.05);
    transform: none;
    opacity: 0.9;
}

.tab-btn.active {
    color: var(--primary-color);
    background-color: rgba(0, 122, 255, 0.1);
    border-bottom: 2px solid var(--primary-color);
    opacity: 1;
    font-weight: 600;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    opacity: 0.5;
}

.tab-btn:hover::after {
    transform: scaleX(0.8);
}

.tab-btn.active::after {
    transform: scaleX(1);
    opacity: 1;
}

.result-view {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.result-view.active {
    opacity: 1;
    pointer-events: auto;
}

.result-view {
    transform: none;
}

.result-view.active {
    transform: none;
}

.text-content {
    position: relative;
    display: inline-block;
    min-width: 200px;
    padding-bottom: 20px;
}

.copy-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-left: 4px;
    padding: 0;
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    border-radius: 3px;
    background-color: transparent;
    color: #999;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
    flex-shrink: 0;
    box-shadow: none;
}

.copy-btn:hover {
    color: var(--primary-color);
    background-color: transparent;
    transform: none;
    box-shadow: none;
}

.copy-btn:active {
    transform: none;
    box-shadow: none;
}

.copy-btn.copied {
    color: #2e7d32;
    background-color: transparent;
}

.copy-btn svg {
    width: 14px;
    height: 14px;
    display: block;
}

.text-content p {
    display: inline;
    margin: 0;
}

.change-reason {
    margin-top: 4px;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.changes-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    min-height: 0;
    position: relative;
    height: 100%;
}

.changes-list > div {
    position: relative;
    width: 100%;
}

.change-item {
    position: absolute;
    left: 0;
    right: 0;
    background: white;
    transition: background-color 0.2s ease;
    padding: 10px;
    border-bottom: 1px solid #eee;
    box-sizing: border-box;
}

.corrected-text::-webkit-scrollbar,
.changes-list::-webkit-scrollbar {
    width: 8px;
}

.corrected-text::-webkit-scrollbar-track,
.changes-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.corrected-text::-webkit-scrollbar-thumb,
.changes-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.corrected-text::-webkit-scrollbar-thumb:hover,
.changes-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.change-text {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0;
    padding: 8px;
    background: #f8f8f8;
    border-radius: 8px;
}

.original-text {
    color: #d32f2f;
    text-decoration: line-through;
    padding: 4px 8px;
    background: #ffebee;
    border-radius: 4px;
}

.arrow {
    color: #666;
    text-align: center;
    font-size: 12px;
}

.modified-text {
    color: #2e7d32;
    padding: 4px 8px;
    background: #e8f5e9;
    border-radius: 4px;
}

.change-paragraph {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.button-group {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

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

.secondary-btn:hover {
    background-color: rgba(0, 122, 255, 0.1);
    transform: translateY(-1px);
}

.secondary-btn:active {
    background-color: rgba(0, 122, 255, 0.2);
    transform: translateY(0);
}

.highlight-old.invalid {
    background-color: #fff3cd;
    border-bottom: 2px dashed #ffc107;
    cursor: help;
}

.highlight-old.invalid:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
}

.highlight-old.uncertain {
    background-color: #fff3cd;
    border-bottom: 2px dashed #ffc107;
    cursor: help;
}

.highlight-old.uncertain:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
}

.change-item.uncertain {
    background-color: rgba(255, 244, 229, 0.5);
}

.change-item.uncertain .change-number {
    background-color: #ffc107;
}

.warning {
    color: #856404;
    background-color: #fff3cd;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-block;
    margin-top: 4px;
}

.highlight-old.uncertain[data-confidence="较高"] {
    background-color: #fff3cd;
    border-bottom: 2px solid #ffc107;
}

.highlight-old.uncertain[data-confidence="较低"] {
    background-color: #ffe6e6;
    border-bottom: 2px dashed #ff8080;
    opacity: 0.8;
}

.change-item.uncertain[data-confidence="较高"] {
    background-color: rgba(255, 244, 229, 0.5);
}

.change-item.uncertain[data-confidence="较低"] {
    background-color: rgba(255, 230, 230, 0.5);
    opacity: 0.9;
}

.change-item.uncertain {
    background-color: #fff3cd;
    opacity: 0.8;
}

.change-item.uncertain .change-checkbox {
    opacity: 0.5;
    cursor: not-allowed;
}

.notice {
    margin-top: 16px;
    padding: 12px;
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    color: #856404;
    font-size: 14px;
    line-height: 1.4;
}

.change-reason {
    margin-top: 4px;
    font-size: 14px;
    color: #666;
} 