/* === 基础变量 === */
:root {
    --primary-color: #2196F3;
    --success-color: #4CAF50;
    --bg-color: #fff;
    --panel-bg: #f8f9fa;
    --border-color: #e0e0e0;
    --text-secondary: #666;
}

[data-theme="dark"] {
    --bg-color: #1e1e1e;
    --panel-bg: #2d2d2d;
    --border-color: #444;
    --text-secondary: #aaa;
}

.tool-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.05);
}

/* === 上传栏 === */
.upload-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--panel-bg);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px dashed var(--border-color);
    margin-bottom: 20px;
    transition: 0.3s;
    cursor: pointer; /* 增加手型指示 */
}
.upload-bar:hover { border-color: var(--primary-color); }

.upload-info {
    display: flex; align-items: center; gap: 10px;
    font-size: 0.9rem; color: var(--text-secondary); font-weight: 500;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

input[type="file"] { display: none; }

/* === 预览区域 === */
.preview-section {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    align-items: stretch; 
}

.img-box {
    flex: 1;
    min-width: 280px;
    background: var(--panel-bg);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-height: 60vh; 
    min-height: 250px;
    padding: 0;
}

.img-box a {
    display: flex; 
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    pointer-events: none; 
}

.img-box a.active {
    pointer-events: auto;
}

.img-box img {
    max-width: 100%;
    max-height: 100%; 
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

.placeholder-text {
    position: absolute;
    font-size: 16px;
    color: #999;
    pointer-events: none;
}

.img-label {
    position: absolute;
    top: 10px; left: 10px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.2;
    pointer-events: none;
    z-index: 2;
}

/* === 风格选择器 === */
.style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}
.style-card {
    background: var(--panel-bg);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 15px 5px;
    text-align: center;
    transition: 0.2s;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
}
.style-card:hover { transform: translateY(-2px); background: rgba(33, 150, 243, 0.05); }
.style-card.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(33, 150, 243, 0.1);
}

/* === 参数面板 === */
.params-panel {
    background: var(--panel-bg);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}
.param-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.param-row:last-child { margin-bottom: 0; }
.param-label { width: 100px; flex-shrink: 0; }
.param-slider { flex: 1; margin: 0 15px; }
.param-value { width: 40px; text-align: right; font-family: monospace; }

/* === 按钮组 === */
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    color: white;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    width: 100%;
    cursor: pointer;
}
.btn-primary { background: var(--primary-color); }
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; transform: none; }

.btn-download { 
    background: var(--success-color); 
    margin-top: 15px; 
    display: none; 
}

/* Loading 动画 */
.loading-spinner {
    width: 20px; height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }