/* WP Quote Invoice - Public Styles */
.wpqi-doc-wrap { min-height: 100vh; padding: 40px 20px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: #333; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; background: #f3f4f6; }
.wpqi-doc { max-width: 860px; width: 100%; margin: 0 auto; background: #fff; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,0.1); overflow: hidden; }

/* Header */
.wpqi-doc-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 40px; background: linear-gradient(135deg, #1a56db 0%, #7c3aed 100%); color: #fff; }
.wpqi-doc-brand { display: flex; align-items: flex-start; gap: 16px; }
.wpqi-logo { max-height: 60px; max-width: 160px; object-fit: contain; }
.wpqi-company-info strong { display: block; font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.wpqi-company-info span { display: block; font-size: 13px; opacity: 0.85; line-height: 1.6; }
.wpqi-doc-meta { text-align: right; }
.wpqi-doc-type { font-size: 42px; font-weight: 900; letter-spacing: 3px; margin: 0 0 12px; opacity: 0.95; }
.wpqi-meta-table { margin-left: auto; }
.wpqi-meta-table th { text-align: right; padding: 3px 8px 3px 0; font-size: 12px; font-weight: 400; opacity: 0.8; }
.wpqi-meta-table td { padding: 3px 0; font-size: 13px; font-weight: 600; }

/* Body */
.wpqi-doc-billing { display: flex; gap: 40px; padding: 32px 40px; background: #f9fafb; border-bottom: 1px solid #e5e7eb; }
.wpqi-billing-block--job { padding-left: var(--wpqi-job-spacing, 40px); border-left: 2px solid #e5e7eb; }
.wpqi-billing-block h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #9ca3af; margin-bottom: 8px; font-weight: 600; }
.wpqi-billing-block strong { display: block; font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.wpqi-billing-block div { font-size: 13px; color: #6b7280; line-height: 1.5; }

.wpqi-doc-title { font-size: 22px; font-weight: 700; padding: 32px 40px 8px; color: #111827; }
.wpqi-doc-desc { padding: 0 40px 24px; color: #6b7280; font-size: 14px; line-height: 1.6; }

/* Items table */
.wpqi-items-table { width: 100%; border-collapse: collapse; margin: 0 0 0; }
.wpqi-items-table thead tr { background: #f3f4f6; }
.wpqi-items-table th { padding: 12px 40px; text-align: left; font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; }
.wpqi-items-table th:not(:first-child) { text-align: right; }
.wpqi-items-table td { padding: 14px 40px; border-bottom: 1px solid #f3f4f6; font-size: 14px; }
.wpqi-items-table td:not(:first-child) { text-align: right; }
.wpqi-items-table tbody tr:nth-child(even) td { background: #fafafa; }

/* Totals */
.wpqi-totals-wrap { padding: 24px 40px; display: flex; justify-content: flex-end; }
.wpqi-totals-block { min-width: 280px; }
.wpqi-total-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; border-bottom: 1px solid #f3f4f6; color: #374151; }
.wpqi-grand-total { font-size: 20px; font-weight: 700; color: #1a56db; border-top: 2px solid #1a56db; border-bottom: none; padding-top: 12px; margin-top: 4px; }

/* Notes */
.wpqi-doc-notes { margin: 0 40px 32px; padding: 20px; background: #f9fafb; border-radius: 8px; border-left: 4px solid #1a56db; }
.wpqi-doc-notes h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #9ca3af; margin-bottom: 8px; font-weight: 600; }
.wpqi-doc-notes p { font-size: 14px; color: #6b7280; line-height: 1.6; }
.wpqi-doc-footer-notes { margin: 0 40px 32px; padding: 16px 20px; border-top: 1px solid #e5e7eb; font-size: 13px; color: #6b7280; line-height: 1.6; }

/* Action section */
.wpqi-action-section { padding: 32px 40px; background: #ffffff; border-top: 1px solid #e5e7eb; }
.wpqi-action-note { color: #000000; font-size: 14px; margin-bottom: 20px; font-weight: 700; }
.wpqi-action-btns { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* Buttons */
.wpqi-btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; border-radius: 8px; font-size: 15px; font-weight: 500; cursor: pointer; border: 1px solid transparent; text-decoration: none; transition: all 0.15s; line-height: 1; }
.wpqi-btn-accept { background: #16a34a; color: #fff; font-weight: 600; }
.wpqi-btn-accept:hover { background: #15803d; }
.wpqi-btn-decline { background: #dc2626; color: #fff !important; border-color: #dc2626; font-weight: 600; }
.wpqi-btn-decline:hover { background: #b91c1c; color: #fff !important; }
.wpqi-btn-download { background: #fff; color: #374151; border-color: #e5e7eb; }
.wpqi-btn-download:hover { background: #f3f4f6; }
.wpqi-btn-primary { background: #1a56db; color: #fff; }
.wpqi-btn-primary:hover { background: #1e40af; }
.wpqi-btn-paypal { background: #0070ba; color: #fff; font-size: 15px; padding: 12px 24px; }
.wpqi-btn-paypal:hover { background: #005ea6; }

/* Response messages */
.wpqi-response-msg { padding: 20px; border-radius: 8px; font-size: 15px; font-weight: 500; }
.wpqi-response-msg.wpqi-accepted { background: #dcfce7; color: #15803d; }
.wpqi-response-msg.wpqi-declined { background: #fee2e2; color: #dc2626; }
.wpqi-accepted { background: #dcfce7; color: #15803d; }
.wpqi-declined { background: #fee2e2; color: #dc2626; }

/* Alerts */
.wpqi-alert { padding: 16px 24px; border-radius: 8px; margin-bottom: 20px; font-size: 15px; }
.wpqi-alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.wpqi-alert-warning { background: #fef3c7; color: #d97706; border: 1px solid #fde68a; }

/* Payment section */
.wpqi-payment-section { padding: 32px 40px; border-top: 1px solid #e5e7eb; }
.wpqi-payment-section h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.wpqi-payment-section p { color: #6b7280; font-size: 14px; margin-bottom: 20px; }
.wpqi-payment-methods { display: flex; flex-direction: column; gap: 20px; }
.wpqi-paid-notice { background: #dcfce7; border-radius: 8px; }
.wpqi-paid-notice p { font-size: 16px; color: #15803d; font-weight: 500; margin-bottom: 16px; }

/* Stripe card */
.wpqi-card-form { border: 1px solid #e5e7eb; border-radius: 8px; padding: 20px; background: #fff; max-width: 400px; }
#wpqi-card-element { padding: 10px 0; border-bottom: 1px solid #e5e7eb; margin-bottom: 16px; }
.wpqi-error-msg { color: #dc2626; font-size: 13px; min-height: 20px; margin-bottom: 12px; }
.wpqi-secure-note { font-size: 12px; color: #9ca3af; margin-top: 10px; }
.wpqi-notice { color: #6b7280; font-style: italic; font-size: 14px; }

/* Badges */
.wpqi-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.wpqi-badge-draft { background: #f3f4f6; color: #6b7280; }
.wpqi-badge-available { background: #ede9fe; color: #6d28d9; }
.wpqi-badge-sent { background: #dbeafe; color: #1d4ed8; }
.wpqi-badge-accepted, .wpqi-badge-paid { background: #dcfce7; color: #15803d; }
.wpqi-badge-declined, .wpqi-badge-cancelled { background: #fee2e2; color: #dc2626; }
.wpqi-badge-expired, .wpqi-badge-overdue { background: #fef3c7; color: #d97706; }

@media (max-width: 640px) {
    .wpqi-doc-header { flex-direction: column; gap: 20px; }
    .wpqi-doc-meta { text-align: left; }
    .wpqi-doc-billing { flex-direction: column; gap: 20px; }
    .wpqi-doc-header, .wpqi-doc-billing, .wpqi-doc-title, .wpqi-doc-desc,
    .wpqi-items-table th, .wpqi-items-table td,
    .wpqi-totals-wrap, .wpqi-doc-notes, .wpqi-action-section, .wpqi-payment-section { padding-left: 20px; padding-right: 20px; }
    .wpqi-action-btns { flex-direction: column; }
    .wpqi-btn { width: 100%; justify-content: center; }
}

/* ── v1.1.0: Job photo gallery ───────────────────────── */
.wpqi-doc-photos {
    margin: 28px 0 0;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}
.wpqi-doc-photos h3 {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.wpqi-photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}
.wpqi-photo-link { display: block; border-radius: 8px; overflow: hidden; }
.wpqi-photo-img  {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    transition: opacity 0.15s;
}
.wpqi-photo-link:hover .wpqi-photo-img { opacity: 0.88; }
@media (max-width: 600px) {
    .wpqi-photo-gallery { grid-template-columns: repeat(2, 1fr); }
}

/* Service description sub-text under line item names */
.wpqi-item-service-desc {
    font-size: 0.85em;
    color: #555;
    margin-top: 4px;
    line-height: 1.5;
    white-space: pre-line;
}

/* ── Inspection Report: always start on a new page when printing ── */
@media print {
    .wpqi-inspection-report {
        page-break-before: always;
        break-before: page;
    }
}

/* ── Inspection Report: inline on public quote page ── */
.wpqi-inspection-report { margin-top: 60px; }

.wpqi-ir-section {
    padding: 28px 40px;
}
.wpqi-ir-section + .wpqi-ir-section {
    border-top: 1px solid #e5e7eb;
}
.wpqi-ir-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 18px;
}
.wpqi-ir-badge-issues {
    background: #fee2e2;
    color: #dc2626;
    border-radius: 20px;
    padding: 2px 12px;
    font-weight: 600;
    font-size: 12px;
}
.wpqi-ir-badge-ok {
    color: #16a34a;
    font-size: 12px;
    font-weight: 600;
}
/* Section group headers */
.wpqi-ir-items { margin-bottom: 20px; }
.wpqi-ir-group-header {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #1a56db;
    padding: 14px 0 10px;
    border-bottom: 2px solid #1a56db;
    margin: 20px 0 0;
}
.wpqi-ir-group-header:first-child { margin-top: 0; }

/* Checklist rows */
.wpqi-ir-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #374151;
}
.wpqi-ir-row:last-child { border-bottom: none; }
.wpqi-ir-row--flagged { background: #fef2f2; }
.wpqi-ir-row-label { flex: 1; }
.wpqi-ir-row-status {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.wpqi-ir-checkbox {
    width: 18px; height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    background: #fff;
}
.wpqi-ir-checkbox--checked {
    background: #dc2626;
    border-color: #dc2626;
}
.wpqi-ir-checkbox--checked::after {
    content: '✓';
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}
.wpqi-ir-issue-tag {
    font-size: 12px;
    font-weight: 600;
    color: #dc2626;
    background: #fee2e2;
    padding: 2px 10px;
    border-radius: 4px;
}
.wpqi-ir-ok-tag {
    font-size: 12px;
    font-weight: 500;
    color: #9ca3af;
}
.wpqi-ir-notes {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    color: #374151;
    margin-bottom: 16px;
}
.wpqi-ir-notes strong {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 4px;
}
.wpqi-ir-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.wpqi-ir-photo { text-align: center; }
.wpqi-ir-photo img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}
.wpqi-ir-photo-caption {
    font-size: 11px;
    color: #6b7280;
    margin-top: 3px;
    max-width: 100px;
}

@media (max-width: 640px) {
    .wpqi-ir-section { padding-left: 20px; padding-right: 20px; }
}
