/* Estilos generales */
body {
    font-family: 'Arial', sans-serif;
    line-height: 1.4;
    margin: 0;
    padding: 0;
    color: #333;
    background-color: #f9f9f9;
    font-size: 12px;
    }
    
    .container {
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
    }
    
    /* Encabezado del sitio */
    header {
    background-color: #fff;
    padding: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 15px;
    border-radius: 4px;
    }
    
    header .logo {
    float: left;
    }
    
    header h1 {
    margin: 0;
    font-size: 18px;
    color: #333;
    }
    
    header nav {
    float: right;
    }
    
    header nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    }
    
    header nav ul li {
    display: inline-block;
    margin-left: 10px;
    }
    
    header nav ul li a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
    font-size: 12px;
    }
    
    header:after {
    content: "";
    display: table;
    clear: both;
    }
    
    /* Selector de cliente */
    .cliente-selector {
    background-color: #fff;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 15px;
    }
    
    .selector-form {
    display: flex;
    align-items: center;
    }
    
    .selector-form .form-group {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    }
    
    .selector-form label {
    margin-right: 10px;
    white-space: nowrap;
    }
    
    .selector-form .form-control {
    flex: 1;
    margin-right: 10px;
    }
    
    /* Formulario para agregar servicios */
    .form-agregar-servicio {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    }
    
    .form-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    }
    
    .form-group {
    margin-bottom: 10px;
    margin-right: 10px;
    flex: 1;
    }
    
    .small-group {
    flex: 0 0 80px;
    }
    
    .button-group {
    flex: 0 0 auto;
    margin-right: 0;
    }
    
    .form-control {
    display: block;
    width: 100%;
    padding: 5px 8px;
    font-size: 12px;
    line-height: 1.4;
    color: #495057;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 3px;
    }
    
    /* Documento de Cotización */
    .cotizacion-documento {
    background-color: #fff;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 15px;
    position: relative;
    min-height: 842px; /* Altura mínima para A4 */
    max-height: 842px; /* Altura máxima para A4 */
    }
    
    /* Encabezado de la cotización */
    .cotizacion-header {
    display: flex;
    width: 100%;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    }
    
    .logo-empresa {
    width: 30%;
    padding-right: 15px;
    }
    
    .logo-empresa img {
    max-width: 100%;
    height: auto;
    max-height: 120px; /* Doble del tamaño anterior */
    }
    
    .datos-empresa {
    width: 40%;
    }
    
    .cotizacion-titulo {
    width: 30%;
    text-align: right;
    }
    
    .empresa-info h2 {
    margin: 0 0 5px 0;
    color: #2c3e50;
    font-size: 16px;
    }
    
    .empresa-info p {
    margin: 2px 0;
    color: #555;
    font-size: 11px;
    }
    
    /* Título de la cotización */
    .cotizacion-titulo h1 {
    font-size: 18px;
    color: #2c3e50;
    margin: 0 0 5px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    }
    
    .cotizacion-numero {
    font-size: 14px;
    font-weight: bold;
    color: #e74c3c;
    margin-bottom: 3px;
    }
    
    .cotizacion-fecha {
    font-size: 12px;
    color: #7f8c8d;
    }
    
    /* Datos del cliente */
    .cotizacion-cliente {
    margin-bottom: 15px;
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 4px;
    border-left: 3px solid #3498db;
    }
    
    .cliente-info h3 {
    margin: 0 0 8px 0;
    color: #3498db;
    font-size: 14px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    }
    
    .cliente-datos {
    display: flex;
    flex-direction: column;
    gap: 5px;
    }
    
    .cliente-fila {
    display: flex;
    flex-wrap: wrap;
    }
    
    .cliente-etiqueta {
    font-weight: bold;
    width: 80px;
    color: #7f8c8d;
    font-size: 11px;
    }
    
    .cliente-valor {
    flex: 1;
    margin-right: 15px;
    font-size: 11px;
    }
    
    .cliente-no-encontrado {
    color: #e74c3c;
    font-style: italic;
    font-size: 11px;
    }
    
    /* Tabla de servicios */
    .cotizacion-servicios {
    margin-bottom: 15px;
    }
    
    .cotizacion-servicios h3 {
    color: #2c3e50;
    font-size: 14px;
    margin: 0 0 8px 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    }
    
    .tabla-servicios {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    font-size: 11px;
    }
    
    .tabla-servicios th, .tabla-servicios td {
    padding: 6px 8px;
    text-align: left;
    border: 1px solid #ddd;
    }
    
    .tabla-servicios th {
    background-color: #f2f2f2;
    color: #333;
    font-weight: 600;
    font-size: 11px;
    }
    
    .tabla-servicios tr:nth-child(even) {
    background-color: #f9f9f9;
    }
    
    .cantidad {
    text-align: center;
    width: 8%;
    }
    
    .descripcion {
    width: 52%;
    }
    
    .precio {
    text-align: right;
    width: 20%;
    }
    
    .acciones {
    text-align: center;
    width: 5%;
    }
    
    .subtotal, .iva, .total {
    background-color: #f9f9f9;
    }
    
    .total {
    font-weight: bold;
    background-color: #eaf2f8;
    }
    
    .total-valor {
    color: #2980b9;
    }
    
    .texto-derecha {
    text-align: right;
    font-weight: 600;
    }
    
    .sin-servicios {
    padding: 10px;
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    background-color: #f9f9f9;
    border-radius: 4px;
    font-size: 11px;
    }
    
    /* Condiciones y notas */
    .cotizacion-condiciones {
    display: flex;
    margin-bottom: 15px;
    gap: 15px;
    }
    
    .condiciones-comerciales, .notas-cotizacion {
    flex: 1;
    }
    
    .cotizacion-condiciones h4 {
    color: #2c3e50;
    font-size: 12px;
    margin: 0 0 5px 0;
    }
    
    .cotizacion-condiciones ul {
    padding-left: 20px;
    margin: 0 0 10px 0;
    }
    
    .cotizacion-condiciones li {
    margin-bottom: 3px;
    color: #555;
    font-size: 11px;
    }
    
    .notas-editable {
    min-height: 50px;
    border: 1px solid #ddd;
    padding: 5px;
    border-radius: 3px;
    background-color: #f9f9f9;
    color: #555;
    font-style: italic;
    font-size: 11px;
    }
    
    /* Firma */
    .cotizacion-firma {
    margin: 25px auto 15px;
    width: 200px;
    text-align: center;
    }
    
    .linea-firma {
    border-top: 1px solid #333;
    margin-bottom: 5px;
    }
    
    .nombre-firma {
    margin: 0;
    font-weight: bold;
    font-size: 11px;
    }
    
    /* Pie de página de la cotización */
    .cotizacion-footer {
    margin-top: 20px;
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    border-top: 1px solid #eee;
    padding-top: 10px;
    font-size: 11px;
    }
    
    /* Botones */
    .btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 6px 12px;
    font-size: 12px;
    line-height: 1.4;
    border-radius: 3px;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
    text-decoration: none;
    }
    
    .btn-sm {
    padding: 4px 8px;
    font-size: 11px;
    }
    
    .btn-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    text-decoration: none;
    }
    
    .btn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
    }
    
    .btn-success {
    color: #fff;
    background-color: #28a745;
    border-color: #28a745;
    }
    
    .btn-info {
    color: #fff;
    background-color: #17a2b8;
    border-color: #17a2b8;
    }
    
    .print-button {
    margin-top: 15px;
    text-align: center;
    }
    
    .print-button .btn {
    margin: 0 3px;
    }
    
    /* Pie de página del sitio */
    footer {
    text-align: center;
    padding: 10px 0;
    margin-top: 15px;
    color: #7f8c8d;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-size: 11px;
    }
    
    /* Estilos para impresión */
    @media print {
    @page {
        size: A4;
        margin: 0;
    }
    
    body {
        background-color: #fff;
        font-size: 11pt;
        margin: 0;
        padding: 0;
    }
    
    .container {
        width: 100%;
        max-width: none;
        padding: 15mm;
        margin: 0;
    }
    
    .cotizacion-documento {
        box-shadow: none;
        border: none;
        padding: 0;
        margin: 0;
        min-height: auto;
        max-height: none;
    }
    
    .no-print {
        display: none !important;
    }
    
    header, footer {
        display: none;
    }
    
    .cotizacion-titulo h1 {
        font-size: 18pt;
    }
    
    .tabla-servicios th, .tabla-servicios td {
        padding: 6pt;
    }
    
    /* Mantener el nuevo diseño del encabezado en la impresión */
    .cotizacion-header {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
    }
    
    .logo-empresa {
        width: 30% !important;
        padding-right: 15px !important;
        float: none !important;
        display: block !important;
    }
    
    .logo-empresa img {
        max-height: 120px !important;
        display: block !important;
    }
    
    .datos-empresa {
        width: 40% !important;
        float: none !important;
        display: block !important;
    }
    
    .cotizacion-titulo {
        width: 30% !important;
        text-align: right !important;
        float: none !important;
        display: block !important;
    }
    
    /* Asegurar que la firma aparezca en la impresión */
    .cotizacion-firma {
        page-break-inside: avoid;
    }
    
    /* Evitar saltos de página en elementos importantes */
    .cotizacion-header, .cotizacion-cliente, .cotizacion-servicios h3, .cotizacion-condiciones h4 {
        page-break-after: avoid;
    }
    
    .tabla-servicios {
        page-break-inside: auto;
    }
    
    .tabla-servicios tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    .cotizacion-footer {
        position: fixed;
        bottom: 15mm;
        width: calc(100% - 30mm);
    }
    }
    
    /* Responsive */
    @media (max-width: 768px) {
    .cotizacion-header {
        flex-direction: column;
    }
    
    .logo-empresa, .datos-empresa, .cotizacion-titulo {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }
    
    .cotizacion-condiciones {
        flex-direction: column;
    }
    
    .tabla-servicios {
        display: block;
        overflow-x: auto;
    }
    }