/* 1. RESET Y BASE */
* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #aaabaf; /* Azul de fondo de la web */
    margin: 0;
    padding: 0;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

input, textarea {
    user-select: text;
    width: 100%;
    padding: 8px;
    border: 1px solid #000; /* 🔥 Borde negro finito para marcos */
    border-radius: 4px; /* Un toque redondeado suave */
    font-size: 14px;
    margin-bottom: 5px;
    background-color: #fff; /* Fondo blanco para que el texto resalte */
}

input:focus, textarea:focus {
    border: 2px solid #0B1C2D; /* Borde más grueso y azul al enfocar */
    outline: none;
}

/* 2. CONTENEDOR PRINCIPAL (EL TICKET) */
.container {
    width: 95%;
    max-width: 500px;
    margin: 20px auto;
    background: #f9f9f9; /* 🔥 Gris muy claro de fondo sutil */
    padding: 15px;
    border: 2px solid #000; /* Marco principal del ticket */
    border-radius: 8px;
    height: auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); /* Sombra para que flote */
}

/* 3. CABECERA */
.header {
    text-align: center;
    margin-bottom: 10px;
}

.logo-header {
    width: 100%;
    max-height: 120px;
    object-fit: contain;
    border-bottom: 2px solid #000; /* Línea separadora */
    padding-bottom: 5px;
}

.header h2 {
    margin: 5px 0;
    font-size: 22px;
    letter-spacing: 1px;
    color: #0B1C2D;
}

/* 4. FILAS Y CAMPOS (PROPORCIONES BRA YAN) */
.row {
    display: flex;
    gap: 10px; /* Un toque más de aire entre columnas */
    margin-bottom: 10px;
    width: 100%;
}

.campo {
    display: flex;
    flex-direction: column;
    width: 100%;
}

label {
    font-size: 13px; /* Letra un toque más grande */
    font-weight: bold;
    margin-bottom: 4px;
    margin-top: 12px;
    display: block;
    color: #333;
}

/* Fila Cliente: Prioridad al nombre */
#N_cliente { flex: 4; min-width: 150px; }
#dnicliente { flex: 1.5; }
#domicilio { flex: 2; }

/* Fila Celular */
#marca { flex: 1.2; }
#modelo { flex: 1.2; }
#imei { flex: 1.5; }

.mediano {
    height: 60px;
    resize: none; /* Evita que el cliente lo estire */
}

/* 5. FIRMAS */
.firmas {
    display: flex;
    justify-content: space-between;
    margin-top: 25px; /* Un poco más de aire */
    text-align: center;
}

.firmas div {
    width: 48%;
}

.firmas p {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 14px;
}

canvas {
    border: 1px solid #000; /* 🔥 Borde negro para la firma */
    background: #fff;
    cursor: crosshair;
    width: 100% !important;
    height: 80px !important;
    border-radius: 4px;
}

.firma-img {
    width: 100%;
    max-height: 80px;
    object-fit: contain;
}

/* 6. BOTONES (SE MANTIENEN VERDES) */
.btn-imprimir, .btn-generar {
    display: block;
    margin: 25px auto;
    padding: 12px 30px;
    background: green;
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background 0.2s;
}

.btn-imprimir:hover { background: darkgreen; }

/* 7. MODAL DE FIRMA (SIN CAMBIOS) */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    touch-action: none;
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 20px;
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
}

#firmaGrande {
    width: 100% !important;
    height: 250px !important;
    border: 2px dashed #000;
    background: #f9f9f9;
}

/* 8. REGLAS DE IMPRESIÓN (SIN CAMBIOS CRÍTICOS) */
@media print {
    @page {
        margin: 0; /* Elimina encabezados de fecha/página del navegador */
        size: 80mm auto; 
    }
    
    body {
        background: white !important;
        margin: 0 !important;
        display: block !important;
    }

    .container {
        width: 76mm !important; 
        margin: 0 auto !important; /* Centrado sin margen arriba/abajo */
        padding: 2mm !important;
        border: 2px solid #000 !important;
        page-break-inside: avoid !important; /* Evita que se parta a la mitad */
        display: block !important;
        box-shadow: none !important;
    }

    /* Esto quita el espacio entre las secciones internas */
    .row, .campo, label {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        margin-top: 5px !important; 
    }

    /* Ocultar botones para que no dejen huecos blancos */
    button, .modal, .botonesFirma {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
    }
}
@media print {
    /* Contenedor para centrar la etiqueta en el papel de 80mm */
    .etiqueta-celu-contenedor {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-top: 15px;
    }

    /* El marco recuadrado igual a los de arriba */
    .etiqueta-celu-marco {
        width: 90%; /* Deja un margen pequeño a los costados */
        border: 2px solid #000 !important; /* Marco sólido como el principal */
        padding: 8px;
        text-align: center; /* Centraliza el texto interno */
        page-break-inside: avoid;
    }

    .etiqueta-celu-marco p {
        margin: 4px 0;
        font-size: 13px; /* Tamaño legible para el técnico */
        border-bottom: 1px solid #eee; /* Línea interna suave opcional */
    }
}
.etiqueta-celu-marco {
    border: 2px solid #ffeeee;
    margin: 20px auto;
    padding: 10px;
    width: 80%; /* Para que no toque los bordes del papel térmico */
    text-align: left;
    font-family: Arial, sans-serif;
}