/* Import a modern, clean font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- 1. Root Variables and Base Styles --- */
:root {
    --bg-color: #1a1a1a;
    --surface-color: #2c2c2c;
    --primary-accent: #6a82fb;
    --glass-effect: rgba(255, 255, 255, 0.05);
    --text-color: #f0f0f0;
    --text-muted: #a0a0a0;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: linear-gradient(145deg, var(--bg-color) 0%, #2a2035 100%);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    box-sizing: border-box;
}

/* --- 2. Main Container and Layout --- */
.container {
    width: 100%;
    max-width: 1400px;
    background: none;
    padding: 0;
    box-shadow: none;
}

/* THE NEW LAYOUT: A simple and robust 2-column grid */
.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr; /* Image gets 2/3, sidebar gets 1/3 */
    gap: 1.5rem;
    align-items: start; /* Align items to the top of their grid cell */
    margin-top: 2rem;
}

/* --- THE IMAGE FIX IS HERE --- */
.canvas-container {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px var(--shadow-color);
    border: 1px solid var(--border-color);
}

#imageCanvas {
    width: 100%; /* Fill the container's width */
    height: auto; /* CRITICAL: Height adjusts automatically to maintain aspect ratio */
    display: block; /* Removes any extra space below the canvas */
    cursor: crosshair;
}

/* --- 3. Header and Upload Button --- */
/* (This section remains the same) */
.header { text-align: left; }
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, #fff, #999);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}
p { color: var(--text-muted); margin: 0.5rem 0 0 0; }
#imageLoader { width: 0.1px; height: 0.1px; opacity: 0; overflow: hidden; position: absolute; z-index: -1; }
#imageLoader + label { font-size: 1rem; font-weight: 500; color: white; background-color: var(--primary-accent); padding: 12px 24px; border-radius: 8px; display: inline-block; cursor: pointer; transition: all 0.3s ease; margin-top: 1.5rem; }
#imageLoader + label:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(106, 130, 251, 0.3); }

/* --- 4. Sidebar and Tool Cards --- */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* Space between the zoom and info cards */
}

.tools-container, .color-info-card {
    background: var(--glass-effect);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px var(--shadow-color);
}

h3 { margin-top: 0; font-weight: 600; color: white; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border-color); }
#zoomCanvas { width: 100%; border-radius: 8px; margin-bottom: 0; image-rendering: pixelated; border: 1px solid var(--border-color); }

/* --- THE NO-JUMP FIX IS HERE --- */
.color-info-card {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.color-info-card.hide {
    opacity: 0;
    visibility: hidden; /* Keeps it in the layout, preventing jumps */
    transform: translateY(15px);
}

#color-preview { width: 100%; height: 80px; border-radius: 8px; margin-bottom: 1.5rem; border: 2px solid white; box-shadow: 0 0 15px rgba(0,0,0,0.3); transition: background-color 0.2s ease; }
.color-value { display: flex; justify-content: space-between; align-items: center; background-color: rgba(0, 0, 0, 0.2); padding: 12px; border-radius: 8px; margin-bottom: 0.75rem; }
.color-value p { color: var(--text-color); margin: 0; font-size: 0.9rem; }
.color-value p strong { color: var(--text-muted); }
.color-value button { background: var(--primary-accent); color: white; border: none; border-radius: 6px; padding: 8px 12px; font-size: 0.8rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease; }
.color-value button:hover { background: #5a72e6; transform: scale(1.05); }
.color-value button:active { transform: scale(0.98); }

/* --- 5. Responsive Design --- */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}