/* ==================================================
   PRICE SUMMARY PAGE STYLES
   Simple layout: header | main | footer (reference style)
   ================================================== */

.ps-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* Page container - A4 size (same top margin as Products, Cover, Scope of Work) */
.ps-page {
    width: 210mm;
    max-width: 210mm;
    transform-origin: top center;
    min-height: 297mm;
    display: flex;
    flex-direction: column;
    padding: 20px 18px 15px 18px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.08);
    border: 1px solid var(--brand-primary, #e5e7eb);
    border-radius: 5px;
    margin: 30px auto 0 auto;
    background-color: #fff;
    box-sizing: border-box;
}

/* Header - same as Product List / Scope of Work (logo left, title center, customer bottom-right, line below) */
.ps-header {
    position: relative;
    width: 100%;
    min-height: 90px;
    padding: 8px;
    margin-bottom: 6px;
    background-color: #ffffff;
    text-align: center;
    box-sizing: border-box;
}

/* Line at bottom of header - same as other pages */
.ps-header hr {
    margin: 100px 0 0 0;
    border: none;
    border-top: 1px solid #dee2e6;
    width: 100%;
}

/* Logo: top-left */
.ps-logo-cell {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 0;
    margin: 0;
    z-index: 2;
}

.ps-logo {
    max-width: var(--header-logo-max-width, 140px);
    max-height: var(--header-logo-max-height, 90px);
    height: auto;
    object-fit: contain;
    display: block;
}

/* Title: centered (same as Product List) */
.ps-title-cell {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 0;
    z-index: 1;
}

.ps-title-cell h2 {
    font-weight: 700;
    font-size: 1.5rem;
    color: #1a202c;
    margin: 0;
    text-align: center;
}

/* Customer name: bottom-right, above the line (same as Scope of Work / Objectives) */
.ps-customer-cell {
    position: absolute;
    bottom: 4px;
    right: 8px;
    left: auto;
    top: auto;
    text-align: right;
    z-index: 2;
}

/* "Specially crafted for" – match Scope of Work / Objectives (bold, 14px, right-aligned) */
.ps-customer-name,
.ps-header .ps-customer-name,
.ps-page .ps-customer-name,
#ps-customer-name {
    font-weight: 700 !important;
    font-size: 14px !important;
    color: #333 !important;
    margin: 0 !important;
    display: block !important;
    text-align: right !important;
}

/* Main content */
.ps-main {
    flex: 1 1 auto;
}

/* Notes */
#ps-notes-section {
    margin-bottom: 24px;
    background-color: #f8f9fa;
    border-left: 4px solid var(--brand-primary, #007bff);
    padding: 16px 18px;
    border-radius: 4px;
}

#ps-notes-section h4 {
    margin: 0 0 8px 0;
    color: var(--brand-primary, #007bff);
    font-weight: 600;
    font-size: 0.95rem;
}

#ps-proposal-intro {
    font-size: 0.95em;
    line-height: 1.6;
}

/* Pricing section */
.ps-pricing-summary-title {
    margin: 28px 0 16px 0;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 10px;
    font-weight: 700;
    color: #333;
    font-size: 1.15rem;
}

.ps-pricing-table {
    width: 100%;
    border-collapse: collapse;
}

.ps-pricing-table td {
    padding: 10px 12px;
    font-size: 1em;
    border-bottom: 1px solid #e5e7eb;
}

.ps-pricing-table td.ps-label {
    color: #495057;
    width: 70%;
}

.ps-pricing-table td.ps-value {
    text-align: right;
    font-weight: bold;
    color: #212529;
}

.ps-pricing-table tr.ps-savings-row td {
    color: #28a745;
}

.ps-pricing-table tr.ps-total-row td {
    border-top: 3px solid #343a40;
    border-bottom: 3px solid #343a40;
    font-size: 1.4em;
    font-weight: bold;
    background-color: #f8f9fa;
}

.ps-pricing-table tr#ps-balance-due-row td {
    font-size: 1.4em;
    font-weight: bold;
    background-color: #f8f9fa;
}

/* Footer – match other pages (Scope of Work, Objectives) */
.ps-footer {
    margin-top: auto;
    margin-left: 8px;
    margin-right: 8px;
    margin-bottom: 0;
    padding: 12px 15px;
    width: calc(100% - 16px);
    box-sizing: border-box;
    background-color: var(--brand-primary, #2063BE);
    color: white;
    font-size: 11px;
    text-align: center;
    border-radius: 0 0 4px 4px;
}

.ps-footer p {
    margin: 0;
    line-height: 1.5;
}

.ps-footer a {
    color: white;
    text-decoration: underline;
}

.ps-footer a:hover {
    color: #eee;
}

/* Edit Note Modal - full-height editor area */
#psEditNoteModal .modal-dialog {
    max-width: 800px;
    margin: 80px auto 20px auto; /* Same place as New Customer */
}

#psEditNoteModal .ps-edit-note-modal-body {
    min-height: 50vh;
    padding: 16px;
}

#psEditNoteModal .ps-proposal-intro-editor,
#psEditNoteModal #ps-proposal-intro-input {
    min-height: calc(70vh - 200px);
    height: auto;
}

#psEditNoteModal .ql-container.ql-snow {
    min-height: calc(70vh - 250px);
}

#psEditNoteModal .ql-editor {
    min-height: calc(70vh - 250px);
}

/* FAB */
.ps-fab-container {
    position: fixed;
    right: 20px;
    z-index: 1000;
}

/* Toast */
#ps-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 25px;
    background-color: rgba(76, 175, 80, 0.9);
    color: #fff;
    border-radius: 5px;
    display: none;
    z-index: 9999;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Print - A4, full width, header visible (match Product List / Scope of Work) */
@media print {
    @page {
        size: A4 portrait;
        margin: 10mm 12mm;
    }

    /* Override global "header { display: none }" - show our page header */
    #page-content header.ps-header,
    header.ps-header {
        display: block !important;
        visibility: visible !important;
    }

    .ps-wrapper {
        display: flex !important;
        visibility: visible !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .ps-page {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 12mm 12mm !important;
        box-shadow: none !important;
        border: none !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }

    .ps-main,
    #ps-notes-section,
    .ps-pricing-table,
    .ps-proposal-intro {
        overflow: visible !important;
    }

    #ps-proposal-intro,
    #ps-proposal-intro * {
        max-width: 100% !important;
    }

    #ps-notes-section {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    .ps-fab-container,
    #ps-toast {
        display: none !important;
    }

    .ps-footer,
    .ps-header,
    .ps-logo,
    .ps-customer-name,
    .ps-title-cell,
    .ps-logo-cell,
    .ps-customer-cell {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
