:root {
    --bg-color: #0f172a; /* Slate 900 */
    --surface-color: #1e293b; /* Slate 800 */
    --surface-hover: #334155; /* Slate 700 */
    --text-primary: #f8fafc; /* Slate 50 */
    --text-secondary: #94a3b8; /* Slate 400 */
    --accent: #3b82f6; /* Blue 500 */
    --accent-hover: #2563eb; /* Blue 600 */
    --border-color: #334155;
    
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex: 1;
    width: 100vw;
    height: 100vh;
}

/* Toolbar */
.toolbar {
    width: 280px;
    background-color: var(--surface-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    z-index: 10;
    overflow-y: auto;
}

.logo {
    font-size: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.tool-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tool-section h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Color Picker */
.color-picker-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-color);
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

#hex-value {
    font-family: monospace;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Predefined Palette */
.palette {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.active {
    border-color: var(--accent);
    transform: scale(1.15);
    box-shadow: 0 0 0 2px var(--surface-color), 0 0 0 4px var(--accent);
}

/* Tools */
.tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.tool-btn {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.tool-btn svg {
    width: 18px;
    height: 18px;
}

.tool-btn:hover {
    background: var(--surface-hover);
    transform: translateY(-1px);
}

.tool-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: var(--bg-color);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: -6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#size-value {
    text-align: right;
    font-family: monospace;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Actions */
.actions {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.action-btn {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn:hover {
    background: var(--surface-hover);
}

.action-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.action-btn.primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Canvas Area */
.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    background-color: var(--bg-color);
    background-image: 
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    overflow: auto;
    position: relative;
}

canvas {
    background-color: #ffffff; /* Actual drawing board is white by default for Paint */
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.5);
    cursor: crosshair;
    touch-action: none; /* Prevents scrolling when drawing on touch devices */
}
