/* =========================================================
   GEM REPORT PAGE - MASTER STYLESHEET
   (Integrates with base.css design system)
   ========================================================= */

/* ---------- Global Reset for Report Page ---------- */
.report-page-wrapper {
    background: var(--color-light-gray);
    padding-bottom: 60px;
    min-height: 100vh;
    font-family: var(--font-family);
}

/* ---------- Hero Search Banner ---------- */
.report-hero-banner {
    position: relative;
    background-image: url('/assets/images/slides/slide2.png'); /* Replace with actual image */
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    padding: 5rem 0;
    min-height: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-bottom: none;
}

.report-hero-banner::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.65); /* 65% dark overlay */
    z-index: 0;
}

.report-hero-banner .container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    padding: 0 20px;
}

.report-hero-banner h1 {
    color: var(--color-white);
    font-size: 3.2rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.report-hero-banner .hero-subtitle {
    color: var(--color-white);
    font-size: 1.1rem;
    font-weight: 400;
    line-height: 1.6;
    max-width: 750px;
    margin: 0 auto 2.5rem auto;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

/* Search Form */
.report-hero-banner .report-search-form {
    display: inline-flex;
    align-items: stretch;
    width: 100%;
    max-width: 550px;
    background: var(--color-white);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.report-hero-banner .report-search-form input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    outline: none;
    font-size: 1rem;
    font-family: var(--font-family);
    color: var(--color-black);
    background: transparent;
}
.report-hero-banner .report-search-form input::placeholder {
    color: var(--color-gray);
}

.report-hero-banner .report-search-form button {
    background-color: var(--color-secondary);
    color: var(--color-primary);
    border: none;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.report-hero-banner .report-search-form button:hover {
    background-color: var(--color-primary);
    color: var(--color-white);
}
.report-hero-banner .report-search-form button svg {
    stroke: currentColor;
    width: 22px;
    height: 22px;
}

/* Container below hero */
.report-page-wrapper .container {
    max-width: 900px;
    margin: 80px auto 40px auto;
    padding: 0 20px;
}

/* ---------- Error Message ---------- */
.error-msg {
    background: #fff;
    color: #b91c1c;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* =========================================================
   CERTIFICATE CARD (Front & Back)
   ========================================================= */
.report-certificate {
    background: #ffffff;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    padding: 0 0 40px 0;
    font-family: 'Inter', 'Noto Sans SC', sans-serif;
    border-radius: 12px;        /* Added for modern look */
    overflow: hidden;           /* Keep rounded corners */
}

/* Header */
.report-header {
    background-color: #171c3e;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.report-header .logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #fff;
}
.report-header .logo-area img {
    height: 50px;
}
.report-header .logo-area h1 {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    margin: 0;
    letter-spacing: 1px;
}
.report-header .logo-area p {
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 1px;
    margin: 0;
    opacity: 0.8;
}
.report-header .website-url {
    color: #fff;
    font-size: 1rem;
    text-decoration: none;
}

/* Body */
.report-body {
    padding: 40px;
}
.product-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #000;
    margin: 0 0 5px 0;
    line-height: 1.1;
}
.product-title-cn {
    font-size: 2rem;
    font-weight: 400;
    color: #333;
    margin: 0 0 30px 0;
}

/* Details Grid */
.report-details-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 40px;
}

/* Left Column – Specs */
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 18px 0;
    border-bottom: 1px solid #f0f0f0;
}
.detail-row:last-child {
    border-bottom: none;
}
.detail-label {
    width: 60%;
    font-weight: 400;
    color: #333;
    font-size: 1rem;
    text-transform: uppercase;
}
.detail-value {
    width: 40%;
    font-weight: 700;
    color: #000;
    font-size: 1rem;
    text-align: left;
}

/* Right Column – Image */
.report-image-wrapper {
    text-align: center;
}
.report-image-wrapper img {
    max-width: 100%;
    height: auto;
    max-height: 350px;
    object-fit: contain;
    background: #f2f2f2;
    padding: 15px;
    border-radius: 8px;
}
.report-image-caption {
    font-size: 0.7rem;
    color: #666;
    margin-top: 10px;
}

/* Signature & Stamp */
.report-signature {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    margin: 20px 0 10px 0;
    padding-left: 10px;
}
.report-signature img {
    background: #fff;
}
.report-sig-image {
    max-width: 150px;
    width: 80%;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Disclaimers */
.report-divider {
    height: 2px;
    background: #e0e0e0;
    margin: 30px 0;
}
.disclaimer-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #000;
}
.disclaimer-content {
    font-size: 0.8rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Classification List */
.classification-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #000;
}
.classification-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 30px;
    font-size: 0.8rem;
    color: #333;
}
.classification-grid div {
    padding: 3px 0;
}

/* ---------- QR & Share Actions ---------- */
.qr-actions-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}
.qr-code-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.qr-code-img {
    background: #fff;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    width: 130px;
    height: 130px;
}
.qr-code-label {
    font-size: 0.75rem;
    color: #666;
    margin-top: 6px;
    letter-spacing: 0.5px;
}

/* Share Buttons */
.share-container {
    display: flex;
    align-items: center;
    gap: 15px;
}
.share-label {
    font-size: 0.8rem;
    color: #888;
    font-weight: 500;
}
.share-buttons {
    display: flex;
    gap: 10px;
}
.share-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #fff;
    text-decoration: none;
}
.share-btn.whatsapp { background-color: #25D366; }
.share-btn.facebook { background-color: #1877F2; }
.share-btn.copy-link { background-color: #6b7280; color: #fff; }
.share-btn:hover { transform: scale(1.1); }

/* =========================================================
   SECOND CERTIFICATE CARD (Front/Back with strict mm)
   – Styles from the inline <style> in index.php merged here
   ========================================================= */
.certificate-section {
    font-family: var(--font-family);
    background: var(--color-light);
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.certificate-wrapper {
    max-width: var(--container-max-width);
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}
.cards-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    width: 100%;
}
.card-container {
    flex: 0 0 auto;
    width: 100%;
    max-width: 480px;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.10);
    background: var(--color-white);
    border: 2px solid var(--color-secondary);
    overflow: hidden;
    aspect-ratio: 85 / 54;
    position: relative;
}
.card-front {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--color-white);
    font-family: var(--font-family);
}
.card-front .banner {
    background: var(--color-dark);
    color: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px 6px 14px;
    flex-shrink: 0;
    height: 20%;
    min-height: 42px;
}
.banner .brand {
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.1;
}
.banner .brand .brand-logo {
    height: 28px;
    object-fit: contain;
}
.banner .brand .sub {
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 1.5px;
    opacity: 0.9;
}
.banner .website {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.9;
    letter-spacing: 0.5px;
}

/* Strict measurement variables */
:root {
    --mm: 10px;
}
.certificate-card {
    width: calc(85 * var(--mm));
    height: calc(54 * var(--mm));
    background-color: #ffffff;
    position: relative;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    border-radius: calc(3 * var(--mm));
}
.card-header {
    width: 100%;
    height: calc(14 * var(--mm));
    background-color: #171d3d;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 calc(4 * var(--mm));
    box-sizing: border-box;
    color: #ffffff;
}
.header-logo {
    height: calc(8 * var(--mm));
}
.header-website {
    font-size: calc(1.6 * var(--mm));
}
.card-body {
    position: absolute;
    top: calc(14 * var(--mm));
    left: 0;
    width: 100%;
    height: calc(40 * var(--mm));
}
.product-image-wrapper {
    position: absolute;
    left: calc(5 * var(--mm));
    top: calc(3 * var(--mm));
    width: calc(19 * var(--mm));
}
.product-img {
    width: calc(19 * var(--mm));
    height: calc(19 * var(--mm));
    object-fit: cover;
    background-color: #f5f5f5;
    border-radius: calc(1 * var(--mm));
}
.product-caption {
    font-size: calc(1.0 * var(--mm));
    color: #888;
    text-align: center;
    margin-top: calc(0.5 * var(--mm));
    line-height: 1.1;
}
.qr-section {
    position: absolute;
    left: calc(5 * var(--mm));
    top: calc(27 * var(--mm));
    display: flex;
    align-items: center;
    gap: calc(1.5 * var(--mm));
}
.qr-code {
    width: calc(7 * var(--mm));
    height: calc(7 * var(--mm));
}
.qr-text-block {
    display: flex;
    flex-direction: column;
}
.qr-label {
    font-size: calc(0.9 * var(--mm));
    font-weight: bold;
    color: #a67c52;
}
.qr-value {
    font-size: calc(1.4 * var(--mm));
    font-weight: bold;
    color: #000;
    margin-bottom: calc(0.5 * var(--mm));
}
.details-section {
    position: absolute;
    left: calc(27 * var(--mm));
    top: calc(2.5 * var(--mm));
    width: calc(55 * var(--mm));
}
.cert-title {
    font-size: calc(2.8 * var(--mm));
    font-weight: 900;
    color: #171d3d;
    margin: 0;
    line-height: 1.2;
}
.cert-subtitle {
    font-size: calc(2.1 * var(--mm));
    color: #171d3d;
    margin: 0 0 calc(1.5 * var(--mm)) 0;
}
.specs-table {
    width: 100%;
    border-collapse: collapse;
}
.specs-table td {
    padding: calc(0.4 * var(--mm)) 0;
    font-size: calc(1.75 * var(--mm));
    vertical-align: top;
}
.specs-table td.spec-label {
    width: calc(20.5 * var(--mm));
    color: #555;
    text-transform: uppercase;
}
.specs-table td.spec-value {
    font-weight: bold;
    color: #000;
}
.stamp-section {
    position: absolute;
    right: calc(3 * var(--mm));
    bottom: calc(2 * var(--mm));
    width: calc(22 * var(--mm));
    height: calc(18 * var(--mm));
    display: flex;
    justify-content: center;
    align-items: flex-end;
}
.stamp-img {
    position: absolute;
    right: 0;
    bottom: 0;
    height: calc(16 * var(--mm));
    width: calc(16 * var(--mm));
    opacity: 0.25;
}
.signature-img {
    position: relative;
    width: calc(22 * var(--mm));
    height: auto;
    z-index: 2;
    margin-bottom: calc(1 * var(--mm));
}
.signature-name {
    position: absolute;
    bottom: 0;
    width: 100%;
    text-align: center;
    font-size: calc(1 * var(--mm));
    font-weight: bold;
    z-index: 2;
}
.signature-title {
    position: absolute;
    bottom: calc(-1 * var(--mm));
    width: 100%;
    text-align: center;
    font-size: calc(0.95 * var(--mm));
    color: #555;
}

/* Back card styles */
.back-card-content {
    padding: calc(3.5 * var(--mm));
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    color: #000;
    display: flex;
    flex-direction: column;
}
.back-title {
    text-align: center;
    font-size: calc(1.9 * var(--mm));
    font-weight: bold;
    margin: 0 0 calc(1.5 * var(--mm)) 0;
    line-height: 1.2;
}
.back-paragraph {
    font-size: calc(1.35 * var(--mm));
    line-height: 1.25;
    margin: 0 0 calc(1.2 * var(--mm)) 0;
}
.back-paragraph.gap-2-5 {
    margin-bottom: calc(2 * var(--mm));
}
.classification-title {
    font-size: calc(1.5 * var(--mm));
    font-weight: bold;
    margin: calc(0.5 * var(--mm)) 0 calc(0.8 * var(--mm)) 0;
}
.classification-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: calc(3 * var(--mm));
    row-gap: calc(0.3 * var(--mm));
}
.class-item {
    font-size: calc(1.2 * var(--mm));
    line-height: 1.2;
}
.class-item strong {
    font-weight: bold;
}

/* Download Button */
.download-btn {
    background: var(--color-secondary);
    color: var(--color-white);
    border: none;
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 40px;
    cursor: pointer;
    transition: background var(--transition-normal), transform var(--transition-fast);
    box-shadow: 0 4px 14px rgba(23, 53, 82, 0.25);
    letter-spacing: 0.5px;
}
.download-btn:hover {
    background: var(--color-dark);
    transform: translateY(-2px);
}
.download-btn:active {
    transform: scale(0.96);
}
.download-status {
    margin-top: 10px;
    font-size: 14px;
    color: var(--color-gray);
    min-height: 24px;
}

/* =========================================================
   RESPONSIVE MOBILE BEAUTIFICATION (max-width: 768px)
   ========================================================= */
@media (max-width: 768px) {
    body { padding-bottom: 80px !important; } /* Space for mobile bottom nav */

    /* Hero adjustments */
    .report-hero-banner {
        padding: 3.5rem 0;
        min-height: 380px;
    }
    .report-hero-banner h1 {
        font-size: 2.1rem;
        letter-spacing: 1px;
        margin-bottom: 0.8rem;
    }
    .report-hero-banner .hero-subtitle {
        font-size: 0.9rem;
        max-width: 100%;
        margin-bottom: 2rem;
        padding: 0 10px;
    }
    .report-hero-banner .report-search-form {
        max-width: 100%;
        border-radius: 8px;
    }
    .report-hero-banner .report-search-form input {
        padding: 0.85rem 1.2rem;
        font-size: 0.9rem;
    }
    .report-hero-banner .report-search-form button {
        padding: 0 1.5rem;
    }
    .report-hero-banner .report-search-form button svg {
        width: 18px;
        height: 18px;
    }

    /* Container */
    .report-page-wrapper .container {
        margin: 40px auto 30px auto;
        padding: 0 12px;
    }

    /* Certificate card */
    .report-certificate {
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }

    /* Header */
    .report-header {
        flex-direction: column;
        gap: 12px;
        padding: 20px;
        text-align: center;
    }
    .report-header .logo-area {
        flex-direction: column;
        gap: 8px;
    }
    .report-header .logo-area img {
        height: 40px;
    }
    .report-header .logo-area h1 {
        font-size: 1.4rem;
        letter-spacing: 0.5px;
    }
    .report-header .logo-area p {
        font-size: 0.6rem;
        letter-spacing: 0.8px;
    }
    .report-header .website-url {
        font-size: 0.8rem;
    }

    /* Body */
    .report-body {
        padding: 24px 20px 30px;
    }
    .product-title {
        font-size: 1.5rem;
        line-height: 1.2;
        margin-bottom: 4px;
        text-align: center;
    }
    .product-title-cn {
        font-size: 1.2rem;
        margin-bottom: 24px;
        text-align: center;
    }

    /* Details grid stack */
    .report-details-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .detail-row {
        padding: 12px 0;
    }
    .detail-label {
        width: 55%;
        font-size: 0.8rem;
        letter-spacing: 0.3px;
        text-transform: uppercase;
        color: #555;
    }
    .detail-value {
        width: 45%;
        font-size: 0.85rem;
        font-weight: 700;
        text-align: right;
    }

    /* Image */
    .report-image-wrapper {
        margin-bottom: 5px;
    }
    .report-image-wrapper img {
        max-width: 50%;
        max-height: 100px;
        padding: 10px;
        border-radius: 10px;
        background: #fff;
        margin: 0 auto;
        display: block;
    }
    .report-image-caption {
        font-size: 0.65rem;
        margin-top: 8px;
        color: #888;
    }

    /* Signature */
    .report-signature {
        justify-content: center;
        padding-left: 0;
        margin: 16px 0 0 0;
        display: flex;
        align-items: center;
        gap: 10px;
        background: #fff;
        border-radius: 8px;
        padding: 20px; /* Increased padding for better balance */
    }
    .report-sig-image {
        max-width: 240px; /* Changed from 130px */
        width: 100%;      /* Changed from 90px, lets it fill the box */
        height: auto;
        margin: 0 auto;
    }

    /* Divider & Disclaimer */
    .report-divider {
        margin: 20px 0;
    }
    .disclaimer-title {
        font-size: 0.85rem;
        line-height: 1.4;
        margin-bottom: 12px;
    }
    .disclaimer-content {
        font-size: 0.75rem;
        line-height: 1.65;
    }
    .disclaimer-content p {
        margin-bottom: 10px;
    }

    /* Classification */
    .classification-title {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }
    .classification-grid {
        grid-template-columns: 1fr;
        gap: 6px;
        font-size: 0.72rem;
        line-height: 1.4;
    }

    /* QR & Share */
    .qr-actions-wrapper {
        margin-top: 20px;
        padding-top: 20px;
        gap: 20px;
        border-top: 1px solid #e5e7eb;
    }
    .qr-code-img {
        width: 110px;
        height: 110px;
    }
    .qr-code-label {
        font-size: 0.65rem;
        margin-top: 5px;
    }
    .share-container {
        flex-direction: column;
        gap: 10px;
    }
    .share-label {
        font-size: 0.75rem;
        letter-spacing: 0.5px;
    }
    .share-buttons {
        gap: 12px;
    }
    .share-btn {
        width: 40px;
        height: 40px;
    }
    .share-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Adjust second certificate card for mobile */
    .card-container {
        max-width: 400px;
        aspect-ratio: 85 / 54; /* preserves proportions */
        border-radius: 10px;
    }
    .banner .brand .brand-logo { height: 22px; }
    .banner .brand .sub { font-size: 8px; }
    .banner .website { font-size: 10px; }

    /* If you want to scale the strict mm card down, you can adjust --mm */
    /* :root { --mm: 8px; } */
}

/* =========================================================
   ULTRA SMALL SCREENS (max-width: 480px)
   ========================================================= */
@media (max-width: 480px) {
    .report-hero-banner {
        padding: 2.5rem 0;
        min-height: 320px;
    }
    .report-hero-banner h1 {
        font-size: 1.7rem;
    }
    .report-hero-banner .hero-subtitle {
        font-size: 0.8rem;
        line-height: 1.5;
        margin-bottom: 1.5rem;
    }
    .report-body {
        padding: 18px 14px 24px;
    }
    .product-title {
        font-size: 1.3rem;
    }
    .product-title-cn {
        font-size: 1rem;
    }
    .detail-row {
        padding: 10px 0;
        display: flex;
        align-items: flex-start;
    }
    .detail-label {
        width: 58%;
        font-size: 0.72rem;
        padding-right: 8px;
        line-height: 1.3;
    }
    .detail-value {
        width: 42%;
        font-size: 0.75rem;
        text-align: right;
        line-height: 1.3;
        word-break: break-word;
    }
    .report-image-wrapper img {
        max-height: 220px;
        padding: 8px;
    }
    .report-signature {
        flex-direction: column;
        gap: 0;
        padding: 12px;
    }
    .report-sig-image {
        max-width: 180px; /* Changed from 100px */
        width: 100%;      /* Changed from 80px */
        height: auto;
    }
    .disclaimer-content {
        font-size: 0.7rem;
        line-height: 1.55;
    }
    .classification-grid {
        font-size: 0.68rem;
    }
    .qr-code-img {
        width: 100px;
        height: 100px;
    }

    /* Second certificate card scaling */
    .card-container {
        max-width: 340px;
    }
    .banner .brand .brand-logo { height: 18px; }
    .banner .brand .sub { font-size: 7px; }
    .banner .website { font-size: 8px; }
}

/* =========================================================
   PRINT STYLES
   ========================================================= */
@media print {
    .certificate-section {
        background: white;
        padding: 10px;
    }
    .card-container {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
        max-width: 100%;
    }
    .download-btn, .download-status {
        display: none;
    }
    .cards-row {
        gap: 20px;
    }
}