/* ============================================
   RECEIPT.CSS - A4 DOCUMENT & PRINT STYLES
   ========================================== */

.modal-receipt {
    max-width: 900px;
}

/* ==========================================
   A4 DOCUMENT CONTAINER
   ========================================== */

.a4-document {
    position: relative;
    overflow: hidden;

    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;

    padding: 20mm 15mm; /* A4 standard safe margins */

    background: #ffffff;
    color: #000;
    font-size: 12px;

    border: 1px solid #e2e8f0;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

/* ==========================================
   DIAGONAL WATERMARK PATTERN
   ========================================== */
.a4-document::before {
    content:
        "APEX BREEZ INTEGRATED SERVICES\A"
        "APEX BREEZ INTEGRATED SERVICES\A"
        "APEX BREEZ INTEGRATED SERVICES\A"
        "APEX BREEZ INTEGRATED SERVICES\A"
        "APEX BREEZ INTEGRATED SERVICES\A"
        "APEX BREEZ INTEGRATED SERVICES\A"
        "APEX BREEZ INTEGRATED SERVICES";

    position: absolute;
    top: -20%;
    left: -20%;

    width: 140%;
    height: 140%;

    white-space: pre;
    line-height: 180px;

    font-size: 42px;
    font-weight: 900;
    color: rgba(0, 0, 0, 0.03);

    transform: rotate(-35deg);
    transform-origin: center;

    pointer-events: none;
    z-index: 0;
}

/* Keep receipt content above watermark */
.a4-document > * {
    position: relative;
    z-index: 1;
}

/* ==========================================
   HEADER
   ========================================== */

.rcpt-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;

    margin-bottom: 10px;
    padding-bottom: 10px;

    border-bottom: 3px solid #000;
}

.rcpt-logo {
    max-width: 80px;
    flex-shrink: 0;
}

.rcpt-logo img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.rcpt-company-info h2 {
    margin: 0;

    font-size: 1.4rem;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.rcpt-company-info p {
    margin: 1px 0;

    font-size: 0.8rem;
    font-weight: 500;
    color: #333;
}

.rcpt-divider {
    margin: 8px 0;
    border-top: 1px solid #cbd5e1;
}

/* ==========================================
   LAYOUT GRIDS
   ========================================== */

.rcpt-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;

    margin-bottom: 5px;
}

.rcpt-info-col h4 {
    margin-bottom: 4px;
    padding-bottom: 3px;

    font-size: 0.85rem;
    color: #000;
    text-transform: uppercase;

    border-bottom: 1px solid #e2e8f0;
}

.rcpt-field {
    display: flex;
    justify-content: space-between;

    padding: 2px 0;
    font-size: 0.85rem;
}

.rcpt-field span {
    margin-right: 10px;

    color: #555;
    font-weight: 500;
}

/* ==========================================
   TABLES
   ========================================== */

.rcpt-table {
    width: 100%;
    margin: 5px 0;

    border-collapse: collapse;
    font-size: 0.85rem;
}

.rcpt-table th,
.rcpt-table td {
    padding: 4px 8px;

    text-align: left;
    border: 1px solid #cbd5e1;
}

.rcpt-table th {
    background: #f8fafc;

    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
}

.rcpt-total-row {
    border-top: 3px solid #000;

    font-size: 0.95rem;
    font-weight: 800;
}

.right-align {
    text-align: right;
}

/* ==========================================
   SUMMARY & AMOUNT IN WORDS
   ========================================== */

.rcpt-summary-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 20px;

    margin: 8px 0;
    padding: 10px 15px;

    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
}

.highlight-text {
    font-size: 1rem;
    font-weight: 800;
    color: var(--danger);
}

.rcpt-words-box {
    margin-bottom: 15px;
    padding: 6px 0 6px 8px;

    font-size: 0.85rem;

    background: #f8fafc;
    border-top: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
}
/* ==========================================
   SIGNATURES
   ========================================== */

.rcpt-signatures {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

.rcpt-sig-block {
    position: relative; /* Container for the absolute stamp */
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 45%;
    padding-top: 3px;
    padding-bottom: 10px; /* Adds space so text isn't cut off */
    font-size: 0.85rem;
    font-weight: 600;
    border-top: 1px solid #000;
}

/* Digital Stamp Overlay - Covers both lines */
.digital-stamp {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) rotate(-12deg); /* Centers vertically and angles like a real stamp */
    width: 120px;      /* Adjust size as needed */
    height: auto;
    opacity: 0.85;     /* Slight transparency for realism */
    object-fit: contain;
    z-index: 2;        /* Overlaps the signature text */
    pointer-events: none;
}

.rcpt-sig-block small {
    font-size: 0.7rem;
    font-weight: 400;
    color: #64748b;
}

/* ==========================================
   PRINT SPECIFIC CSS
   ========================================== */

@media print {
    body {
        visibility: hidden;
        background: white;
    }

    /* Target only the receipt for printing */
    #receipt-printable {
        position: absolute;
        top: 0;
        left: 0;

        width: 100%;

        visibility: visible;
        background: white;
    }

    .no-print {
        display: none !important;
    }

    .a4-document {
        width: 100%;
        min-height: auto;
        height: auto;

        margin: 0;
        padding: 15mm;

        border: none;
        box-shadow: none;
    }

    /* Force print colors for watermark, stamp & tables */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    /* Ensure stamp prints at full opacity */
    .digital-stamp {
        opacity: 1 !important; 
    }

    .rcpt-table th,
    .rcpt-table td {
        border-color: #000 !important;
    }

    .rcpt-divider,
    .rcpt-info-col h4,
    .rcpt-sig-block,
    .rcpt-footer {
        border-color: #000 !important;
    }

    .rcpt-summary-box {
        background: #f0f0f0 !important;
        border-color: #000 !important;
    }

    .rcpt-words-box {
        background: #f0f0f0 !important;
        border-color: #000 !important;
    }

    /* Page setup for single page print */
    @page {
        size: A4;
        margin: 0;
    }
}