body {
    background-color: #f2f3f5;
    margin: 0;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.actions-bar {
    max-width: 800px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.actions-bar .btn-back {
    margin-inline-start: auto;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-back {
    background-color: #e9ecef;
    color: #495057;
}

.btn-back:hover {
    background-color: #dee2e6;
    color: #212529;
}

.btn-print-top {
    background-color: #0d6efd;
    color: #fff;
}

.btn-print-top:hover {
    background-color: #0b5ed7;
    color: #fff;
}

.invoice-container {
    max-width: 800px;
    margin: 0 auto;
    background-color: #fff;
    padding: 40px;
    box-shadow: 0 0 15px rgba(0,0,0,0.05);
    border-radius: 8px;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    border-bottom: 2px solid #f8f9fa;
    padding-bottom: 20px;
}

.company-info h2 {
    color: #0d6efd;
    margin-top: 0;
    margin-bottom: 10px;
}

.company-info p {
    margin: 5px 0;
    color: #555;
    font-size: 14px;
}

.invoice-details {
    text-align: right;
}

[dir="rtl"] .invoice-details {
    text-align: left;
}

.invoice-details h3 {
    margin-top: 0;
    color: #333;
}

.invoice-meta {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
}

.customer-section {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.customer-details p {
    margin: 5px 0;
    font-size: 15px;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.invoice-table th {
    background-color: #0d6efd;
    color: #fff;
    padding: 12px 15px;
    text-align: center;
    font-weight: 500;
}

[dir="rtl"] .invoice-table th {
    text-align: center;
}

.invoice-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #dee2e6;
    color: #333;
    text-align: center;
}

.text-end {
    text-align: right;
}

[dir="rtl"] .text-end {
    text-align: left;
}

.total-section {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 40px;
}

[dir="rtl"] .total-section {
    justify-content: flex-end; /* Keep it right/left aligned depending on logic but usually total is at the end */
    /* Actually for RTL flex-end puts it on the left, we want it on the left? No, usually totals are aligned with the price column */
}

.total-box {
    width: 250px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.total-row.final {
    border-bottom: none;
    font-weight: 700;
    font-size: 18px;
    color: #0d6efd;
    border-top: 2px solid #0d6efd;
    margin-top: 10px;
    padding-top: 15px;
}

.barcode-section {
    text-align: center;
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px dashed #ddd;
}

.barcode-svg {
    margin-bottom: 10px;
}

.print-btn-container {
    text-align: center;
    margin-top: 30px;
    margin-bottom: 30px;
}

.btn-print {
    background-color: #0d6efd;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.btn-print:hover {
    background-color: #0b5ed7;
}

@media print {
    body {
        background-color: #fff;
        padding: 0;
    }
    
    .invoice-container {
        box-shadow: none;
        padding: 0;
        max-width: 100%;
        margin: 0;
    }
    
    .print-btn-container,
    .no-print {
        display: none !important;
    }
    
    @page {
        margin: 20mm;
        size: auto;
        /* Hide browser header and footer */
        margin-top: 0;
        margin-bottom: 0;
    }

    @page :first {
        margin-top: 0;
    }
    
    /* Ensure no extra margins on body for print */
    body {
        margin: 1cm;
    }
}
