/* --- Variables & Themes --- */
:root {
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #dddddd;
    --accent-primary: #28a745; 
    --accent-hover: #218838;
    --accent-reset: #fd7e14;
    --accent-reset-hover: #e36d0b;
    --drop-zone-bg: #f9f9f9;
    --drop-zone-border: #cccccc;
    --shadow: 0 8px 24px rgba(0,0,0,0.1);
    --radius: 16px;
    --font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: #18191a;
        --bg-card: #242526;
        --text-main: #e4e6eb;
        --text-muted: #b0b3b8;
        --border-color: #3e4042;
        --drop-zone-bg: #323436;
        --drop-zone-border: #4e4f50;
        --shadow: 0 8px 24px rgba(0,0,0,0.4);
    }
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px 0; 
    transition: background-color 0.3s, color 0.3s;
}

.main-container {
    width: 100%;
    max-width: 900px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.app-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 10px;
}

.workspace {
    background-color: var(--bg-card);
    width: 100%;
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background-color 0.3s;
}

/* --- Drag & Drop Zone --- */
.drop-zone {
    width: 100%;
    border: 2px dashed var(--drop-zone-border);
    border-radius: var(--radius);
    background-color: var(--drop-zone-bg);
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    transition: all 0.2s;
    cursor: pointer;
}
.drop-zone.drag-over {
    border-color: var(--accent-primary);
    background-color: rgba(40, 167, 69, 0.1);
}
.drop-text { font-size: 1.2rem; font-weight: 600; }
.drop-subtext { color: var(--text-muted); font-size: 0.9rem; }

/* --- Controls --- */
.controls-container {
    margin-top: 30px;
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}
.control-group { width: 100%; display: flex; flex-direction: column; align-items: center; }
label { margin-bottom: 8px; font-weight: 500; font-size: 0.9rem; color: var(--text-muted); }
select, input[type="number"] {
    width: 100%; padding: 12px; border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-body); color: var(--text-main);
    font-size: 1rem; outline: none; text-align: center;
}

.custom-panel {
    display: flex; gap: 20px; width: 100%; justify-content: center;
    background: var(--bg-body); padding: 15px; border-radius: 8px;
    margin-top: 10px;
}
.input-wrapper { display: flex; flex-direction: column; align-items: center; }

/* --- Buttons --- */
.btn {
    border: none; padding: 12px 24px; border-radius: 50px;
    font-size: 1rem; font-weight: 600; cursor: pointer;
    transition: transform 0.1s, background-color 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background-color: var(--accent-primary); color: white; min-width: 150px; }
.btn-primary:hover { background-color: var(--accent-hover); }
.btn-action {
    background-color: var(--text-main); color: var(--bg-card);
    margin-top: 20px; width: 100%; max-width: 300px;
}
.file-count { margin-top: 15px; color: var(--accent-primary); font-weight: 600; }

/* --- Progress Bar --- */
.progress-bar-container {
    width: 100%; height: 10px; background-color: var(--border-color);
    border-radius: 5px; overflow: hidden; margin-top: 15px; min-width: 300px;
}
.progress-bar { width: 0%; height: 100%; background-color: var(--accent-primary); transition: width 0.3s ease; }

/* --- Result & Preview Fix --- */
.preview-wrapper {
    width: 100%;
    max-height: 70vh; 
    overflow: auto;   
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 30px;
    background-color: var(--drop-zone-bg);
    padding: 10px;
}

#preview-image {
    max-width: 100%;
    max-height: 100%; 
    object-fit: contain; 
    display: block;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.action-buttons { display: flex; gap: 20px; justify-content: center; }
.btn-reset { background-color: var(--accent-reset); color: white; }
.btn-reset:hover { background-color: var(--accent-reset-hover); }
.btn-download { background-color: var(--accent-primary); color: white; }

.hidden { display: none !important; }