/* General styles */
body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

.container {
    width: 794px; /* A4 width at 96 DPI */
    min-height: 1123px; /* A4 height at 96 DPI */
    margin: 20px auto;
    background: white;
    padding: 10px;
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #e6efff;
    border: 1px solid #003087;
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 4px;
}

h1 {
    font-size: 22px;
    color: #003087;
    margin: 0;
    flex: 1;
    font-weight: 700;
    text-transform: uppercase; /* COST SHEET */
}

.project-name {
    flex: 1;
    text-align: center;
}

.project-name label {
    font-size: 13px;
    margin: 0;
    font-weight: 700;
}

.project-name select {
    width: 160px;
    padding: 5px;
    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 3px;
    text-transform: uppercase; /* UTTARA, AIRDE, GALAXY */
}

.invoice-details {
    flex: 1;
    text-align: right;
}

.invoice-details p {
    margin: 2px 0;
    font-size: 13px;
    font-weight: 700;
}

/* Details Row */
.details-row {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.customer-details, .executive-details {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fafafa;
}

.customer-details h3, .executive-details h3 {
    font-size: 15px;
    color: #003087;
    margin: 0 0 6px;
    font-weight: 700;
}

.customer-details label, .executive-details label {
    display: block;
    margin: 4px 0;
    font-size: 13px;
    font-weight: 700;
}

.customer-details input, .executive-details input, .customer-details textarea {
    width: 100%;
    padding: 5px;
    margin-top: 2px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 13px;
    box-sizing: border-box;
}

.customer-details textarea {
    height: 50px;
    resize: vertical;
}

/* Cost Sheet */
.cost-sheet {
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 6px 0;
    padding: 6px;
    background: #fafafa;
}

.cost-sheet legend {
    display: inline-block;
    width: auto;
    padding: 0 10px;
    font-weight: 700;
    color: #003087;
    font-size: 15px;
    margin: 0 auto; /* Center the legend */
    float: none;
}

.cost-sheet-row {
    display: flex;
    gap: 10px;
}

.cost-sheet-left, .cost-sheet-right {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fafafa;
}

.cost-sheet-left label, .cost-sheet-right label {
    display: block;
    margin: 4px 0;
    font-size: 13px;
    font-weight: 700;
}

.cost-sheet-left input, .cost-sheet-right input {
    width: 100%;
    padding: 5px;
    margin-top: 2px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 13px;
    box-sizing: border-box;
}

.cost-sheet-right p {
    font-size: 15px;
    font-weight: 700;
    margin: 4px 0;
    color: #003087;
}

#amountInWords {
    font-size: 13px;
    font-weight: 700;
    margin: 4px 0;
    color: #003087;
}

/* Payment Schedule Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0;
    font-size: 13px;
}

th, td {
    border: 1px solid #ddd;
    padding: 2px;
    text-align: left;
    font-weight: 700;
}

th {
    background-color: #e6efff;
    color: #003087;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* Button and Signature Row */
.button-signature-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 6px;
}

.print-btn {
    padding: 8px;
    background-color: #0052cc;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    flex: 1;
}

.print-btn:hover {
    background-color: #003087;
}

.signature-box {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fafafa;
    text-align: center;
}

.signature-box p {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 4px;
    color: #003087;
}

.signature-area {
    height: 50px;
    border: 1px dashed #ccc;
    background: white;
}

/* Footer */
footer {
    margin-top: 6px;
    font-size: 11px;
    color: #666;
    text-align: center;
    border-top: 1px solid #ddd;
    padding-top: 4px;
    font-weight: 700;
}

/* Print styles */
@media print {
    body {
        margin: 0;
        padding: 0;
        background: white;
    }
    .container {
        width: 210mm;
        height: 297mm;
        margin: 0;
        padding: 5mm;
        box-shadow: none;
        background: white;
    }
    .print-btn {
        display: none;
    }
    /* Ensure project name is centered */
    header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #f0f0f0 !important;
        border: 1px solid #000 !important;
    }
    .project-name {
        flex: 1;
        text-align: center;
    }
    .project-name select {
        text-align: center;
        border: none;
        background: none;
        padding: 0;
        font-size: 13px;
        font-weight: 700;
        color: #000;
        text-transform: uppercase;
    }
    /* Remove interactive elements */
    input, select, textarea {
        border: none;
        background: none;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        padding: 5px 0;
        font-size: 13px;
        font-weight: 700;
        color: #000;
    }
    select option {
        display: none;
    }
    select::after {
        content: none;
    }
    textarea {
        height: auto;
        line-height: 1.2;
        white-space: pre-wrap;
    }
    /* Adjust signature box width */
    .button-signature-row {
        display: flex;
        gap: 10mm;
        align-items: flex-start;
    }
    .signature-box {
        width: 150mm; /* Compact width for print */
        flex: none;
        padding: 5mm;
        border: 1px solid #000;
        text-align: center;
    }
    /* Remove shadows and hover effects */
    .container, .cost-sheet, .customer-details, .executive-details, .cost-sheet-left, .cost-sheet-right, .signature-box {
        box-shadow: none;
        border: 1px solid #000;
    }
    /* Ensure bold text and black color */
    h1, legend, th, td, label, .invoice-details p, footer, .cost-sheet-right p, .signature-box p, #amountInWords {
        color: #000 !important;
        font-weight: bold !important;
    }
    th, tr:nth-child(even) {
        background: none !important;
        border: 1px solid #000;
    }
    /* Prevent breaks and ensure layout */
    header, .details-row, .cost-sheet, table, .button-signature-row, footer {
        page-break-inside: avoid;
    }
}