:root {
    /* Dark Mode (Default) */
    --bg-color: #000000;
    --panel-bg: rgba(20, 20, 20, 0.8);
    --text-color: #f0f0f0;
    --accent-color: #9EB001;
    --accent-hover: #b3c701;
    --border-color: rgba(158, 176, 1, 0.2);
    --shadow-color: rgba(158, 176, 1, 0.1);
    --border-radius: 12px;
}

.light-mode {
    /* Light Mode */
    --bg-color: #f8fafc;
    --panel-bg: rgba(255, 255, 255, 0.9);
    --text-color: #1e293b;
    --accent-color: #849201;
    /* Slightly darker green for contrast on white */
    --accent-hover: #6a7501;
    --border-color: #cbd5e1;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Outfit', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 95%;
    max-width: 1600px;
    /* Wider for 1080p+ screens */
    height: 90vh;
    /* Fill more vertical space */
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 0 50px var(--shadow-color);
    border: 1px solid var(--border-color);
    position: relative;
    /* For absolute positioning of toggle */
    overflow-y: auto;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

.header-content {
    display: block;
    margin-bottom: 0.5rem;
}

header h1 {
    font-size: 3rem;
    margin: 0;
    color: var(--accent-color);
    background: none;
    -webkit-text-fill-color: initial;
    font-weight: 700;
    letter-spacing: -1px;
}

header h1 {
    font-size: 2.5rem;
    margin: 0;
    color: var(--accent-color);
    /* Use accent color instead of gradient */
    background: none;
    -webkit-text-fill-color: initial;
}

main {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    height: calc(100% - 100px);
    /* Fill remaining height */
}

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

.controls-panel {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: var(--border-radius);
}

.parameter-group {
    margin-bottom: 1.2rem;
}

.parameter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
    opacity: 0.9;
}

.param-desc {
    font-weight: 400;
    font-size: 0.8rem;
    opacity: 0.6;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent-color);
}

select {
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    background: #334155;
    color: white;
    border: 1px solid #475569;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input {
    width: auto;
}

button {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(45deg, var(--accent-color), var(--accent-hover));
    border: none;
    border-radius: var(--border-radius);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    margin-top: 1rem;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(158, 176, 1, 0.4);
}

button:active {
    transform: translateY(0);
}

.custom-file-upload {
    display: inline-block;
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    background: #334155;
    border-radius: var(--border-radius);
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    margin-bottom: 1.5rem;
    border: 1px dashed #64748b;
    transition: 0.2s;
}

.custom-file-upload:hover {
    background: #475569;
    border-color: var(--accent-color);
}

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

.preview-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.image-container {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--border-radius);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.image-container img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
}

.image-container h3 {
    position: absolute;
    top: 10px;
    left: 10px;
    margin: 0;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none;
}

.placeholder {
    color: #64748b;
    font-style: italic;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border-left-color: var(--accent-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.download-btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    background: var(--accent-color);
    color: #000;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: bold;
    transition: 0.2s;
}

.download-btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(158, 176, 1, 0.4);
}