/* Aurora Theme - TrainerD Profile Builder */
/* Fluent Design-inspired, clean professional look with Microsoft's blue-purple gradient language */

@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,wght@0,300;0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600;700&family=Fira+Code:wght@400;500&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 — Microsoft Fluent palette
   =================================================================== */

#trainer-profile {
    --ms-blue:         #0078D4;
    --ms-purple:       #5C2D91;
    --ms-cyan:         #00B4D8;
    --ms-teal:         #038387;

    --primary-color:   #0078D4;
    --secondary-color: #605E5C;
    --text-dark:       #201F1E;
    --text-muted:      #605E5C;
    --bg-purple-light: #F0EBF8;
    --bg-blue-light:   #EFF6FC;
    --bg-stripe:       #FAF9F8;
    --border-color:    #EDEBE9;
    --font-family:     'Inter', 'Segoe UI', Arial, sans-serif;
    --font-heading:    'Nunito Sans', 'Segoe UI', Arial, sans-serif;
    --font-mono:       'Fira Code', 'Cascadia Code', 'Consolas', 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 — Microsoft Blue/Purple left-bar, alternating
   =================================================================== */

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

#trainer-profile section:nth-of-type(odd) h2 {
    color: var(--ms-blue);
    border-left: 5.5mm solid var(--ms-blue);
    border-bottom: 0.3mm solid var(--ms-blue);
}

#trainer-profile section:nth-of-type(even) h2 {
    color: var(--ms-purple);
    border-left: 5.5mm solid var(--ms-purple);
    border-bottom: 0.3mm solid var(--ms-purple);
}

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

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

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

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

/* Profile photo */
#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 */
#trainer-profile section#trainer-details header h1::before {
    content: 'TRAINER PROFILE';
    display: block;
    color: rgba(255, 255, 255, 0.75);
    font-family: var(--font-mono);
    font-size: 7pt;
    font-weight: 500;
    letter-spacing: 2pt;
    margin-bottom: 3mm;
}

/* Trainer name — Nunito Sans, bold */
#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 — purple outline */
#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-purple-light);
    color: var(--ms-purple);
    font-size: 7.5pt;
    font-weight: 600;
    letter-spacing: 0.3pt;
    padding: 0.8mm 3mm;
    border-radius: 2mm;
    border: 0.3mm solid #C9A8E0;
    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 — Fluent 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 — blue-purple gradient background */
#trainer-profile table th {
    background: linear-gradient(90deg, var(--bg-blue-light) 0%, var(--bg-purple-light) 100%);
    border: none;
    border-bottom: 0.4mm solid var(--ms-blue);
    color: var(--ms-blue);
    font-weight: 600;
    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: 600;
    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: 600;
    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: 600;
    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: 600;
    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: 600;
    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-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-page-first.png');
    }

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

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

    .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%;
    }
}
