* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.coloring-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: fixed;
    touch-action: none;
    background: #f0f0f0;
}

.coloring-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Toppverktygsrad */
.toolbar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: white;
    border-bottom: 2px solid #e0e0e0;
    flex-shrink: 0;
    z-index: 100;
}

.toolbar-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0;
    flex: 1;
    text-align: center;
}

/* Canvas-område */
.canvas-container {
    flex: 1;
    overflow: auto;
    position: relative;
    background: #f8f8f8;
    touch-action: pan-x pan-y;
}

#konvaContainer {
    min-width: 100%;
    min-height: 100%;
    display: inline-block;
}

/* Verktygsrad */
.toolbar {
    background: white;
    border-top: 2px solid #e0e0e0;
    flex-shrink: 0;
    z-index: 100;
    max-height: 30vh;
    overflow-y: auto;
}

/* Färgpalett - horisontell layout */
.color-palette-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.color-btn {
    width: 32px;
    height: 32px;
    border: 3px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.color-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.color-btn.active {
    border-color: #333;
    transform: scale(1.2);
    box-shadow: 0 0 0 2px white, 0 0 0 4px #333;
}

/* Penselstorlekar */
.brush-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.brush-btn:hover {
    border-color: #999;
    background: #f8f8f8;
}

.brush-btn.active {
    border-color: #007bff;
    background: #e7f3ff;
}

.brush-preview {
    background: #333;
    border-radius: 50%;
}

/* Verktyg och zoom */
.tool-btn {
    padding: 0.4rem 0.6rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 1.1rem;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    border-color: #999;
    background: #f8f8f8;
}

.tool-btn:active {
    background: #e0e0e0;
}

.tool-btn.active {
    border-color: #dc3545;
    background: #ffe5e5;
}

/* Knappar */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-outline-secondary {
    background: white;
    color: #666;
    border: 2px solid #ddd;
}

.btn-outline-secondary:hover {
    background: #f8f8f8;
    border-color: #999;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

/* Error container */
.error-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 2rem;
}

.alert {
    max-width: 500px;
    padding: 1.5rem;
    border-radius: 12px;
    background: #fff3cd;
    border: 2px solid #ffc107;
}

.alert-heading {
    margin-top: 0;
    color: #856404;
}

/* Responsiv design för mobil */
@media (max-width: 768px) {
    .toolbar-title {
        font-size: 0.95rem;
    }

    .color-btn {
        width: 28px;
        height: 28px;
        border-width: 2px;
    }

    .brush-btn {
        width: 32px;
        height: 32px;
    }

    .tool-btn {
        padding: 0.3rem 0.5rem;
        font-size: 1rem;
        min-width: 32px;
        height: 32px;
    }
}

/* Extra små skärmar (telefoner i stående läge) */
@media (max-width: 480px) {
    .color-btn {
        width: 26px;
        height: 26px;
    }

    .brush-btn {
        width: 30px;
        height: 30px;
    }

    .tool-btn {
        min-width: 30px;
        height: 30px;
        font-size: 0.95rem;
    }
}

/* Förhindra zoom på iOS */
input, textarea, select {
    font-size: 16px !important;
}

/* Dölj scrollbars i toolbar men behåll scroll-funktionalitet */
.toolbar::-webkit-scrollbar {
    height: 4px;
}

.toolbar::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.toolbar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.toolbar::-webkit-scrollbar-thumb:hover {
    background: #999;
}
