@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@page {
    size: A4 portrait;
    margin: 1cm;
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    direction: rtl;
    line-height: 1.5;
    color: #000;
    background-color: #fff;
    font-size: 10pt;
}

.invoice-box {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Header */
.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #000;
    padding-bottom: 10px;
    margin-bottom: 10px;
}
.logo-area {
    flex: 1;
}
.logo-area h1 {
    margin: 0;
    font-size: 16pt;
}
.logo {
    max-width: 150px;
    max-height: 100px;
}
.header-center {
    flex: 2;
    text-align: center;
}
.header-center h2,
.header-center p {
    text-align: center;
}
.invoice-title h2 {
    margin: 0;
    font-size: 14pt;
}
.invoice-details {
    flex: 1;
    text-align: left;
}
.invoice-details div {
    margin-bottom: 5px;
}

/* Seller/Buyer Info */
.party-info {
    display: flex;
    flex-direction: column; /* Stack them vertically */
    width: 100%;
    margin-bottom: 5px; /* Reduced space below party info */
}

.seller-info, .buyer-info {
    width: 100%; /* Take full width */
    border: 1px solid #000;
    padding: 10px;
    box-sizing: border-box; /* Ensure padding is included in width */
}

.buyer-info {
    margin-top: 0; /* Reduced space above buyer info box */
    border: 1px solid #000;
    padding: 10px;
    box-sizing: border-box; /* Ensure padding is included in width */
    border-radius: 8px; /* Rounded corners */
}

.info-grid-3-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Three equal columns */
    gap: 5px 10px; /* Gap between grid items */
}

.info-item {
    display: flex;
    padding: 2px 0;
    font-size: 9pt;
}

.info-item-row-span {
    display: flex;
    grid-column: span 2; /* Span 2 columns */
    padding: 2px 0;
    font-size: 9pt;
}

.info-item strong {
    margin-left: 5px;
}
.party-info h3 {
    margin: 0 0 10px 0;
    font-size: 11pt;
    border-bottom: 1px solid #ccc;
    padding-bottom: 5px;
}
.party-info p {
    margin: 0 0 5px 0;
    font-size: 9pt;
}

.info-table {
    width: 100%;
}

.info-table td {
    padding: 2px 5px;
}

.info-table td:first-child {
    width: 25%; /* Fixed width for labels */
}

/* Items Table */
.items-section {
    flex-grow: 1;
}
.items-table {
    width: 100%;
    border-collapse: separate; /* Change to separate */
    border-spacing: 0; /* Remove spacing */
    border-radius: 8px; /* Rounded corners */
    overflow: hidden; /* Ensures rounded corners are visible with borders */
}
.items-table thead th {
    border: 1px solid #000;
    padding: 5px;
    text-align: center;
    font-weight: bold;
    background-color: #f2f2f2;
}
.items-table tbody td {
    border: 1px solid #000;
    padding: 5px;
    text-align: center;
    vertical-align: middle;
}
.items-table .item-description {
    text-align: right;
}

/* Apply border-radius to specific corners of the table */
.items-table thead th:first-child {
    border-top-right-radius: 8px;
}

.items-table thead th:last-child {
    border-top-left-radius: 8px;
}

.items-table tbody tr:last-child td:first-child {
    border-bottom-right-radius: 8px;
}

.items-table tbody tr:last-child td:last-child {
    border-bottom-left-radius: 8px;
}

/* Footer */
.invoice-footer {
    padding-top: 10px;
}
.totals-section {
    width: 50%;
    float: left;
    margin-left: 5%;
}
.totals-table {
    width: 100%;
    border-collapse: collapse;
}
.totals-table td {
    padding: 5px;
    border: 1px solid #000;
}
.totals-table td:first-child {
    font-weight: bold;
    width: 60%;
}
.totals-table tr.total td {
    font-weight: bold;
    background-color: #f2f2f2;
}

.signature-area {
    display: flex;
    justify-content: space-around;
    margin-top: 40px;
}
.signature {
    padding-top: 50px; /* Increased space for signature */
    border-top: none; /* Removed border-top */
}
.footer-note {
    margin-top: 20px;
    font-size: 9pt;
    text-align: center;
}

@media print {
    body {
        -webkit-print-color-adjust: exact;
    }
    
    /* Hide browser's default header and footer */
    @page {
        margin: 10;
    }
    
    body {
        margin: 10;
    }
}

.description-box {
    border: 1px solid #000;
    border-radius: 8px;
    padding: 10px;
    margin-top: 15px;
    text-align: right;
    min-height: 40px;
}
