body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    background-color: #f0f2f5;
    color: #333;
    padding: 20px;
    box-sizing: border-box;
}

#root {
    display: flex;
    flex-direction: row;
    gap: 20px;
    background-color: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 1200px;
    width: 100%;
    flex-wrap: wrap;
}

.controls-panel {
    flex: 1;
    min-width: 280px;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-right: 20px;
    border-right: 1px solid #eee;
}

.controls-panel h2 {
    color: #2c3e50;
    margin-top: 0;
    font-size: 1.6em;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-weight: bold;
    color: #555;
    margin-bottom: 4px;
}

input[type="checkbox"] {
    margin-right: 8px;
}

select, input[type="range"], button {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1em;
    outline: none;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

select:focus, input[type="range"]:focus, button:focus {
    border-color: #6a0dad;
    box-shadow: 0 0 0 3px rgba(106, 13, 173, 0.2);
}

button {
    background-color: #6a0dad;
    color: white;
    cursor: pointer;
    border: none;
    margin-top: 10px;
    font-weight: bold;
}

button:hover {
    background-color: #5a0c9a;
}

button + button {
    margin-left: 10px;
}

.palette-preview {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

.color-box {
    width: 25px;
    height: 25px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.canvas-container {
    flex: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    padding: 10px;
}

canvas {
    display: block;
    border: 1px solid #ccc;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    background-color: white;
}

.technical-sheet {
    flex: 1 1 100%;
    margin-top: 20px;
    padding: 25px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    max-width: 100%;
}

.technical-sheet h3 {
    color: #2c3e50;
    margin-top: 0;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.technical-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.color-chart {
    margin: 20px 0;
}

.color-chart table {
    width: 100%;
    border-collapse: collapse;
}

.color-chart th,
.color-chart td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.color-sample {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 1px solid #ccc;
    vertical-align: middle;
    margin-right: 10px;
}

.symbol {
    font-size: 1.2em;
    font-weight: bold;
}

.mini-canvas-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 400px;
    border: 2px solid #333;
    margin: 20px auto;
    background: white;
}

.grid-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.grid-line-v,
.grid-line-h {
    position: absolute;
    background-color: #ccc;
}

.grid-line-v {
    width: 1px;
    height: 100%;
}

.grid-line-h {
    height: 1px;
    width: 100%;
}

.print-info {
    margin-top: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-left: 4px solid #6a0dad;
    border-radius: 4px;
}

@media print {
    body * {
        visibility: hidden;
    }
    
    .technical-sheet, .technical-sheet * {
        visibility: visible;
    }
    
    .technical-sheet {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 15mm;
        box-shadow: none;
        border: none;
        background: white;
    }

    .technical-info {
        page-break-inside: avoid;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .color-chart {
        page-break-inside: avoid;
    }
    
    .grid-overlay {
        page-break-inside: avoid;
    }
    
    .mini-canvas-container {
        width: 100mm;
        height: 100mm;
        border: 1pt solid #000;
        margin: 10px 0;
    }
    
    .mini-canvas {
        width: 100% !important;
        height: 100% !important;
    }
    
    /* Force grid lines to print */
    .mini-canvas-container::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-image: 
            repeating-linear-gradient(0deg, #ccc 0, #ccc 0.5pt, transparent 0.5pt, transparent calc(100% / ${size})),
            repeating-linear-gradient(90deg, #ccc 0, #ccc 0.5pt, transparent 0.5pt, transparent calc(100% / ${size}));
        pointer-events: none;
    }
    
    .print-info {
        display: none;
    }
    
    /* Ensure colors print */
    * {
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
}

@page {
    margin: 15mm;
    size: A4;
}