/* ============================================
   WARRANTY CARD GENERATOR - Dedicated Stylesheet
   Ray2Volt Solar Toolbox - Brutalist/Minimalist Design
   Matches Invoice & Receipt 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');

/* ============================================
   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 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.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;
    color: var(--primary);
}

/* --- 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: 0.95rem;
    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: #fff;
}

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

/* --- Buttons --- */
.warranty-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.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: #fff;
    cursor: pointer;
    transition: all 0.1s ease;
}

.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(--border-medium);
    border-radius: 2px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.1s ease;
}

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


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

#warrantyPreview {
    display: none;
    margin: 2rem auto;
    font-family: 'Google Sans Flex', Arial, sans-serif;
    color: #1a1a1a;
}

#warrantyPreview.visible {
    display: block;
}

/* --- Page Layout --- */
.warranty-page {
    width: 210mm;
    min-height: 297mm;
    height: 297mm;
    margin: 0 auto 20px auto;
    padding: 20mm 15mm 25mm 15mm;
    /* Increased top/bottom padding for "space" */
    background: #fff;
    border: 1px solid #d0d0d0;
    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;
}

.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: 15px;
    /* Restored slight margin */
    padding-bottom: 10px;
    /* Reduced padding */
    border-bottom: 2px solid #1a1a1a;
}

.cover-logo-small {
    width: 130px;
    /* Slightly smaller logo */
    height: auto;
    order: 2;
}

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

.combined-title {
    font-size: 22pt;
    /* Slightly smaller title */
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: 1px;
    margin: 0;
    text-transform: uppercase;
}

.combined-subtitle {
    font-size: 11pt;
    font-weight: 600;
    color: #555;
    margin: 2px 0 0 0;
    letter-spacing: 0.5px;
}

/* --- Project Banner --- */
.combined-project-id-banner {
    display: flex;
    justify-content: space-between;
    background: #E8F4FA;
    border: 1px solid #d0d0d0;
    border-radius: 2px;
    padding: 8px 15px;
    /* Compact padding */
    margin-bottom: 15px;
    /* Reduced margin */
    font-size: 10.5pt;
    color: #1a1a1a;
}

.combined-project-id-banner strong {
    color: #1a1a1a;
    font-weight: 700;
}

/* --- Sections --- */
.warranty-section {
    margin-bottom: 15px;
    /* Reduced margin */
}

.warranty-section h3 {
    font-size: 11pt;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #d0d0d0;
    background: #fafafa;
    padding: 6px 10px;
}

/* --- Info Grid --- */
.warranty-info-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    /* adjusted column width */
    gap: 5px 15px;
    /* tighter gap */
    font-size: 10pt;
    line-height: 1.5;
    padding: 0 10px;
}

.warranty-info-grid .info-label {
    font-weight: 600;
    color: #555;
}

.warranty-info-grid .info-value {
    color: #1a1a1a;
    font-weight: 500;
}

/* --- Specs Table --- */
.warranty-specs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    border: 1px solid #d0d0d0;
}

.warranty-specs-table th,
.warranty-specs-table td {
    padding: 6px 10px;
    /* Compact padding */
    text-align: left;
    font-size: 9.5pt;
    border: 1px solid #d0d0d0;
}

.warranty-specs-table th {
    background-color: #E8F4FA;
    font-weight: 600;
    color: #1a1a1a;
    width: 40%;
}

.warranty-specs-table td {
    background-color: #fff;
    color: #1a1a1a;
}

/* --- Overview Grid --- */
.warranty-overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 5px;
}

.warranty-overview-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    /* Compact padding */
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 2px;
}

.warranty-overview-item .overview-icon {
    font-size: 20px;
    flex-shrink: 0;
    color: #1a1a1a;
}

.warranty-overview-item .overview-details strong {
    display: block;
    font-size: 9.5pt;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.warranty-overview-item .overview-details p {
    font-size: 9pt;
    color: #555;
    margin: 0;
    line-height: 1.3;
}

/* --- 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: #fafafa;
    border: 1px solid #d0d0d0;
    border-radius: 2px;
}

.serial-number-item {
    font-family: 'Courier New', monospace;
    font-size: 9pt;
    color: #1a1a1a;
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 4px 8px;
    text-align: center;
    border-radius: 2px;
}

/* --- Footer Area --- */
.cover-footer {
    position: absolute;
    bottom: 20mm;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9pt;
    color: #555;
    background: #fafafa;
    padding: 8px;
    border-top: 1px solid #d0d0d0;
}

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

/* --- Terms Pages --- */
.warranty-highlight-box {
    background: #E8F4FA;
    border: 1px solid #d0d0d0;
    border-radius: 2px;
    padding: 15px;
    /* Compact padding */
    margin: 15px 0;
    text-align: center;
}

.warranty-highlight-box .highlight-label {
    font-size: 10pt;
    color: #555;
    margin-bottom: 4px;
}

.warranty-highlight-box .highlight-value {
    font-size: 18pt;
    font-weight: 700;
    color: #1a1a1a;
}

.warranty-terms-box {
    border: 1px solid #d0d0d0;
    border-radius: 2px;
    margin-bottom: 15px;
}

.warranty-terms-box .terms-header {
    background-color: #E8F4FA;
    padding: 10px 15px;
    font-size: 10.5pt;
    font-weight: 600;
    color: #1a1a1a;
    border-bottom: 1px solid #d0d0d0;
}

.warranty-terms-box .terms-content {
    padding: 15px;
    font-size: 9.5pt;
    line-height: 1.6;
    color: #1a1a1a;
}

.warranty-terms-box .terms-content h4 {
    font-size: 10.5pt;
    font-weight: 600;
    color: #1a1a1a;
    margin: 12px 0 6px 0;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.warranty-terms-box .terms-content ul {
    margin: 8px 0;
    padding-left: 20px;
    color: #333;
}

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

/* --- Final Page --- */
.warranty-dcr-section {
    background: #fff;
    border: 1px solid #d0d0d0;
    border-left: 4px solid #1a1a1a;
    border-radius: 2px;
    padding: 12px;
    margin-bottom: 15px;
}

.warranty-dcr-section h4 {
    font-size: 10.5pt;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 8px 0;
}

.warranty-contact-section {
    border: 1px solid #d0d0d0;
    border-radius: 2px;
    margin-bottom: 15px;
}

.warranty-contact-section .contact-header {
    background-color: #E8F4FA;
    padding: 8px 15px;
    font-size: 10.5pt;
    font-weight: 600;
    color: #1a1a1a;
    border-bottom: 1px solid #d0d0d0;
}

.warranty-contact-section .contact-content {
    padding: 12px;
    font-size: 9.5pt;
    line-height: 1.5;
    color: #1a1a1a;
}

.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 #1a1a1a;
    margin-bottom: 8px;
}

.signature-block .signature-name {
    font-weight: 600;
    font-size: 10.5pt;
    color: #1a1a1a;
}

.signature-block .signature-title {
    font-size: 9pt;
    color: #666;
}

.warranty-disclaimer {
    margin-top: 25px;
    /* Reduced margin */
    padding: 8px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    font-size: 8.5pt;
    color: #666;
    text-align: center;
    font-style: italic;
}


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

/* Tablet */
@media screen and (max-width: 1024px) {
    .warranty-form-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile */
@media screen and (max-width: 768px) {
    .warranty-page-header-ui {
        margin-bottom: 1rem;
    }

    .warranty-page-header-ui h1 {
        font-size: 1.5rem;
    }

    .warranty-page-header-ui p {
        font-size: 0.875rem;
    }

    .warranty-form-card {
        padding: 1rem;
    }

    .warranty-section-title {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .warranty-input-field {
        padding: 0.875rem 1rem;
        font-size: 1rem;
        /* Prevent iOS zoom */
    }

    .warranty-actions {
        flex-direction: column;
    }

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

    .warranty-page {
        width: 100%;
        min-height: auto;
        height: auto;
        margin: 1rem auto;
        padding: 15px;
        font-size: 9pt;
        border: 1px solid #eee;
    }

    .combined-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .cover-logo-small {
        width: 100px;
        order: 0;
    }

    .combined-title {
        font-size: 18pt;
    }

    .warranty-info-grid {
        grid-template-columns: 1fr;
    }

    .warranty-overview-grid {
        grid-template-columns: 1fr;
    }

    .warranty-signature-section {
        flex-direction: column;
        gap: 20px;
    }

    .signature-block {
        width: 100%;
    }

    .warranty-page-footer {
        position: static;
        margin-top: 15px;
    }
}

/* Small Mobile */
@media screen and (max-width: 480px) {
    .warranty-form-card {
        padding: 0.875rem;
    }

    .warranty-page {
        padding: 10px;
        font-size: 8pt;
    }

    .combined-title {
        font-size: 16pt;
    }

    .warranty-specs-table th,
    .warranty-specs-table td {
        padding: 4px 6px;
        font-size: 8.5pt;
    }

    .serial-numbers-grid {
        grid-template-columns: 1fr 1fr;
    }

    .warranty-highlight-box .highlight-value {
        font-size: 14pt;
    }
}

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

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

    #warrantyPreview {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        display: block !important;
        background: white;
    }

    .warranty-page {
        width: 100%;
        height: 100vh;
        min-height: 100vh;
        margin: 0;
        padding: 20mm 15mm 25mm 15mm;
        /* Matches screen padding */
        border: none;
        box-shadow: none;
        page-break-after: always;
        page-break-inside: avoid;
    }

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

    /* Force background colors for headers */
    .combined-project-id-banner,
    .warranty-specs-table th,
    .warranty-highlight-box,
    .warranty-terms-box .terms-header,
    .warranty-contact-section .contact-header {
        background-color: #E8F4FA !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .warranty-section h3 {
        background: #fafafa !important;
    }

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

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