/* ============================================
   WARRANTY CARD GENERATOR - Dedicated Stylesheet
   Ray2Volt Solar Toolbox - Brutalist/Minimalist Design
   Matches Quote Generator styling
   ============================================ */

/* Google Sans Flex for UI elements */
@import url('https://fonts.googleapis.com/css2?family=Google+Sans+Flex:wght@400;500;600;700&display=swap');

.mobile-nav-toggle > .material-symbols-rounded,
.sidebar-close-btn > .material-symbols-rounded {
    font-size: 24px;
}

/* ============================================
   FORM SECTION - BRUTALIST STYLING
   ============================================ */

/* --- Page Header --- */
.warranty-page-header-ui {
    margin-bottom: 1.5rem;
}

.warranty-page-header-ui h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.warranty-page-header-ui p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* --- Form Cards --- */
.warranty-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: var(--section-gap, 1.5rem);
}

.warranty-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: 2px;
    padding: 1rem;
}

.warranty-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.warranty-section-title .icon {
    width: 20px;
    height: 20px;
    font-size: 20px;
    color: var(--primary);
}

.warranty-field-note {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: -0.75rem 0 1.25rem;
}

/* --- Input Groups --- */
.warranty-input-group {
    margin-bottom: 1.25rem;
}

.warranty-input-group:last-child {
    margin-bottom: 0;
}

.warranty-input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* --- Input Fields --- */
.warranty-input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 16px;
    font-family: 'Google Sans Flex', 'Google Sans', sans-serif;
    border: 1px solid var(--border-medium);
    border-radius: 2px;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.1s ease;
    box-sizing: border-box;
}

.warranty-input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--bg-card);
}

textarea.warranty-input-field {
    resize: vertical;
    min-height: 70px;
}

/* --- Buttons --- */
.warranty-actions {
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
}

.warranty-btn-primary {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Google Sans Flex', 'Google Sans', sans-serif;
    border: 1px solid var(--primary);
    border-radius: 2px;
    background: var(--primary);
    color: var(--on-primary);
    cursor: pointer;
    transition: all 0.1s ease;
    width: 100%;
}

.warranty-btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.warranty-btn-secondary {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Google Sans Flex', 'Google Sans', sans-serif;
    border: 1px solid var(--primary);
    border-radius: 2px;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.1s ease;
    width: 100%;
}

.warranty-btn-secondary:hover {
    background: var(--primary);
    color: var(--on-primary);
}


/* ============================================
   WARRANTY CERTIFICATE PREVIEW
   Minimalist, Print-Friendly, Clean
   ============================================ */

/* The full token set from the Short Proposal (`#quotePreview` in
   quote-generator-preview-layout.css), name for name, so the certificate and
   the quotation resolve to the same colours. */
#warrantyPreview {
    --warranty-navy: #1F4E79;
    --warranty-navy-dark: #17395A;
    --warranty-tint: #EDF3FA;
    --warranty-ink: #1A1A1A;
    --warranty-gray: #555555;
    --warranty-muted: #777777;
    --warranty-line: #D8DEE6;
    --warranty-soft: #F7F9FC;
    --warranty-preview-scale: 1;

    display: none;
    margin: 2rem auto;
    max-width: 100%;
    font-family: 'Google Sans Flex', Arial, sans-serif;
    color: var(--warranty-ink);
}

#warrantyPreview.visible {
    display: block;
}

/* base.css points headings at Google Sans for the toolbox UI; the document
   pins Flex back, exactly as the proposal does. */
#warrantyPreview h1,
#warrantyPreview h2,
#warrantyPreview h3,
#warrantyPreview h4 {
    font-family: 'Google Sans Flex', Arial, sans-serif;
}

/* Document icons are the proposal's Feather set: 24-unit stroke marks that
   inherit `currentColor`, never an icon font. Material Symbols stays on the
   toolbox UI around the document. */
#warrantyPreview svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* --- Page Layout --- */
.warranty-page {
    width: 210mm;
    min-height: 297mm;
    height: 297mm;
    margin: 0 auto 20px auto;
    padding: 12mm 14mm 24mm 14mm;
    background: #fff;
    border: none;
    border-radius: 2px;
    font-size: 10pt;
    /* Slightly smaller base font */
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    page-break-after: always;
    page-break-inside: avoid;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    zoom: var(--warranty-preview-scale);
}

.warranty-page:last-child {
    page-break-after: auto;
}

/* --- Header Section --- */
.combined-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 6mm;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--warranty-navy);
}

.cover-logo-small {
    width: 170px;
    height: auto;
    order: 0;
}

.combined-title-section {
    flex: 1;
}

.combined-title {
    font-size: 15pt;
    font-weight: 700;
    color: var(--warranty-ink);
    letter-spacing: 0.5px;
    margin: 0;
    text-transform: uppercase;
}

.combined-subtitle {
    font-size: 9pt;
    font-weight: 400;
    color: var(--warranty-muted);
    margin: 2px 0 0 0;
    letter-spacing: 0.4px;
}

/* --- Project Banner ---
   Takes the proposal's `.qp-dashboard-hero` treatment: tint panel, hairline
   border, 4px navy edge, uppercase label over a navy-dark value. */
.combined-project-id-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--warranty-tint);
    border: 1px solid var(--warranty-line);
    border-left: 4px solid var(--warranty-navy);
    border-radius: 2px;
    padding: 5mm 6mm;
    margin-bottom: 6mm;
    font-size: 8pt;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--warranty-navy);
}

.combined-project-id-banner strong {
    display: block;
    margin-top: 3px;
    font-size: 11pt;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-transform: none;
    color: var(--warranty-navy-dark);
}

.combined-project-id-banner span:last-child {
    text-align: right;
}

/* --- Sections --- */
.warranty-section {
    margin-bottom: 6mm;
}

/* Character for character the Short Proposal's `.qp-section h3`: uppercase
   navy over a hairline rule, with no fill. The old grey band was a third light
   surface competing with the tint used by the banner and the terms headers,
   which is what made the pages read as two different documents. */
.warranty-section h3 {
    font-size: 10pt;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--warranty-navy);
    margin: 0 0 3mm 0;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--warranty-line);
}

/* --- Info Grid: the proposal's `.qp-prep-meta` label/value pair --- */
.warranty-info-grid {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 5px 10px;
    align-items: baseline;
    line-height: 1.45;
}

.warranty-info-grid .info-label {
    font-size: 8pt;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--warranty-muted);
}

.warranty-info-grid .info-value {
    font-size: 9pt;
    font-weight: 500;
    color: var(--warranty-ink);
    overflow-wrap: anywhere;
}

/* `.qp-about-text` — the proposal sets body copy ragged-right, not justified. */
.warranty-about-copy {
    font-size: 9.5pt;
    line-height: 1.6;
    color: var(--warranty-gray);
    margin: 0;
}

/* --- Specs Table: identical geometry and colour to `.qp-specs-table` --- */
.warranty-specs-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--warranty-line);
}

.warranty-specs-table th,
.warranty-specs-table td {
    padding: 7px 10px;
    text-align: left;
    font-size: 9.5pt;
    border: 1px solid var(--warranty-line);
}

/* Tinted header cell with ink text — never a dark fill, and never navy text
   that would read as a second heading level inside the table. */
.warranty-specs-table th {
    background-color: var(--warranty-tint);
    font-weight: 600;
    color: var(--warranty-ink);
    width: 40%;
}

.warranty-specs-table td {
    background-color: #fff;
    color: var(--warranty-ink);
}

/* --- Overview Grid: the proposal's `.qp-benefit-item` card, two up ---
   Bare navy stroke icon beside the label, hairline border, no fill. */
.warranty-overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3mm;
}

.warranty-overview-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 10px;
    background: #fff;
    border: 1px solid var(--warranty-line);
    border-radius: 2px;
}

.warranty-overview-item .overview-icon {
    flex-shrink: 0;
    width: 17px;
    height: 17px;
    margin-top: 1px;
    color: var(--warranty-navy);
}

.warranty-overview-item .overview-details strong {
    display: block;
    font-size: 9pt;
    color: var(--warranty-ink);
    margin-bottom: 2px;
}

.warranty-overview-item .overview-details p {
    font-size: 8pt;
    color: var(--warranty-gray);
    margin: 0;
    line-height: 1.4;
}

/* --- Serial Numbers Grid --- */
.serial-numbers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
    background: var(--warranty-soft);
    border: 1px solid var(--warranty-line);
    border-radius: 2px;
}

.serial-number-item {
    font-family: 'Google Sans Flex', Arial, sans-serif;
    font-size: 8pt;
    letter-spacing: 0.3px;
    font-variant-numeric: tabular-nums;
    color: var(--warranty-ink);
    background: #fff;
    border: 1px solid var(--warranty-line);
    padding: 4px 8px;
    text-align: center;
    border-radius: 2px;
}

/* The page is a fixed A4 with `overflow: hidden`, so a long serial list used to
   be clipped without a trace. Comfortable density holds 24 chips; past that the
   grid steps down one tier rather than losing rows off the bottom edge. */
.serial-numbers-grid.is-dense {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 5px;
    padding: 8px;
}

.serial-numbers-grid.is-dense .serial-number-item {
    font-size: 7.5pt;
    letter-spacing: 0.1px;
    padding: 3px 4px;
}

.serial-empty {
    grid-column: 1 / -1;
    font-size: 9pt;
    font-style: italic;
    color: var(--warranty-muted);
}

.serial-overflow-note {
    grid-column: 1 / -1;
    margin-top: 2px;
    font-size: 8pt;
    font-style: italic;
    color: var(--warranty-muted);
}

/* --- Footer Area --- */
/* `.qp-cover-footer` from the Short Proposal: centred 8pt muted lines over a
   hairline rule, no fill. Two stacked grey bands at the foot of page 1 — this
   one and the running footer below it — read as a mistake. */
.cover-footer {
    position: absolute;
    bottom: 19mm;
    left: 14mm;
    right: 14mm;
    text-align: center;
    font-size: 8pt;
    line-height: 1.5;
    color: var(--warranty-muted);
    padding: 6px 0 0;
    background: none;
    border-top: 1px solid var(--warranty-line);
}

.cover-footer p {
    margin: 0;
}

.warranty-page-footer {
    position: absolute;
    bottom: 8mm;
    /* Reduced bottom clearance */
    left: 14mm;
    right: 14mm;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--warranty-line);
    padding-top: 6px;
    font-size: 8pt;
    color: var(--warranty-muted);
}

/* --- Terms Pages ---
   The headline warranty period is the proposal's `.qp-metric-primary`: soft
   panel inside a navy hairline, uppercase navy label, navy-dark value. */
.warranty-highlight-box {
    background: var(--warranty-soft);
    border: 1px solid var(--warranty-navy);
    border-radius: 2px;
    padding: 4mm 5mm;
    margin: 0 0 6mm 0;
    text-align: center;
}

.warranty-highlight-box .highlight-label {
    font-size: 8pt;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--warranty-navy);
    margin: 0;
}

.warranty-highlight-box .highlight-value {
    font-size: 17pt;
    font-weight: 700;
    line-height: 1.1;
    color: var(--warranty-navy-dark);
    margin: 6px 0;
}

.warranty-highlight-box .highlight-label strong {
    font-weight: 700;
    color: var(--warranty-navy-dark);
}

/* Terms and contact panels are the proposal's `.qp-prep-card`. */
.warranty-terms-box,
.warranty-contact-section {
    border: 1px solid var(--warranty-line);
    border-top: 3px solid var(--warranty-navy);
    border-radius: 2px;
    overflow: hidden;
    background: #fff;
    margin-bottom: 6mm;
}

/* Card headers are `.qp-prep-header`: tint bar, 8pt uppercase navy on 1px
   tracking, 12px stroke icon. */
.warranty-terms-box .terms-header,
.warranty-contact-section .contact-header {
    display: flex;
    align-items: center;
    gap: 7px;
    background-color: var(--warranty-tint);
    padding: 6px 11px;
    font-size: 8pt;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--warranty-navy);
    border-bottom: 1px solid var(--warranty-line);
}

.terms-header-icon,
.contact-header-icon {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    color: var(--warranty-navy);
}

/* The product name inside a header bar keeps its own case — a model number is
   not a label and should not be flattened to uppercase tracking. */
.warranty-terms-box .terms-header .terms-header-value {
    font-weight: 600;
    letter-spacing: 0.2px;
    text-transform: none;
    color: var(--warranty-navy-dark);
}

.warranty-terms-box .terms-content {
    padding: 9px 12px;
    font-size: 9pt;
    line-height: 1.45;
    color: var(--warranty-ink);
}

/* Sub-heading inside a card, styled like `.qp-prep-body strong` / the
   proposal's card `strong`: navy-dark and heavier, but not a second uppercase
   level competing with the section rules above it. Underlining it was the one
   piece of styling in this document that came from nowhere else in the set. */
.warranty-terms-box .terms-content h4 {
    font-size: 9.5pt;
    font-weight: 700;
    color: var(--warranty-navy-dark);
    margin: 10px 0 4px 0;
}

.warranty-terms-box .terms-content h4:first-child {
    margin-top: 0;
}

.warranty-terms-box .terms-content ul {
    margin: 8px 0;
    padding-left: 20px;
    color: var(--warranty-gray);
}

.warranty-terms-box .terms-content li {
    margin-bottom: 3px;
}

.warranty-terms-box .terms-content li strong {
    color: var(--warranty-ink);
}

.warranty-terms-box .terms-content p {
    margin: 6px 0;
    text-align: justify;
}

/* --- Final Page ---
   Same tint-panel-with-navy-edge idiom as the project banner. */
.warranty-dcr-section {
    background: var(--warranty-tint);
    border: 1px solid var(--warranty-line);
    border-left: 4px solid var(--warranty-navy);
    border-radius: 2px;
    padding: 5mm 6mm;
    margin-bottom: 6mm;
    font-size: 9pt;
    line-height: 1.45;
    color: var(--warranty-ink);
}

.warranty-dcr-section h4 {
    font-size: 8pt;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--warranty-navy);
    margin: 0 0 6px 0;
}

.warranty-contact-section .contact-content {
    padding: 9px 12px;
    font-size: 9pt;
    line-height: 1.45;
    color: var(--warranty-ink);
}

/* `.qp-prep-body strong` — the card's subject line. */
.warranty-contact-section .contact-company {
    font-size: 10.5pt;
    font-weight: 700;
    color: var(--warranty-ink);
    margin: 0 0 7px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--warranty-line);
}

/* Phone, mail and address each get their own labelled row so the customer can
   find the one they need without reading a run-on line. */
.warranty-contact-section .contact-list {
    display: grid;
    gap: 6px;
    margin: 0;
}

.warranty-contact-section .contact-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

/* Label column matches `.qp-prep-label`, value column `.qp-prep-value`. */
.warranty-contact-section .contact-row dt {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 8pt;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--warranty-muted);
}

.warranty-contact-section .contact-row dd {
    margin: 0;
    font-size: 9pt;
    font-weight: 500;
    color: var(--warranty-ink);
    overflow-wrap: anywhere;
}

.contact-row-icon {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    color: var(--warranty-navy);
}

.warranty-signature-section {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    /* Reduced margin */
    padding-top: 10px;
}

.signature-block {
    width: 40%;
    text-align: center;
}

.signature-block .signature-line {
    border-top: 1px solid var(--warranty-navy);
    margin-bottom: 8px;
}

.signature-block .signature-name {
    font-weight: 600;
    font-size: 10.5pt;
    color: var(--warranty-navy);
}

.signature-block .signature-title {
    font-size: 9pt;
    color: var(--warranty-muted);
}

.warranty-disclaimer {
    margin-top: 6mm;
    padding: 8px 10px;
    background: var(--warranty-soft);
    border: 1px solid var(--warranty-line);
    border-radius: 2px;
    font-size: 8pt;
    line-height: 1.5;
    color: var(--warranty-muted);
    text-align: center;
}


/* ============================================
   RESPONSIVE STYLES
   ============================================ */

/* Mobile */
@media screen and (max-width: 768px) {
    .no-print-area {
        max-width: none;
    }

    .warranty-page-header-ui {
        margin-bottom: 1rem;
    }

    .warranty-page-header-ui h1 {
        font-size: 1.4rem;
        line-height: 1.2;
    }

    .warranty-page-header-ui p {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .warranty-section-title {
        margin-bottom: 0.9rem;
        padding-bottom: 0.6rem;
        font-size: 0.95rem;
    }
}

@media screen and (min-width: 600px) {
    .warranty-actions {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 1rem;
    }

    .warranty-btn-primary,
    .warranty-btn-secondary {
        width: auto;
    }
}

@media screen and (min-width: 769px) {
    .warranty-form-card {
        padding: 1.5rem;
    }

    .warranty-input-field {
        font-size: 0.95rem;
    }
}

@media screen and (min-width: 1025px) {
    .warranty-form-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        margin-bottom: 2rem;
    }

    /* Contact details apply to the whole certificate, not to one column's
       worth of it, so the card runs the full width under the other two. */
    .warranty-form-card-wide {
        grid-column: 1 / -1;
    }

    .warranty-contact-fields {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0 2rem;
    }

    .warranty-contact-fields .warranty-input-group {
        margin-bottom: 0;
    }
}

/* The quotation and warranty previews both keep one fixed A4 canvas on screen. */
#warrantyPreview .warranty-page {
    width: 210mm !important;
    max-width: none !important;
    height: 297mm !important;
    min-height: 297mm !important;
    padding: 12mm 14mm 24mm 14mm !important;
    overflow: hidden !important;
}

#warrantyPreview .combined-header {
    flex-direction: row !important;
    align-items: center !important;
    text-align: left !important;
    gap: 20px !important;
}

#warrantyPreview .combined-title {
    font-size: 15pt !important;
    letter-spacing: 0.5px !important;
}

#warrantyPreview .cover-logo-small {
    width: 170px !important;
    max-width: 170px !important;
    order: 2 !important;
}

#warrantyPreview .combined-project-id-banner {
    flex-direction: row !important;
    align-items: center !important;
}

#warrantyPreview .warranty-info-grid {
    grid-template-columns: 160px minmax(0, 1fr) !important;
}

#warrantyPreview .warranty-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

#warrantyPreview .warranty-specs-table {
    display: table !important;
    overflow: visible !important;
}

#warrantyPreview .cover-footer {
    position: absolute !important;
    bottom: 20mm !important;
    left: 0 !important;
    right: 0 !important;
    margin-top: 0 !important;
}

#warrantyPreview .warranty-page-footer {
    position: absolute !important;
    bottom: 8mm !important;
    left: 14mm !important;
    right: 14mm !important;
    margin-top: 0 !important;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    body * {
        visibility: hidden;
    }

    #warrantyPreview,
    #warrantyPreview * {
        visibility: visible;
    }

    #warrantyPreview {
        position: absolute;
        inset: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        display: block !important;
        background: white;
        --warranty-preview-scale: 1 !important;
    }

    .warranty-page {
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        margin: 0 !important;
        padding: 12mm 14mm 24mm 14mm !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: hidden !important;
        page-break-after: always !important;
        page-break-inside: avoid !important;
        zoom: 1 !important;
    }

    .warranty-page:last-child {
        page-break-after: auto;
    }

    /* Force the two document fills through: tint for panels and header bars,
       soft for the recessed surfaces. */
    .combined-project-id-banner,
    .warranty-specs-table th,
    .warranty-dcr-section,
    .warranty-terms-box .terms-header,
    .warranty-contact-section .contact-header {
        background-color: var(--warranty-tint) !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .warranty-highlight-box,
    .serial-numbers-grid,
    .warranty-disclaimer {
        background-color: var(--warranty-soft) !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .no-print-area {
        display: none !important;
    }

    @page {
        size: A4;
        margin: 0;
    }
}
