* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
    user-select: none;
}

@media only screen and (max-width: 600px) {
    body { font-size: 16px; }
    .container { width: 100%; padding: 10px; }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.header {
    background: #007bff;
    color: white;
    padding: 20px;
    text-align: center;
}

.main-content {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    height: 80vh;
}

/* Painel de Elementos */
.elements-panel {
    background: #f8f9fa;
    border-right: 1px solid #ddd;
    padding: 20px;
    overflow-y: auto;
}

.elements-panel h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

.element-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: grab;
    transition: all 0.3s;
}

.element-item:hover {
    background: #e3f2fd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.element-item:active {
    cursor: grabbing;
}

.element-icon {
    font-size: 20px;
    margin-right: 10px;
    width: 25px;
    text-align: center;
}

/* Área de Design */
.design-area {
    position: relative;
    background: #ffffff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.label-canvas {
    width: 600px;
    height: 400px;
    background: white;
    border: 2px solid #007bff;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    background-image:
            linear-gradient(to right, #f0f0f0 1px, transparent 1px),
            linear-gradient(to bottom, #f0f0f0 1px, transparent 1px);
    background-size: 20px 20px;
}

.label-element {
    position: absolute;
    border: 1px dashed transparent;
    cursor: move;
    min-width: 50px;
    min-height: 20px;
    padding: 2px;
}

.label-element:hover {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.1);
}

.label-element.selected {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.1);
    border-style: solid;
}

.label-element.multi-selected {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    border-style: solid;
    border-width: 2px;
}

.label-element .resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #007bff;
    border: 1px solid white;
    border-radius: 50%;
    right: -4px;
    bottom: -4px;
    cursor: se-resize;
}

.text-element {
    font-family: Arial, sans-serif;
    color: #333;
    white-space: nowrap;
}

.barcode-element {
    background: repeating-linear-gradient(
            90deg,
            #000 0px,
            #000 2px,
            #fff 2px,
            #fff 4px
    );
    height: 60px;
    display: flex;
    align-items: end;
    justify-content: center;
    font-size: 10px;
    padding-bottom: 2px;
}

.qrcode-element {
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect width="100" height="100" fill="white"/><rect x="0" y="0" width="30" height="30" fill="black"/><rect x="70" y="0" width="30" height="30" fill="black"/><rect x="0" y="70" width="30" height="30" fill="black"/><rect x="40" y="40" width="20" height="20" fill="black"/></svg>');
    background-size: contain;
    width: 80px;
    height: 80px;
}

.line-element {
    background: #333;
    height: 2px;
    width: 100px;
}

.multi-select-info {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 123, 255, 0.9);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    z-index: 1001;
}

/* Painel de Propriedades */
.properties-panel {
    background: #f8f9fa;
    border-left: 1px solid #ddd;
    padding: 20px;
    overflow-y: auto;
}

.properties-panel h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

.property-group {
    margin-bottom: 20px;
}

.property-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.property-group input,
.property-group select,
.property-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
}

.property-group textarea {
    resize: vertical;
    height: 60px;
}

.toolbar {
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    padding: 15px 20px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.zoom-slider {
    width: 100px;
}

.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 5px;
    padding: 20px;
    text-align: center;
    color: #666;
    margin: 20px;
}

.drop-zone.drag-over {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.1);
}

.code-output {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    margin-top: 20px;
    font-family: monospace;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        height: auto;
    }

    .elements-panel,
    .properties-panel {
        border: none;
        border-bottom: 1px solid #ddd;
    }
}
