/* Basic Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --bg-light: #f4f7f6;
    --bg-dark: #2c3e50;
    --text-light: #fff;
    --text-dark: #34495e;
    --border-color: #bdc3c7;
}

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Footer */
.header {
    background-color: var(--bg-dark);
    color: var(--text-light);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 1.8rem;
}

.built-by a {
    color: #4dc2ff;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.built-by a:hover {
    color: #87e0ff;
}

.footer {
    margin-top: auto;
    background-color: var(--bg-dark);
    color: var(--secondary-color);
    text-align: center;
    padding: 0.5rem;
    font-size: 0.8rem;
}

/* Main Container */
.image-processor-container {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 20px auto;
    gap: 30px;
}

h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 5px;
}

/* Controls Panel */
.controls-panel {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

#imageInput {
    display: block;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 20px;
}

.controls-buttons {
    display: flex;
    gap: 10px;
}

.controls-buttons button {
    padding: 10px 15px;
    font-size: 1rem;
    background-color: var(--primary-color);
    color: var(--text-light);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.controls-buttons button:hover:enabled {
    background-color: #0056b3;
}

.controls-buttons button:disabled {
    background-color: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

#resetBtn {
    background-color: #dc3545;
}
#resetBtn:hover:enabled {
    background-color: #c82333;
}

/* Image Preview Area */
.image-preview-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.image-container {
    flex: 1;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    text-align: center;
    min-height: 200px; /* Base height */
}

.image-container h3 {
    margin-bottom: 15px;
    color: var(--text-dark);
}

#originalImage {
    max-width: 100%;
    height: auto;
    border: 1px dashed var(--border-color);
    margin: 0 auto;
    display: none; /* Hidden until image is loaded */
}

#processedCanvas {
    display: none; /* Hidden until image is loaded/processed */
    max-width: 100%;
    height: auto;
    border: 1px solid var(--primary-color);
    margin: 0 auto;
}

.placeholder {
    color: var(--secondary-color);
    padding: 50px 0;
    font-style: italic;
}

/* Desktop Layout */
@media (min-width: 768px) {
    .image-processor-container {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .controls-panel {
        width: 300px;
        flex-shrink: 0;
        position: sticky;
        top: 20px; /* Keep controls visible */
    }

    .image-preview-area {
        flex-direction: row;
        flex-grow: 1;
    }
}