:root {
    --primary-color: #4a6fa5;
    --secondary-color: #166088;
    --background-color: #f8f9fa;
    --toolbar-color: #e9ecef;
    --border-color: #dee2e6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background-color);
    color: #333;
    line-height: 1.6;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 100%;
    overflow: hidden;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
}

button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #0d4b6e;
}

.toolbar {
    background-color: var(--toolbar-color);
    padding: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.tool-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tool-section label {
    font-weight: 500;
}

input[type="color"] {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px;
    cursor: pointer;
}

input[type="text"] {
    width: 70px;
    padding: 0.3rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

input[type="range"] {
    width: 80px;
    cursor: pointer;
}

.canvas-container {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #fff;
    position: relative;
}

#doodle-canvas {
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    cursor: crosshair;
    touch-action: none;
}

.footer {
    background-color: var(--toolbar-color);
    padding: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
}

.color-palette {
    display: flex;
    gap: 0.5rem;
}

.color-swatch {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s;
}

.color-swatch:hover {
    transform: scale(1.1);
    border-color: #333;
}

.undo-redo {
    display: flex;
    gap: 0.5rem;
}

.undo-redo button {
    padding: 0.5rem;
    width: 40px;
    justify-content: center;
}

/* Grid overlay */
.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(#ddd 1px, transparent 1px),
                      linear-gradient(90deg, #ddd 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    opacity: 0.3;
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .tool-section {
        width: 100%;
        justify-content: space-between;
    }
    
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-controls {
        width: 100%;
        justify-content: center;
    }
}