:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --bg-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-color: #212529;
    --border-color: #dee2e6;
    --accent-bg: #f0f7ff;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --text-color: #e0e0e0;
    --border-color: #333333;
    --accent-bg: #1a2533;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    transition: background 0.3s;
}

.container {
    width: 100%;
    max-width: 900px;
    background-color: var(--surface-color);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}

h1 { color: var(--primary-color); margin: 0; font-size: 1.8em; }

.header-btns { display: flex; gap: 10px; }

.btn-ui {
    background: var(--accent-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: 0.2s;
}
.btn-ui:hover { background: var(--border-color); }

.input-box {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    background: var(--surface-color);
}

.input-box h3 { margin-top: 0; font-size: 0.9rem; color: var(--secondary-color); text-transform: uppercase; letter-spacing: 1px; }

.grid-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) { .grid-inputs { grid-template-columns: 1fr; } }

.drop-zone {
    border: 2px dashed var(--primary-color);
    background: var(--accent-bg);
    padding: 20px;
    text-align: center;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.3s;
}
.drop-zone.dragover { background: var(--primary-color); color: white; }

input, select, textarea {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-color);
    box-sizing: border-box;
    font-size: 0.95rem;
}

button {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    border: none;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
    transition: 0.2s;
}
button:hover { filter: brightness(1.1); }
button:disabled { background: #ccc; cursor: not-allowed; }

.image-display { margin-top: 20px; position: relative; min-height: 100px; text-align: center; }
#mainImage { max-width: 100%; max-height: 500px; border-radius: 10px; display: none; margin: 0 auto; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
    display: none;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.comparison-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: auto;
    overflow: hidden;
    border-radius: 12px;
    display: none;
    cursor: ew-resize;
}
.comparison-container img { width: 100%; display: block; }
.comparison-image-wrapper { position: absolute; top: 0; left: 0; height: 100%; width: 50%; overflow: hidden; }
#new-comparison-image { position: absolute; top: 0; left: 0; height: 100%; width: auto; max-width: none; }
.comparison-slider {
    position: absolute; top: 0; left: 50%; width: 4px; height: 100%;
    background: white; transform: translateX(-50%); z-index: 10;
}
.comparison-slider::after {
    content: '↔'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: var(--primary-color); color: white; border-radius: 50%; width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center; font-weight: bold;
}

.image-actions { display: none; justify-content: center; gap: 10px; margin-top: 15px; }
.btn-action { padding: 10px 18px; border-radius: 5px; text-decoration: none; font-size: 0.9em; font-weight: bold; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.btn-dl { background: var(--primary-color); color: white; border: none; }
.btn-view { border: 1px solid var(--secondary-color); color: var(--secondary-color); background: transparent; }

#editSection { margin-top: 25px; padding: 20px; border: 2px solid var(--primary-color); border-radius: 12px; display: none; background: var(--accent-bg); }

footer { text-align: center; margin-top: 30px; font-size: 0.85em; color: var(--secondary-color); border-top: 1px solid var(--border-color); padding-top: 15px; }