/**
 * Alpha Tech - Standardized Industrial A4 Datasheet Stylesheet (Continuous Flow)
 * Optimized for screen preview and pixel-perfect A4 printing / PDF export
 */

:root {
    --ds-primary: #0f172a;
    --ds-accent: #0284c7;
    --ds-accent-dark: #0369a1;
    --ds-text: #1e293b;
    --ds-text-light: #64748b;
    --ds-border: #cbd5e1;
    --ds-border-light: #e2e8f0;
    --ds-bg-light: #f8fafc;
    --ds-cat-bg: #1e293b;
}

* {
    box-sizing: border-box;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

body.datasheet-body {
    margin: 0;
    padding: 0;
    background-color: #525659;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ds-text);
    line-height: 1.35;
    font-size: 10px;
}

/* Floating Action Bar for Web View */
.datasheet-action-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: #1e293b;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.datasheet-action-bar .brand {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.datasheet-action-bar .btn-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.datasheet-action-bar button,
.datasheet-action-bar a {
    padding: 7px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-print {
    background: var(--ds-accent);
    color: #fff;
}
.btn-print:hover {
    background: var(--ds-accent-dark);
}

.btn-close {
    background: #334155;
    color: #e2e8f0;
}
.btn-close:hover {
    background: #475569;
}

/* Page container (Web view shows continuous A4 sheet with shadow) */
.datasheet-wrapper {
    padding: 68px 0 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.datasheet-sheet {
    width: 210mm;
    min-height: 297mm;
    padding: 10mm 12mm;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    position: relative;
    box-sizing: border-box;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

/* Product Title & Badge (Product-First Design) */
.ds-product-head {
    border-top: 2.5px solid var(--ds-primary);
    padding-top: 5px;
    margin-bottom: 7px;
    break-inside: avoid;
    page-break-inside: avoid;
}

.ds-model-badge {
    display: inline-block;
    background: var(--ds-primary);
    color: #fff;
    font-size: 8.5px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 2px;
    letter-spacing: 0.06em;
    margin-bottom: 3px;
    line-height: 1.2;
}

.ds-product-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--ds-primary);
    margin: 0 0 2px;
    line-height: 1.15;
}

.ds-product-subtitle {
    font-size: 9.5px;
    color: var(--ds-accent-dark);
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

/* Hero Grid (Images + Features) */
.ds-hero-grid {
    display: grid;
    grid-template-columns: 78mm 1fr;
    gap: 8mm;
    margin-bottom: 7px;
    break-inside: avoid;
    page-break-inside: avoid;
}

.ds-hero-no-img {
    grid-template-columns: 1fr;
}

.ds-hero-no-features {
    grid-template-columns: 1fr;
}

.ds-gallery {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ds-main-img-wrap {
    width: 100%;
    height: 48mm;
    background: var(--ds-bg-light);
    border: 1px solid var(--ds-border-light);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ds-main-img-wrap img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
}

.ds-thumb-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.ds-thumb-item {
    height: 15mm;
    background: var(--ds-bg-light);
    border: 1px solid var(--ds-border-light);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ds-thumb-item img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* Key Features */
.ds-features-box {
    background: var(--ds-bg-light);
    border: 1px solid var(--ds-border-light);
    border-left: 3px solid var(--ds-accent);
    border-radius: 3px;
    padding: 7px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    break-inside: avoid;
    page-break-inside: avoid;
}

.ds-section-title {
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ds-primary);
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    break-after: avoid;
    page-break-after: avoid;
}

.ds-section-title::before {
    content: "";
    display: inline-block;
    width: 3.5px;
    height: 10px;
    background: var(--ds-accent);
    border-radius: 1px;
    flex-shrink: 0;
}

.ds-features-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ds-features-list li {
    font-size: 9px;
    line-height: 1.35;
    color: var(--ds-text);
    display: flex;
    align-items: flex-start;
    gap: 5px;
}

.ds-features-list li .bullet {
    color: var(--ds-accent);
    font-weight: 900;
    font-size: 10.5px;
    line-height: 1;
    margin-top: 1px;
    flex-shrink: 0;
}

/* Overview Box */
.ds-overview-box {
    margin-bottom: 7px;
    break-inside: avoid;
    page-break-inside: avoid;
}

.ds-overview-text {
    font-size: 9px;
    line-height: 1.4;
    color: #334155;
    margin: 0;
    text-align: justify;
}

/* Technical Specifications Matrix */
.ds-specs-block {
    margin-bottom: 7px;
}

.ds-full-specs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8.5px;
    margin-bottom: 0;
}

.ds-full-specs-table th,
.ds-full-specs-table td {
    padding: 2.2px 6px;
    border: 1px solid #e2e8f0;
    line-height: 1.25;
}

.ds-full-specs-table tr.sec-header {
    break-after: avoid;
    page-break-after: avoid;
}

.ds-full-specs-table tr.sec-header th {
    background: var(--ds-cat-bg);
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 8.5px;
    letter-spacing: 0.05em;
    padding: 2.8px 6px;
}

.ds-full-specs-table tr.spec-row {
    break-inside: avoid;
    page-break-inside: avoid;
}

.ds-full-specs-table td.item-name {
    width: 28%;
    font-weight: 700;
    color: #334155;
    background: #f8fafc;
}

.ds-full-specs-table td.item-value {
    width: 72%;
    color: var(--ds-text);
}

/* Diagrams & Ordering */
.ds-diagram-block {
    margin-bottom: 7px;
    break-inside: avoid;
    page-break-inside: avoid;
}

.ds-diagram-card {
    border: 1px solid var(--ds-border-light);
    border-radius: 3px;
    padding: 5px;
    background: #fff;
    height: 36mm;
    display: flex;
    flex-direction: column;
}

.ds-diagram-card .diagram-title {
    font-size: 8px;
    font-weight: 700;
    color: var(--ds-primary);
    margin-bottom: 3px;
    text-transform: uppercase;
}

.ds-diagram-card .img-box {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--ds-bg-light);
    border-radius: 2px;
}

.ds-diagram-card img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
}

.ds-drawing-note {
    font-size: 7.5pt;
    color: #475569;
    margin: -3px 0 5px 2px;
    line-height: 1.3;
}

/* Ordering Guide Table */
.ds-ordering-block {
    margin-bottom: 7px;
    break-inside: avoid;
    page-break-inside: avoid;
}

.ds-ordering-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8px;
}

.ds-ordering-table thead,
.ds-ordering-table thead tr {
    break-after: avoid;
    page-break-after: avoid;
}

.ds-ordering-table tr.order-row {
    break-inside: avoid;
    page-break-inside: avoid;
}

.ds-ordering-table th {
    background: #334155;
    color: #fff;
    font-weight: 700;
    padding: 2.8px 6px;
    text-align: left;
    border: 1px solid #475569;
}

.ds-ordering-table td {
    padding: 2.5px 6px;
    border: 1px solid var(--ds-border-light);
    line-height: 1.25;
}

/* Bottom Contact & Inquiries Block */
.ds-contact-block {
    margin-top: 6px;
    margin-bottom: 5px;
    padding: 5px 8px;
    background: #f8fafc;
    border: 1px solid var(--ds-border-light);
    border-left: 3px solid var(--ds-primary);
    border-radius: 3px;
    break-inside: avoid;
    page-break-inside: avoid;
}

.ds-contact-title {
    font-size: 7.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ds-primary);
    margin-bottom: 3px;
    break-after: avoid;
    page-break-after: avoid;
}

.ds-contact-matrix {
    display: grid;
    grid-template-columns: 165px 1fr 130px;
    gap: 8px;
    align-items: center;
}

/* 1. Brand Logo */
.ds-contact-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    border-right: 1px solid var(--ds-border-light);
    padding-right: 6px;
}

.ds-brand-logo {
    width: 30px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.ds-brand-meta {
    display: flex;
    flex-direction: column;
}

.ds-brand-name {
    font-size: 10px;
    font-weight: 800;
    color: var(--ds-primary);
    letter-spacing: 0.04em;
    line-height: 1.1;
}

.ds-brand-tagline {
    font-size: 6.8px;
    font-weight: 600;
    color: var(--ds-text);
    line-height: 1.2;
    margin-top: 1px;
}

.ds-brand-loc {
    font-size: 6.5px;
    color: var(--ds-text-light);
    line-height: 1.2;
}

/* 2. Contact Channels */
.ds-contact-channels {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    font-size: 7.5px;
    line-height: 1.25;
}

.ds-channel-item {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.channel-label {
    font-size: 6.8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ds-text-light);
    width: 54px;
    flex-shrink: 0;
}

.channel-val {
    font-weight: 600;
    color: var(--ds-primary);
    text-decoration: none;
    font-size: 7.5px;
}

.channel-val:hover {
    color: var(--ds-accent);
    text-decoration: underline;
}

/* 3. QR Code */
.ds-contact-qr {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    border-left: 1px solid var(--ds-border-light);
    padding-left: 6px;
}

.ds-qr-wrap {
    display: block;
    line-height: 0;
    flex-shrink: 0;
}

.ds-qr-svg {
    width: 17mm;
    height: 17mm;
    min-width: 64px;
    min-height: 64px;
    max-width: 68px;
    max-height: 68px;
    display: block;
    background: #ffffff;
    border: 1px solid var(--ds-border-light);
    border-radius: 2px;
    padding: 1mm;
    box-sizing: border-box;
}

.ds-qr-badge {
    font-size: 6px;
    font-weight: 800;
    letter-spacing: 0.05em;
    background: var(--ds-primary);
    color: #ffffff;
    padding: 1px 3px;
    border-radius: 2px;
    display: inline-block;
    align-self: flex-start;
}

.ds-qr-hint {
    font-size: 6.2px;
    color: var(--ds-text-light);
    line-height: 1.2;
    margin-top: 1px;
}

/* Footer (Version number only) */
.ds-footer {
    border-top: 1px solid var(--ds-border);
    padding-top: 3px;
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 7.5px;
    color: var(--ds-text-light);
    min-height: 12px;
    break-inside: avoid;
    page-break-inside: avoid;
}

.ds-footer-meta {
    margin-left: auto;
}

.ds-doc-version {
    font-weight: 600;
    color: var(--ds-text);
}

/* PRINT MEDIA SPECIFICATIONS (Continuous natural flow, strict 2-page max) */
@media print {
    @page {
        size: A4 portrait;
        margin: 10mm 12mm 10mm 12mm;
    }

    body.datasheet-body {
        background: #fff !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .datasheet-action-bar {
        display: none !important;
    }

    .datasheet-wrapper {
        padding: 0 !important;
        margin: 0 !important;
        gap: 0 !important;
        display: block !important;
    }

    .datasheet-sheet {
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-height: auto !important;
        border: none !important;
        display: block !important;
    }
}
