html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    font-family: Arial, sans-serif;
    overflow: hidden;
}

.master-container {
    display: flex;
    height: calc(100vh - 60px);
    margin-top: 60px;
}

.input-panel {
    flex: 0 0 400px;
    background: white;
    padding: 25px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    overflow-y: auto; 
    height: 100%;
    box-sizing: border-box;
    z-index: 10;
}

.label-view-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center; 
    background-color: #e5e5e5;
    height: 100%;
    overflow: hidden;
}

.label-preview {
    width: 100mm;
    height: 150mm;
    background: white;
    padding: 8mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    flex-shrink: 0;
    color: black;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    border: 2px solid black;
    overflow: hidden !important;
}

.header-label-container {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
}

.mini-logo-hand {
    width: 12mm;
    height: 12mm;
    object-fit: contain;
}

.label-free-zone {
    flex: 1;
    font-size: 12px;
    line-height: 1;
    white-space: pre-wrap;
    font-weight: 600;
}

.route-circle {
    position: absolute;
    top: 5mm;
    right: 8mm;
    width: 8mm;
    height: 8mm;
    background-color: black;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 900;
    z-index: 10;
}

.origin-badge {
    background-color: black;
    color: white;
    display: inline-block;
    padding: 3px 12px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    line-height: 1.2;
    text-transform: uppercase;
    align-self: flex-start; 
}

.barcode-section {
    position: absolute;
    top: 26mm;
    left: 8mm;
    right: 8mm;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#barcode {
    width: 100%;
    height: 100px;
    margin-top: 3mm;
}

.barcode-text-container {
    width: 100%;
    text-align: center;
    font-size: 16px;
    font-family: Arial, sans-serif;
    color: black;
    position: relative;
    margin-top: -5px; /* Ajuste para colar no código de barras */
    z-index: 5;
}

.facility-display {
    font-size: 55pt;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 17px;
}

.footer-area {
    position: absolute;
    bottom: 4mm;
    left: 4mm;
    right: 4mm;
    height: 35mm;
    display: flex;
    align-items: flex-end;
}

.recipient-zone {
    flex: 1;
    font-size: 13px;
    line-height: 1;
    padding-right: 5mm;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 5px;   
    font-weight: 600;
}

.qr-zone {
    flex: 0 0 75px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

#qrcode img {
    width: 70px !important;
    height: 70px !important;
}

.address-type-indicator {
    width: 95%;
    height: 25px;
    background-color: black;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 900;
    border-radius: 2px;
    margin-top: 2px;
}

.input-group { margin-bottom: 20px; }
.input-group label { display: block; margin-bottom: 8px; font-weight: bold; font-size: 13px; }

textarea, input[type="text"], input[type="date"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

.address-type-selector {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.address-type-selector input { display: none; }

.selector-btn {
    flex: 1;
    text-align: center;
    padding: 12px;
    border: 2px solid #ccc; 
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

#type-residential:checked + .residencial {
    border-color: #3483fa;
    background: #e3f2fd;
    color: #3483fa;
}

#type-commercial:checked + .comercial {
    border-color: #ff9800;
    background: #fff3e0;
    color: #e65100;
}

.delivery-date-row {
    font-size: 11pt;
    font-weight: bold;
    margin-top: 3mm;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cluster-row {
    font-size: 11pt;
    margin-top: 2mm;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
}

.cluster-number-bold {
    font-weight: 900;
    font-size: 15pt;
}

.id-last-five-highlight {
    font-weight: 800;
    font-size: 18px;
    font-family: Arial, sans-serif;
}

.footer-separator {
    position: absolute;
    bottom: calc(4mm + 27mm + 5px);
    left: 4mm;
    right: 4mm;
    height: 1px;
    background-color: black;
    z-index: 1;
}

.origin-tag {
    position: absolute;
    top: 5px;          
    right: 5px;         
    font-size:12px;    
    font-weight: 600;
    color: rgba(0, 0, 0, 0.6); 
    font-family: "Proxima Nova", sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 100;
    pointer-events: none;
    white-space: nowrap;
}

/* --- REGRAS DE IMPRESSÃO --- */
@media print {
    @page {
        margin: 0;
        size: 100mm 150mm;
    }

    body, html { 
        margin: 0 !important;
        padding: 0 !important;
        height: 150mm !important;
        width: 100mm !important;
        overflow: hidden !important; 
        background: white; 
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Esconde a interface do painel de input */
    .kraken-nav-header, .input-panel { 
        display: none !important; 
    }

    .label-view-area { 
        background: none; 
        display: block !important; 
        padding: 0 !important; 
        margin: 0 !important;
        position: absolute;
        top: 0;
        left: 0;
        width: 100mm;
        height: 150mm;
    }

    .label-preview {
        position: absolute;
        top: 0;           
        left: 0;
        margin: 0 !important;
        padding: 5mm !important; /* Padding reduzido para ganhar espaço interno */
        border: none !important;  /* Remove a borda para não somar na altura total */
        box-shadow: none !important;
        width: 100mm !important;
        height: 150mm !important;
        box-sizing: border-box !important; /* Garante que padding não aumente os 150mm */
        page-break-after: avoid;
        page-break-inside: avoid;
        display: flex !important;
    }

    /* Ajuste de altura do barcode para liberar espaço para o rodapé */
    #barcode {
        height: 85px !important; 
        margin-top: 2mm !important;
    }

    /* Garante que o identificador do site apareça */
    .origin-tag {
        display: block !important;
        top: 2mm !important;
        right: 5mm !important;
        color: rgba(0, 0, 0, 0.6) !important;
        -webkit-print-color-adjust: exact !important;
    }

    /* Trava o rodapé na base da primeira página */
    .footer-area {
        bottom: 3mm !important; 
        height: 32mm !important;
    }

    .footer-separator {
        display: block !important;
        border-top: 1pt solid black !important;
    }

    .route-circle {
        background-color: black !important;
        color: white !important;
        -webkit-print-color-adjust: exact !important;
    }
}
