/* --- 全局与基础样式 --- */
:root {
    --primary-color: #4a69bd;
    --primary-hover: #3c569a;
    --secondary-color: #6c757d;
    --secondary-hover: #5a6268;
    --bg-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-color: #212529;
    --border-color: #dee2e6;
    --drop-zone-bg: #e9ecef;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex-grow: 1;
    width: 100%;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
}

header {
    background: linear-gradient(90deg, var(--primary-color), #6a89cc);
    color: white;
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

#upload-area { padding: 1rem 0; }
#drop-zone {
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem 1rem;
    text-align: center;
    background-color: var(--drop-zone-bg);
    transition: background-color 0.3s, border-color 0.3s;
}
#drop-zone.dragover { background-color: #dbe4f0; border-color: var(--primary-color); }
#drop-zone p { font-size: 1.2rem; margin-bottom: 1rem; }
#workspace { display: flex; gap: 2rem; align-items: flex-start; }
.sidebar { flex: 1; min-width: 280px; background-color: var(--surface-color); border-radius: 8px; padding: 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,0.05); position: relative; }
#file-list { max-height: 500px; overflow-y: auto; margin-top: 1rem; margin-bottom: 1rem; }
.file-item { display: flex; align-items: center; padding: 0.75rem; border-radius: 6px; margin-bottom: 0.5rem; cursor: pointer; transition: background-color 0.2s; border: 1px solid var(--border-color); }
.file-item:hover { background-color: #f1f3f5; }
.file-item.selected { background-color: #dbe4f0; border-color: var(--primary-color); }
.file-item img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; margin-right: 1rem; }
.file-info { flex-grow: 1; overflow: hidden; }
.file-info .name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.file-info .size { font-size: 0.8rem; color: var(--secondary-color); }
.main-panel { flex: 3; background-color: var(--surface-color); border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); overflow: hidden; position: relative; }
.tabs { display: flex; background-color: #e9ecef; }
.tab-btn { flex: 1; padding: 1rem; font-size: 1.1rem; font-weight: 500; border: none; background-color: transparent; cursor: pointer; transition: background-color 0.3s, color 0.3s; border-bottom: 3px solid transparent; }
.tab-btn.active { color: var(--primary-color); background-color: var(--surface-color); border-bottom-color: var(--primary-color); }
.tab-content { padding: 2rem; }
#cropper-container { display: flex; gap: 1.5rem; }
.cropper-workspace { flex: 3; min-height: 400px; background-color: var(--bg-color); border: 1px solid var(--border-color); }
#image-to-crop { display: block; max-width: 100%; }
.cropper-controls { flex: 1; }
#crop-placeholder { text-align: center; padding: 4rem; color: var(--secondary-color); }
.control-group { margin-bottom: 1.5rem; }
.control-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
select { width: 100%; padding: 0.75rem; border-radius: 4px; border: 1px solid var(--border-color); font-size: 1rem; }
.slider-container { display: flex; align-items: center; gap: 1rem; }
input[type="range"] { flex-grow: 1; }
.primary-btn, .secondary-btn { padding: 0.8rem 1.5rem; font-size: 1rem; font-weight: 500; border-radius: 5px; cursor: pointer; border: none; transition: background-color 0.2s, transform 0.1s; }
.primary-btn { background-color: var(--primary-color); color: white; }
.primary-btn:hover { background-color: var(--primary-hover); }
.secondary-btn { background-color: var(--secondary-color); color: white; width: 100%; margin-top: 1rem; }
.secondary-btn:hover { background-color: var(--secondary-hover); }
.action-btn { width: 100%; padding: 1rem; font-size: 1.1rem; }
.hidden { display: none !important; }
#loading-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255, 255, 255, 0.85); z-index: 10; display: flex; flex-direction: column; justify-content: center; align-items: center; backdrop-filter: blur(5px); }
.spinner { width: 60px; height: 60px; border: 6px solid #f3f3f3; border-top: 6px solid var(--primary-color); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 1.5rem; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
#progress-text { font-size: 1.2rem; font-weight: 500; color: var(--text-color); }
button:disabled { background-color: #cccccc !important; border-color: #cccccc !important; cursor: not-allowed; color: #666666 !important; }
button.secondary-btn:disabled { background-color: #a0a0a0 !important; }
footer { text-align: center; padding: 1rem 0; color: #6c757d; border-top: 1px solid var(--border-color); flex-shrink: 0; }
footer a { color: var(--primary-color); text-decoration: none; font-weight: 500; }
footer a:hover { text-decoration: underline; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 1rem; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.modal-overlay.visible { opacity: 1; visibility: visible; }
.modal-content { background-color: var(--surface-color); padding: 2rem; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); position: relative; width: 100%; max-width: 700px; max-height: 90vh; display: flex; flex-direction: column; transform: scale(0.95); transition: transform 0.3s; }
.modal-overlay.visible .modal-content { transform: scale(1); }
.modal-close-btn { position: absolute; top: 10px; right: 15px; background: none; border: none; font-size: 2.5rem; line-height: 1; cursor: pointer; color: #aaa; padding: 0; }
.modal-close-btn:hover { color: #333; }
.modal-content h2 { margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-color); color: var(--primary-color); }
#changelog-content-area { overflow-y: auto; line-height: 1.7; }
#changelog-content-area h2 { font-size: 1.5rem; margin-top: 1.5rem; margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid #eee; }
#changelog-content-area h3 { font-size: 1.2rem; margin-top: 1.2rem; margin-bottom: 0.5rem; }
#changelog-content-area ul { list-style: disc; padding-left: 20px; }
#changelog-content-area li { margin-bottom: 0.5rem; }
#changelog-content-area strong { color: var(--primary-color); }
#changelog-content-area hr { border: 0; border-top: 1px solid #eee; margin: 1.5rem 0; }
@media (max-width: 992px) { #workspace { flex-direction: column; } .sidebar, .main-panel { width: 100%; } }
@media (max-width: 768px) { main { margin: 1rem auto; } header h1 { font-size: 1.8rem; } #drop-zone { padding: 2rem 1rem; } .tab-content { padding: 1rem; } #cropper-container { flex-direction: column; } .modal-content { padding: 1.5rem 1rem; } }
