/* Google Style Theme - TrainerD Profile Builder */
/* Material-inspired, clean professional design modelled on Google's visual language */

@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,400&family=Roboto+Mono:wght@400;500&family=Lexend+Deca:wght@300;400;500;600;700&display=swap');

/* ===================================================================
   A4 PAPER WRAPPER
   =================================================================== */

.a4-paper {
    background-image: url('./bg-preview-top.png');
    background-size: contain;
    background-position: top center;
    background-repeat: no-repeat;
    box-sizing: border-box;
    margin: auto;
    width: 210mm;
    min-height: 297mm;
}

.a4-paper .paper-margin {
    padding: 20mm 20mm 20mm 20mm;
}

/* ===================================================================
   THEME VARIABLES — Google palette
   =================================================================== */

#trainer-profile {
    --google-blue:   #4285F4;
    --google-red:    #EA4335;
    --google-yellow: #FBBC05;
    --google-green:  #34A853;

    --primary-color:   #4285F4;
    --secondary-color: #5F6368;
    --text-dark:       #202124;
    --text-muted:      #5F6368;
    --bg-blue-light:   #E8F0FE;
    --bg-stripe:       #F8F9FA;
    --border-color:    #E8EAED;
    --font-family:     'Roboto', Arial, sans-serif;
    --font-heading:    'Lexend Deca', 'Roboto', Arial, sans-serif;
    --font-mono:       'Roboto Mono', 'Courier New', monospace;
}

/* ===================================================================
   BASE STYLES
   =================================================================== */

#trainer-profile * {
    box-sizing: border-box;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

#trainer-profile {
    position: relative;
    font-family: var(--font-family);
    min-height: 297mm;
    color: var(--text-dark);
    font-size: 11pt;
    line-height: 1.6;
}

#trainer-profile section {
    margin-bottom: 9mm;
    break-inside: avoid;
}

/* ===================================================================
   SECTION HEADINGS — Google Blue left-bar rule
   =================================================================== */

#trainer-profile h2 {
    font-family: var(--font-heading);
    font-size: 14pt;
    font-weight: 700;
    margin-top: 2mm;
    margin-bottom: 4mm;
    page-break-after: avoid;
    letter-spacing: 0.3pt;
    padding-bottom: 2mm;
    padding-left: 3.5mm;
    text-transform: none;
    margin-left: -5mm;
    line-height: 1em;
}

#trainer-profile section:nth-of-type(4n+1) h2 {
    color: var(--google-blue);
    border-left: 7.5mm solid var(--google-blue);
    border-bottom: 0.3mm solid var(--google-blue);
}

#trainer-profile section:nth-of-type(4n+2) h2 {
    color: var(--google-red);
    border-left: 7.5mm solid var(--google-red);
    border-bottom: 0.3mm solid var(--google-red);
}

#trainer-profile section:nth-of-type(4n+3) h2 {
    color: var(--google-green);
    border-left: 7.5mm solid var(--google-green);
    border-bottom: 0.3mm solid var(--google-green);
}

#trainer-profile section:nth-of-type(4n+4) h2 {
    color: var(--google-yellow);
    border-left: 7.5mm solid var(--google-yellow);
    border-bottom: 0.3mm solid var(--google-yellow);
}


/* ===================================================================
   TRAINER DETAILS SECTION
   =================================================================== */

#trainer-profile section#trainer-details {
    position: relative;
}

#trainer-profile section#trainer-details > div > h2 {
    margin-top: 10mm;
    color: var(--google-green);
    border-left: 7.5mm solid var(--google-green);
    border-bottom: 0.3mm solid var(--google-green);    
}


#trainer-profile section#trainer-details header {
    position: relative;
    margin-bottom: 7mm;
    min-height: 60mm;
}

/* Profile photo — clean, slightly rounded */
#trainer-profile section#trainer-details header img {
    position: absolute;
    left: 0;
    top: 0;
    width: 50mm;
    height: 60mm;
    object-fit: cover;
    object-position: top center;
    border: 2mm solid #fff;
}

/* "TRAINER PROFILE" label in Google Blue */
#trainer-profile section#trainer-details header h1::before {
    content: 'TRAINER PROFILE';
    display: block;
    color: var(--bg-stripe);
    font-family: var(--font-mono);
    font-size: 7pt;
    font-weight: 500;
    letter-spacing: 2pt;
    margin-bottom: 3mm;
}

/* Trainer name — Lexend Deca, substantial */
#trainer-profile section#trainer-details header h1 {
    font-family: var(--font-heading);
    font-size: 22pt;
    font-weight: 700;
    color: #fff;
    margin-left: 55mm;
    margin-bottom: 2mm;
    line-height: 1.15;
    letter-spacing: -0.3pt;
    padding-top: 5mm;
}

/* Specialty pill badges — Google Blue outline with blue text */
#trainer-profile section#trainer-details header ul {
    list-style: none;
    padding: 0;
    margin: 2mm 0 2mm 55mm;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5mm;
}

#trainer-profile section#trainer-details header ul li {
    background-color: var(--bg-blue-light);
    color: var(--google-blue);
    font-size: 7.5pt;
    font-weight: 500;
    letter-spacing: 0.3pt;
    padding: 0.8mm 3mm;
    border-radius: 10mm;
    border: 0.3mm solid #C5D8FD;
    margin: 0;
}

/* For public profile at /profile/{slug} */
#public-profile #trainer-profile section#trainer-details header > div:nth-child(3) {
    margin-left: -5mm;
    margin-right: -5mm;
    padding-top: 3mm;
    margin-top: 3mm;
    border-top: 0.3mm solid var(--border-color);
    overflow: hidden;
}

#trainer-profile section#trainer-details header .specialty {
    color: var(--text-muted);
    font-size: 10pt;
    font-weight: 400;
}

#trainer-profile section#trainer-details > h2:first-of-type {
    margin-top: 6mm;
}

/* ===================================================================
   TABLES — Material style
   =================================================================== */

#trainer-profile table {
    box-sizing: border-box;
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
    padding: 0;
    margin: 0 0 5mm 0;
}

/* Table headers — Google Blue light background */
#trainer-profile table th {
    background-color: var(--bg-blue-light);
    border: none;
    border-bottom: 0.4mm solid var(--google-blue);
    color: var(--google-blue);
    font-weight: 500;
    font-size: 8pt;
    letter-spacing: 0.3pt;
    padding: 2.5mm 4mm;
    line-height: 1.2em;
    text-align: left;
    vertical-align: bottom;
}

#trainer-profile table td {
    background: none;
    border: none;
    border-bottom: 0.3mm solid var(--border-color);
    font-size: 10pt;
    padding: 2.2mm 4mm;
    vertical-align: top;
    color: var(--text-dark);
}

#trainer-profile table tr:nth-of-type(even) td {
    background-color: var(--bg-stripe);
}

/* ===================================================================
   KEY-VALUE TABLES (Current Position)
   =================================================================== */

#trainer-profile section#current-position table td:first-child {
    font-weight: 500;
    color: var(--text-muted);
    width: 30%;
    font-size: 9.5pt;
}

/* ===================================================================
   TRAINER DETAILS TABLE
   =================================================================== */

#trainer-profile section#trainer-details table {
    border-collapse: collapse;
    border-spacing: 0;
    margin: 0 0 5mm 0;
}

#trainer-profile section#trainer-details table td {
    background: none;
    border: none;
    border-bottom: 0.3mm solid var(--border-color);
    color: var(--text-dark);
    font-size: 10pt;
    padding: 2.2mm 4mm;
    vertical-align: top;
}

#trainer-profile section#trainer-details table td:first-child {
    font-weight: 500;
    color: var(--text-muted);
    width: 30%;
    font-size: 9.5pt;
}

#trainer-profile section#trainer-details table tr:nth-of-type(even) td {
    background-color: var(--bg-stripe);
}

/* ===================================================================
   PUBLICATIONS
   =================================================================== */

.a4-paper #trainer-profile section#publications table td.cover-cell {
    background-color: white !important;
    padding: 0;
    text-align: center;
}

#trainer-profile section#publications table td.cover-cell img {
    max-width: 50mm;
    max-height: 75mm;
    object-fit: cover;
    border: 0.2mm solid var(--border-color);
    margin-top: 3mm;
    margin-right: 5mm;
    border-radius: 2px;
}

#trainer-profile section#publications table td.label-cell {
    font-weight: 500;
    padding: 2.5mm 4mm;
    font-size: 9.5pt;
    line-height: 1.2em;
    text-align: left;
    width: 20%;
    color: var(--text-muted);
    border-bottom: 0.3mm solid var(--border-color);
}

#trainer-profile section#publications table td.data-cell {
    font-size: 10pt;
    padding: 2.2mm 4mm;
    vertical-align: top;
    font-weight: 400;
    border-bottom: 0.3mm solid var(--border-color);
}

/* ===================================================================
   COLUMN WIDTHS
   =================================================================== */

#trainer-profile section#academic table td:nth-child(3),
#trainer-profile section#professional table td:nth-child(3),
#trainer-profile section#academic table th:nth-child(3),
#trainer-profile section#professional table th:nth-child(3) {
    width: 25mm;
}

#trainer-profile section#previous-companies table td:nth-child(3),
#trainer-profile section#previous-companies table td:nth-child(4),
#trainer-profile section#previous-companies table th:nth-child(3),
#trainer-profile section#previous-companies table th:nth-child(4) {
    width: 18mm;
}

#trainer-profile section#training-programmes table td:nth-child(3),
#trainer-profile section#training-programmes table td:nth-child(4),
#trainer-profile section#training-programmes table th:nth-child(3),
#trainer-profile section#training-programmes table th:nth-child(4) {
    width: 18mm;
}

#trainer-profile section#training-programmes table td:nth-child(1),
#trainer-profile section#training-programmes table th:nth-child(1),
#trainer-profile section#previous-companies table td:nth-child(1),
#trainer-profile section#previous-companies table th:nth-child(1) {
    width: 10mm;
}

#trainer-profile section#previous-companies table tr:nth-of-type(even) td,
#trainer-profile section#training-programmes table tr:nth-of-type(even) td {
    background-color: var(--bg-stripe);
}

/* ===================================================================
   CERTIFICATES
   =================================================================== */

.certificates-container {
    text-align: center;
}

.certificate-block {
    display: inline-block;
    vertical-align: bottom;
    text-align: left;
    margin: 0 1.5mm 5mm 1.5mm;
    page-break-inside: avoid;
    line-height: normal;
}

.certificate-block.orientation-portrait {
    width: 45%;
    max-width: 90mm;
}

.certificate-block.orientation-landscape {
    width: 70%;
    max-width: 140mm;
}

.certificate-block .certificate-image {
    margin-bottom: 2mm;
}

.certificate-block .certificate-img {
    width: 100%;
    height: auto;
    display: block;
    border: 0.3mm solid var(--border-color);
    border-radius: 2px;
}

.certificate-block .certificate-title {
    font-size: 9.5pt;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0;
    width: 100%;
    text-align: left;
    box-sizing: border-box;
}

/* ===================================================================
   ACKNOWLEDGEMENT LETTERS
   =================================================================== */

.acknowledgement-letters-container {
    text-align: center;
}

.acknowledgement-letter-block {
    display: inline-block;
    vertical-align: bottom;
    text-align: left;
    margin: 0 1.5mm 8mm 1.5mm;
    page-break-inside: avoid;
    line-height: normal;
}

.acknowledgement-letter-block.orientation-portrait {
    width: 45%;
    max-width: 90mm;
}

.acknowledgement-letter-block.orientation-landscape {
    width: 80%;
    max-width: 175mm;
}

.acknowledgement-letter-block .acknowledgement-letter-image {
    margin-bottom: 2mm;
}

.acknowledgement-letter-block .acknowledgement-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
}

.acknowledgement-letter-block .letter-title {
    font-size: 9.5pt;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0;
    width: 100%;
    text-align: left;
    box-sizing: border-box;
}

/* ===================================================================
   GALLERY
   =================================================================== */

#trainer-profile .gallery-container {
    margin: 5mm 0 15mm 0;
}

/* ===================================================================
   PARAGRAPH SPACING
   =================================================================== */

#trainer-profile p {
    margin-bottom: 3mm;
    text-align: justify;
    color: var(--text-dark);
    font-family: --var( --font-family);
}

/* ===================================================================
   PRINT OPTIMIZATIONS
   =================================================================== */

@media print {

    @page {
        size: A4;
        padding: 0mm;
        margin: 0px;
        background-repeat: repeat-y;
        background-size: 100% auto;
        background-position: 0mm 0;
        background-image: url('./bg-print-page.png');        
        padding: 20mm 0 20mm 0;
        margin: 0;
    }

    @page :first {
        padding-top: 0mm;
        margin: 0mm;
        background-repeat: no-repeat;
        background-size: 100% auto;
        background-position: 0mm 0;
        background-image: url('./bg-print-first.png');                
    }

    #trainer-profile section#trainer-details header {
        margin-top: -8mm;
    }

    .a4-paper {
        margin: 0;
        padding: 0;
    }

    .paper-margin {
        margin: 0;
        padding: 0 20mm 0 20mm;
    }

    #trainer-profile {
        margin: 0;
        padding: 0;
        page-break-inside: avoid;
    }

    #trainer-profile section {
        page-break-inside: avoid;
        margin-top: 8mm;
        margin-bottom: 8mm;
    }

    #trainer-profile .gallery-container {
        width: 180mm;
        padding: 0;
        margin: auto;
        margin-left: 0;
    }

    #trainer-profile .gallery-container .gallery-img {
        margin-bottom: 1mm;
    }

    #trainer-profile .gallery-container .orientation-portrait {
        width: 24%;
    }

    #trainer-profile .gallery-container .orientation-landscape {
        width: 48.3%;
    }
}
