﻿/* VintageInvoice — main document */
.vintage-invoice {
    background: linear-gradient( 135deg, #f7e69c 0%, #f4df83 55%, #ecd174 100% );
    color: #292514;
    border: 1px solid #b99c48;
    padding: 30px;
    max-width: 850px;
    margin: 30px auto;
    font-family: Georgia, serif;
    box-shadow: 5px 7px 18px #888;
}

    .vintage-invoice h1 {
        font-size: 42px;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 3px;
        border-bottom: 3px double #333;
    }

    .vintage-invoice input {
        background: transparent;
        border: none;
        border-bottom: 1px solid #8a773e;
        padding: 6px;
        font-family: inherit;
    }

    .vintage-invoice button {
        background: #ead076;
        border: 1px solid #8a773e;
        padding: 6px 12px;
        cursor: pointer;
    }

        .vintage-invoice button:hover {
            background: #d9b958;
        }

/* Header and rubber stamp */
.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 25px;
    border-bottom: 3px double #292514;
    margin-bottom: 20px;
}

    .invoice-header h1 {
        font-family: Georgia, serif;
        font-size: 42px;
        border: none;
        margin: 0;
    }

.company-stamp {
    border: 3px double #263d60;
    color: #263d60;
    padding: 10px;
    width: 250px;
    text-align: center;
    transform: rotate(-3deg);
    font-family: Georgia, serif;
    font-weight: bold;
    opacity: 0.88;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.vintage-invoice .company-stamp input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    border: none;
    color: inherit;
    font-family: inherit;
    background: transparent;
}

.vintage-invoice .company-stamp .stamp-name {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border: none;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: 16px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    cursor: pointer;
}

.invoice-title-editor {
    text-align: right;
}

    .invoice-title-editor h1 {
        font-size: 38px;
        font-weight: 900;
        letter-spacing: 2px;
        margin: 0;
    }

/* Toolbar */
.invoice-editor-toolbar {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    margin: 20px 0;
    padding: 15px 20px;
    background: #f1f3f5;
    border: 1px solid #d0d5db;
    border-radius: 8px;
    font-family: Arial, sans-serif;
}

    .invoice-editor-toolbar h3 {
        margin: 0 0 12px;
        font-size: 16px;
    }

.stamp-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0;
    font-size: 13px;
}

    .stamp-controls select {
        background-color: #f4df83;
        border: 1px solid #8a773e;
        padding: 5px;
        font-family: Georgia, serif;
    }

.print-invoice-button {
    background: #263d60;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 9px 18px;
    margin-top: 12px;
    cursor: pointer;
    font-weight: bold;
}

    .print-invoice-button:hover {
        background: #172b48;
    }

/* Invoice fields and table */
.invoice-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0;
}

    .invoice-details label {
        display: flex;
        flex-direction: column;
        font-size: 12px;
        font-weight: bold;
        gap: 4px;
    }

    .invoice-details input {
        width: 90%;
        padding: 5px;
    }

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 13px;
}

    .invoice-table th {
        background: #dfc45f;
        border: 1px solid #8a773e;
        padding: 8px;
        text-align: left;
        text-transform: uppercase;
    }

    .invoice-table td {
        border: 1px solid #b99c48;
        padding: 5px;
    }

.vintage-invoice .invoice-table input:not([type="checkbox"]) {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: none;
    background: transparent;
    padding: 5px;
}

.invoice-table th:first-child,
.invoice-table td:first-child {
    width: 65px;
}

.invoice-table th:nth-child(3),
.invoice-table td:nth-child(3) {
    width: 100px;
}

.invoice-table th:nth-child(4),
.invoice-table td:nth-child(4) {
    width: 65px;
    text-align: center;
}

.invoice-table th:nth-child(5),
.invoice-table td:nth-child(5) {
    width: 100px;
    text-align: right;
    white-space: nowrap;
}

.blank-invoice-row,
.invoice-table tbody tr {
    height: 28px;
}

    .blank-invoice-row td {
        background: transparent;
    }

/* Notes and totals */
.invoice-footer {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 25px;
    margin-top: 25px;
    align-items: start;
}

.invoice-notes {
    width: 100%;
    margin: 0;
}

    .invoice-notes label {
        display: block;
        font-weight: bold;
        margin-bottom: 6px;
    }

.vintage-invoice .invoice-notes textarea {
    display: block;
    width: 100%;
    min-height: 110px;
    box-sizing: border-box;
    background: transparent;
    border: 1px solid #8a773e;
    padding: 10px;
    font-family: Georgia, serif;
    font-size: 13px;
    resize: vertical;
}

.invoice-totals {
    border-top: 2px solid #8a773e;
    padding-top: 10px;
    font-size: 13px;
}

    .invoice-totals h2 {
        border-top: 2px double #292514;
        padding-top: 10px;
        font-size: 22px;
    }

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 13px;
}

.vintage-invoice .total-row input {
    width: 65px;
    text-align: right;
    border-bottom: 1px solid #8a773e;
}

.final-total {
    border-top: 3px double #292514;
    margin-top: 10px;
    padding-top: 12px;
    font-size: 20px;
}

/* Workspace and advertising */
.invoice-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 20px;
    align-items: start;
    max-width: 1200px;
    margin: 20px auto;
}

.invoice-main,
.invoice-ad-sidebar {
    min-width: 0;
}

.ad-placeholder {
    min-height: 250px;
    padding: 20px;
    background: #f4f5f6;
    border: 1px solid #d5d9de;
    border-radius: 8px;
    text-align: center;
    font-family: Arial, sans-serif;
}

    .ad-placeholder span {
        font-size: 10px;
        letter-spacing: 1px;
        color: #777;
    }

    .ad-placeholder h3 {
        margin-top: 35px;
        font-size: 18px;
    }

    .ad-placeholder p {
        font-size: 13px;
        color: #666;
    }

/* Invoice action buttons */
.invoice-email-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 360px;
}

.invoice-email-heading {
    margin: 0;
    font-size: 13px;
    font-weight: bold;
}

.invoice-email-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.invoice-email-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    background: #f7f1e4;
    border: 1px solid #a4b6a7;
    font-size: 13px;
    word-break: break-all;
}

.invoice-email-remove {
    flex: none;
    min-height: 32px !important;
    padding: 4px 8px !important;
    font-size: 12px;
}

.invoice-email-add-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
}

.invoice-email-add-row input {
    flex: 1;
    min-width: 0;
}

.invoice-email-cc {
    font-size: 13px;
}

.invoice-email-cc summary {
    cursor: pointer;
    margin-bottom: 6px;
}

.invoice-email-validation {
    margin: 0;
    color: #8b2525;
    font-size: 13px;
    line-height: 1.4;
}

.invoice-email-limits {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    opacity: 0.9;
}

.send-confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 30, 40, 0.45);
    z-index: 40;
}

.send-confirm-dialog {
    position: fixed;
    z-index: 41;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(440px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    overflow: auto;
    background: #f7f1e4;
    color: #1d2a33;
    border: 2px solid #263d60;
    padding: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    font-family: Georgia, serif;
}

.send-confirm-dialog h2 {
    margin: 0 0 8px;
    font-size: 1.25rem;
}

.send-confirm-details {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 8px 12px;
    margin: 16px 0;
    font-size: 14px;
}

.send-confirm-details dt {
    font-weight: bold;
}

.send-confirm-details dd {
    margin: 0;
    word-break: break-word;
}

.send-confirm-resend {
    margin: 0 0 12px;
    font-size: 13px;
}

.send-confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .send-confirm-details {
        grid-template-columns: 1fr;
    }
}

.invoice-actions {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

    /* Give all three invoice action buttons the same appearance */
    .invoice-actions button {
        background: #263d60;
        color: white;
        border: none;
        border-radius: 4px;
        padding: 9px 18px;
        margin: 0;
        font-weight: bold;
        cursor: pointer;
        font-family: Arial, sans-serif;
    }

/* Align bottom controls with the yellow invoice */
.invoice-bottom-controls {
    width: 100%;
    max-width: 912px;
    margin: 20px auto 30px;
    padding: 0;
    box-sizing: border-box;
}

/* Smaller screens */
@media (max-width: 850px) {
    .invoice-workspace {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .invoice-footer {
        grid-template-columns: 1fr;
    }
}


/* =========================================
   PRINTABLE INVOICE
   ========================================= */

@media print {

    /* Hide editing controls and advertisements when printing */
    .company-selector,
    .invoice-editor-toolbar,
    .print-invoice-button,
    .invoice-ad-sidebar,
    .vintage-invoice button {
        display: none !important;
    }

    /* Remove the website layout */
    .invoice-workspace {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
    }

    .invoice-main {
        width: 100% !important;
    }

    
    /* Format the printed invoice */
    .vintage-invoice {
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        margin: 0 !important;
        padding: 5mm !important;
        box-sizing: border-box !important;
        box-shadow: none !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    /* Reduce header spacing */
    .invoice-header {
        margin-bottom: 8px !important;
    }

    /* Compact invoice details */
    .invoice-details {
        margin: 8px 0 !important;
        gap: 6px !important;
    }

    /* Compact invoice table */
    .invoice-table {
        margin: 8px 0 !important;
    }

        .invoice-table tbody tr,
        .blank-invoice-row {
            height: 20px !important;
        }

        .invoice-table td {
            padding: 2px !important;
        }

    /* Compact notes and totals */
    .invoice-footer {
        margin-top: 10px !important;
        gap: 12px !important;
    }

    .total-row {
        padding: 3px 0 !important;
    }

    .vintage-invoice .invoice-notes textarea {
        min-height: 65px !important;
    }

    /* Paper size */
    @page {
        size: letter portrait;
        margin: 8mm;
    }
}


/* Dollar sign beside editable unit price */
.invoice-price-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.currency-symbol {
    font-weight: bold;
    font-size: 13px;
    flex-shrink: 0;
}
.vintage-invoice .invoice-price-input {
    flex: 1;
    min-width: 0;
    width: 100%;
    text-align: right;
}

/* Customer fields match the Project line */
.vintage-invoice .invoice-customer-fields {
    width: calc((100% - 12px) / 2 * 0.9 + 10px);
    max-width: 100%;
}

.vintage-invoice .invoice-customer-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin-bottom: 12px;
    width: 100%;
}

    .vintage-invoice .invoice-customer-row input {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none;
        box-sizing: border-box;
        padding-bottom: 0;
    }

    /* Vintage multiline customer fields */
    .vintage-invoice .invoice-customer-row textarea {
        display: block;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        background: transparent;
        border: none;
        border-bottom: 1px solid #8a773e;
        border-radius: 0;
        padding: 6px;
        font-family: inherit;
        font-size: inherit;
        line-height: 1.4;
        resize: none;
        overflow-y: hidden;
        min-height: 48px;
    }








