/*
================================================================================
DRAWAZULAI - ESTILOS CSS
================================================================================
Arquivo: styles.css
Descri��o: Estilos para o .color-palette {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    align-items: center;
    justify-items: center;
    margin: 10px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
} DrawAzulai
Organiza��o:
1. Reset e Base
2. Layout Principal
3. Toolbar
4. Canvas e Elementos
5. Componentes UI
6. Modais
7. Responsividade
================================================================================
*/

/* ===== 1. RESET E BASE ===== */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
}

/* ===== 2. LAYOUT PRINCIPAL ===== */
.main-content {
    flex: 1;
    margin-left: 290px; /* 280px (largura menu) + 10px (espaçamento) */
    padding: 10px;
    height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* ===== 3. TOOLBAR ===== */
#toolbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 1000;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Se��es da Toolbar */
.toolbar-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 8px;
    margin: 6px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.section-title {
    font-size: 11px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: block;
}

/* Bot�es Customizados */
.btn-custom {
    border-radius: 6px;
    font-weight: 500;
    font-size: 11px;
    padding: 6px 10px;
    margin: 2px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
    width: calc(50% - 4px);
    text-align: left;
}

.btn-custom.full-width {
    width: calc(100% - 6px);
}

.btn-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-custom.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-color: #667eea !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
    transform: translateY(-1px);
}

.btn-custom.active:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-color: #667eea !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5) !important;
}

/* Estilos espec�ficos dos bot�es */
.btn-outline-primary.btn-custom {
    background: white;
    border-color: #e9ecef;
    color: #495057;
}

.btn-outline-primary.btn-custom:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #495057;
}

.btn-outline-secondary.btn-custom {
    background: white;
    border-color: #e9ecef;
    color: #6c757d;
}

.btn-outline-warning.btn-custom {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-color: #ffc107;
    color: #856404;
}

.btn-outline-danger.btn-custom {
    background: linear-gradient(135deg, #ffafbd 0%, #ffc3a0 100%);
    border-color: #dc3545;
    color: #721c24;
}

.btn-outline-success.btn-custom {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-color: #28a745;
    color: #155724;
}

.btn-outline-info.btn-custom {
    background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%);
    border-color: #17a2b8;
    color: #0c5460;
}

/* Brand Section */
.brand-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-icon {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.app-title {
    color: white;
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

.app-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 10px;
    margin: 0;
    font-weight: 400;
}

/* ===== 4. CANVAS E ELEMENTOS ===== */
canvas {
    display: block;
    background: rgba(255, 255, 255, 0.95); /* Semi-transparente para permitir grid */
    cursor: crosshair;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: calc(100% - 20px); /* 10px margem de cada lado */
    height: calc(100vh - 40px); /* Altura total menos margem superior e inferior */
    min-width: 300px;
    min-height: 200px;
    position: relative;
    z-index: 5;
    margin: 10px;
    box-sizing: border-box;
}

.selection-box {
    position: absolute;
    border: 2px dashed #667eea;
    background-color: rgba(102, 126, 234, 0.1);
    pointer-events: none;
    display: none;
    border-radius: 4px;
}

/* ===== 5. COMPONENTES UI ===== */

/* Paleta de Cores */
.color-palette {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.color-option {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.color-option.selected {
    border-color: #fff;
    transform: scale(1.15);
    box-shadow: 0 0 0 2px #667eea, 0 4px 12px rgba(0, 0, 0, 0.3);
}

.color-option.selected::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 12px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Indicador de cor atual */
.current-color-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-bottom: 12px;
}

.color-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.current-color-display {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #ddd, 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.color-code {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #555;
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 50px;
    text-align: center;
}

#color-picker-container {
    transition: all 0.3s ease;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
}

#pencil-btn.active ~ .toolbar-section #color-picker-container,
.show-colors #color-picker-container {
    opacity: 1;
    max-height: 60px;
}

/* ===== 5.2. ESTILOS DE LINHA ===== */
#line-style-section {
    transition: all 0.3s ease;
}

.line-style-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.control-label {
    font-size: 10px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

/* Seletores de Tipo de Linha */
.line-type-selector,
.line-width-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.btn-line-type,
.btn-line-width {
    flex: 1;
    min-width: calc(33.33% - 3px);
    padding: 6px 4px;
    margin: 0;
    font-size: 9px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: white;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.btn-line-type:hover,
.btn-line-width:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
    transform: translateY(-1px);
}

.btn-line-type.active,
.btn-line-width.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-color: #667eea !important;
    transform: translateY(-1px);
}

/* Previews das Linhas */
.line-preview {
    width: 20px;
    height: 3px;
    background: currentColor;
    border-radius: 1px;
}

.solid-line {
    background: currentColor;
}

.dashed-line {
    background: linear-gradient(to right, currentColor 4px, transparent 4px);
    background-size: 8px 100%;
    background-repeat: repeat-x;
}

.dotted-line {
    background: linear-gradient(to right, currentColor 2px, transparent 2px);
    background-size: 4px 100%;
    background-repeat: repeat-x;
}

/* Previews das Espessuras */
.width-preview {
    width: 20px;
    background: currentColor;
    border-radius: 1px;
}

.width-1 { height: 1px; }
.width-2 { height: 2px; }
.width-4 { height: 4px; }
.width-6 { height: 6px; }

/* Estados Ativos dos Controles */
.btn-line-type.active .line-preview,
.btn-line-width.active .width-preview {
    background: white;
}

.btn-line-type span,
.btn-line-width span {
    font-size: 8px;
    font-weight: 500;
    text-align: center;
    line-height: 1;
}

/* ===== 6. MODAIS ===== */
.help-modal .modal-dialog {
    max-width: 900px;
}

.help-modal .modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.help-modal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0;
    border: none;
}

.help-modal .modal-title {
    font-weight: 700;
    font-size: 24px;
}

.help-modal .btn-close {
    filter: invert(1);
}

.help-section {
    margin-bottom: 25px;
    padding: 15px;
    border-radius: 10px;
    background: #f8f9fa;
    border-left: 4px solid #667eea;
}

.help-section h5 {
    color: #667eea;
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 18px;
}

.tool-item {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.tool-icon {
    width: 40px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 5px;
    margin-right: 12px;
    font-size: 16px;
    border: 1px solid #dee2e6;
}

.tool-description h6 {
    margin: 0 0 4px 0;
    font-weight: 600;
    color: #495057;
}

.tool-description p {
    margin: 0;
    font-size: 13px;
    color: #6c757d;
    line-height: 1.4;
}

.help-tip {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #2196f3;
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
}

.help-tip .tip-icon {
    color: #1976d2;
    font-weight: bold;
    margin-right: 8px;
}

/* ===== 7. RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    #toolbar {
        width: 100%;
        height: auto;
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
    }
    
    .main-content {
        margin-left: 0;
        height: auto;
        padding: 10px;
    }
    
    canvas {
        margin: 5px;
        width: calc(100% - 10px);
        height: calc(100vh - 180px);
    }
    
    .toolbar-section {
        padding: 8px;
        margin: 8px 0;
    }
    
    .btn-custom {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .app-title {
        font-size: 16px;
    }
    
    .brand-section {
        margin-bottom: 15px;
    }
}

/* ===== GRID E ALINHAMENTO ===== */

/* Grid Canvas */
#grid-canvas {
    pointer-events: none;
    z-index: 1 !important;
    position: absolute !important;
}

/* Grid Controls */
.grid-spacing-controls {
    margin: 5px 0;
    width: 100%;
}

.grid-spacing-controls .btn {
    font-size: 11px;
    padding: 4px 8px;
    flex: 1;
    border-radius: 4px;
}

.grid-spacing-controls .btn.active {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

/* Alignment Controls */
.alignment-controls {
    width: 100%;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 8px;
}

.align-group {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}

.align-group:last-child {
    margin-bottom: 0;
}

.align-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    min-width: 55px;
    text-align: left;
}

.align-group .btn {
    font-size: 10px;
    padding: 3px 6px;
    min-width: 28px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
}

.align-group .btn i {
    font-style: normal;
    font-size: 10px;
}

/* Grid Button States */
#grid-btn.active {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-color: #28a745;
    color: white;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

#snap-btn.active {
    background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%);
    border-color: #17a2b8;
    color: white;
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
}

/* Alignment Hover Effects */
.align-group .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-outline-primary.btn-sm:hover {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
}

.btn-outline-success.btn-sm:hover {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.btn-outline-warning.btn-sm:hover {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
}

/* Responsive Grid Controls */
@media (max-width: 768px) {
    .alignment-controls {
        padding: 6px;
    }
    
    .align-group {
        gap: 2px;
        margin-bottom: 4px;
    }
    
    .align-label {
        font-size: 10px;
        min-width: 45px;
    }
    
    .align-group .btn {
        min-width: 24px;
        height: 20px;
        padding: 2px 4px;
        font-size: 9px;
    }
    
    .grid-spacing-controls .btn {
        font-size: 10px;
        padding: 3px 6px;
    }
}

/* ===== IMPRESS�O ===== */
@media print {
    #toolbar,
    .help-modal {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    canvas {
        margin: 0;
        width: 100%;
        height: auto;
    }
}

/* ===== BARRA DE CORES CIRCULARES ===== */
.color-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.color-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.color-circle:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
}

/* SELEÇÃO ÚNICA FORÇADA - Apenas uma cor por vez */
.color-circle {
    border: 2px solid rgba(0, 0, 0, 0.2) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    transform: scale(1) !important;
}

.color-circle::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    color: transparent !important;
    font-weight: bold !important;
    font-size: 14px !important;
    text-shadow: none !important;
}

.color-circle.selected {
    border: 3px solid #fff !important;
    box-shadow: 0 0 0 2px #000000, 0 4px 8px rgba(0, 0, 0, 0.3) !important;
    transform: scale(1.1) !important;
}

.color-circle.selected::after {
    content: '✓' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    color: white !important;
    font-weight: bold !important;
    font-size: 14px !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8) !important;
}

/* GARANTIR que cores para branco tenham tick preto */
.color-circle[data-color="#ffffff"].selected::after,
.color-circle[data-color="#f8f9fa"].selected::after,
.color-circle[data-color="#e9ecef"].selected::after {
    color: black !important;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8) !important;
}

/* Exceção para cor branca - usar checkmark escuro */
.color-circle[data-color="#ffffff"].selected::after {
    color: #333;
    text-shadow: none;
}
