/* ========================================
   RESET
======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6fb;
    color: #123;
}

img {
    max-width: 100%;
    height: auto;
}



/* =========================
   NAVBAR
========================= */

.navbar {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 60px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Portal logo and title */

.logo {
    color: #111827;
    font-size: 24px;
    font-weight: 700;
    text-decoration: none;
}

.navbar .logo {
    display: inline-flex;
    align-items: center;
    gap: 16px;

    height: 70px;
    min-width: 0;

    color: #111827;
    font-size: 24px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

/* Larger logo without changing navbar height */

.navbar .portal-logo {
    display: block;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;

    object-fit: contain;

    transform: scale(1.35);
    transform-origin: center;
}

/* If navigation links are inside the navbar */

.navbar .nav-links {
    display: flex;
    align-items: center;
    gap: 45px;

    margin: 0;
    padding: 0;
    list-style: none;
}

.navbar .nav-links a {
    color: #26364a;
    font-size: 16px;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.navbar .nav-links a:hover,
.navbar .nav-links a.active {
    color: #247b55;
}

/* Tablet */

@media (max-width: 900px) {
    .navbar {
        padding: 0 20px;
    }

    .navbar .logo {
        gap: 10px;
        font-size: 19px;
    }

    .navbar .nav-links {
        gap: 16px;
    }
}

/* Mobile */

@media (max-width: 600px) {
    .navbar {
        height: auto;
        min-height: 70px;
        padding: 12px 16px;

        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .navbar .logo {
        height: auto;
        min-height: 46px;
        max-width: 100%;

        gap: 10px;
        font-size: clamp(15px, 4.5vw, 20px);
        white-space: normal;
        text-align: left;
    }

    .navbar .portal-logo {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
        transform: scale(1.2);
    }

    .navbar .nav-links {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px 12px;
    }

    .navbar .nav-links a {
        font-size: 13px;
    }
}


/* ========================================
   MAIN PAGE
======================================== */

.compare-page {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}


/* ========================================
   BACK LINK
======================================== */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    margin-bottom: 28px;
    padding: 10px 18px;

    background: transparent;
    color: #000000;
    border-radius: 8px;

    font-size: 14px;
    font-weight: 600;
    text-decoration: none;

    transition:
        background-color 0.25s ease,
        border-color 0.25s ease;
}


/* ========================================
   PAGE TITLE
======================================== */

.page-title {
    margin-bottom: 30px;
}

.page-title h1 {
    color: #164f3b;
    font-size: 34px;
    margin-bottom: 8px;
}

.page-title p {
    color: #6b7280;
    font-size: 16px;
}


/* ========================================
   CURRENT PROGRAM
======================================== */

.current-program {
    background: #ffffff;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;

    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.07);
}

.section-label {
    color: #247b55;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 18px;
}

.program-summary {
    display: flex;
    align-items: center;
    gap: 25px;
}

.program-logo {
    width: 90px;
    height: 90px;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.program-logo img {
    max-width: 90px;
    max-height: 90px;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.program-info {
    min-width: 0;
}

.program-info h2 {
    color: #164f3b;
    font-size: 25px;
    margin-bottom: 7px;
    overflow-wrap: anywhere;
}

.school-name {
    color: #6b7280;
    font-size: 15px;
    margin-bottom: 12px;
}

.tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tags span {
    background: #eaf7f0;
    color: #247b55;
    padding: 7px 13px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}


/* ========================================
   SCHOOL / PROGRAM SELECTION SECTION
======================================== */

.selection-section {
    background: #ffffff;
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 35px;

    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.07);
}

.selection-section h2 {
    color: #164f3b;
    font-size: 22px;
    margin-bottom: 7px;
}

.selection-section>p {
    color: #6b7280;
    margin-bottom: 20px;
}


/* ========================================
   COMPARISON FORM
======================================== */

.compare-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1.3fr;
    gap: 20px;
    align-items: end;
    margin-top: 24px;
}

.compare-form .form-group {
    min-width: 0;
    width: 100%;
}

.compare-form label {
    display: block;
    margin-bottom: 9px;
    font-weight: 600;
    font-size: 14px;
    color: #263b32;
}

.compare-form select {
    display: block;
    width: 100%;
    min-width: 0;
    height: 52px;
    padding: 0 14px;

    border: 1px solid #d5ded9;
    border-radius: 9px;

    background-color: #ffffff;
    color: #263b32;
    font-size: 15px;

    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.compare-form select:focus {
    border-color: #21845a;
    box-shadow: 0 0 0 3px rgba(33, 132, 90, 0.12);
}

.compare-form button,
.compare-form input[type="submit"] {
    min-height: 48px;
    padding: 12px 26px;

    border: none;
    border-radius: 9px;

    background: #21845a;
    color: #ffffff;

    font-size: 15px;
    font-weight: 600;
    cursor: pointer;

    transition: background 0.2s;
}

.compare-form button:hover,
.compare-form input[type="submit"]:hover {
    background: #176b46;
}


/* ========================================
   INDIVIDUAL COMPARISON FIELDS
======================================== */

.compare-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.compare-field label {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.compare-field select {
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 0 15px;

    border: 1px solid #d7dce2;
    border-radius: 7px;

    background: #ffffff;
    color: #26364a;
    font-size: 15px;

    outline: none;
    cursor: pointer;
}

.compare-field select:focus {
    border-color: #247b55;
    box-shadow: 0 0 0 3px rgba(36, 123, 85, 0.08);
}

.compare-field select:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}


/* ========================================
   COMPARE BUTTON
======================================== */

.compare-submit {
    min-height: 48px;
    border: none;

    background: #247b55;
    color: #ffffff;

    padding: 0 25px;
    border-radius: 7px;

    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.compare-submit:hover {
    background: #1d6848;
}


/* ========================================
   COMPARISON SECTION
======================================== */

.comparison-section>h2 {
    color: #164f3b;
    font-size: 25px;
    margin-bottom: 20px;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 25px;
    align-items: start;
}

.comparison-card {
    min-width: 0;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;

    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.07);
    padding-bottom: 25px;
}


/* ========================================
   COMPARISON HEADERS
======================================== */

.comparison-header {
    background: #eaf7f0;
    color: #247b55;

    padding: 14px 20px;

    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
}

.comparison-header.other {
    background: #eef2f7;
    color: #40546a;
}


/* ========================================
   COMPARISON LOGOS
======================================== */

.comparison-logo {
    min-height: 120px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px 10px 0;
}

.comparison-logo img {
    max-width: 95px;
    max-height: 95px;
    object-fit: contain;
}


/* ========================================
   COMPARISON HEADING / DOWNLOAD
======================================== */

.comparison-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.comparison-heading h2 {
    margin: 0;
}

.download-btn {
    background: #1b6b45;
    color: #ffffff;
    border: none;

    padding: 12px 22px;
    border-radius: 10px;

    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
}

.download-btn:hover {
    background: #14532f;
}


/* ========================================
   PROGRAM TITLE AND SCHOOL NAME
======================================== */

.comparison-card>h3 {
    text-align: center;
    color: #164f3b;

    font-size: 21px;
    line-height: 1.35;

    padding: 0 20px;
    margin-top: 10px;

    overflow-wrap: anywhere;
}

.comparison-card .school {
    text-align: center;
    color: #6b7280;

    font-size: 14px;
    padding: 0 20px;
    margin-top: 8px;

    overflow-wrap: anywhere;
}


/* ========================================
   COMPARISON DETAILS
======================================== */

.comparison-details {
    min-width: 0;
    margin: 25px 20px 0;
    border-top: 1px solid #e5e7eb;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;

    padding: 15px 0;
    border-bottom: 1px solid #e5e7eb;

    font-size: 14px;
}

.detail-row>* {
    min-width: 0;
}

.detail-row span {
    color: #6b7280;
}

.detail-row strong {
    color: #26364a;
    text-align: right;
    max-width: 60%;
    overflow-wrap: anywhere;
}


/* ========================================
   PROSPECTUS / SUBJECTS
======================================== */

.card-prospectus {
    margin: 25px 20px 0;
    padding-top: 25px;
    border-top: 2px solid #e5e7eb;
}

.card-prospectus-title {
    margin-bottom: 20px;
}

.card-prospectus-title h3 {
    color: #145a42;
    font-size: 20px;
    text-align: left;

    padding: 0;
    margin: 0 0 6px;
}

.card-prospectus-title p {
    color: #64748b;
    font-size: 13px;
    margin: 0;
}


/* ========================================
   YEAR SECTION
======================================== */

.year-section {
    padding: 18px 0;
    border-bottom: 1px solid #edf0f2;
    min-width: 0;
}

.year-section:last-child {
    border-bottom: none;
}

.year-section h4 {
    color: #145a42;
    font-size: 17px;
    margin-bottom: 14px;
    padding-bottom: 8px;

    border-bottom: 2px solid #e4eee9;
}


/* ========================================
   SEMESTER SECTION
======================================== */

.semester-section {
    min-width: 0;
    margin-bottom: 18px;
}

.semester-section:last-child {
    margin-bottom: 0;
}

.semester-title {
    background: #f4f8f6;
    color: #176347;

    padding: 9px 12px;

    font-size: 13px;
    font-weight: 700;

    border-radius: 6px 6px 0 0;
    border: 1px solid #e2ebe6;
    border-bottom: none;
}


/* ========================================
   SUBJECT TABLE
======================================== */

.subject-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.subject-table {
    width: 100%;
    border-collapse: collapse;

    font-size: 13px;
    table-layout: auto;
}

.subject-table th {
    background: #f8fafc;
    color: #475569;

    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;

    padding: 10px 8px;
    text-align: left;

    border: 1px solid #e5e7eb;
}

.subject-table td {
    padding: 10px 8px;
    border: 1px solid #e5e7eb;

    color: #334155;
    vertical-align: top;
    line-height: 1.4;
}

.subject-table th:first-child,
.subject-table td:first-child {
    width: 85px;
}

.subject-table th:last-child,
.subject-table td:last-child {
    width: 55px;
    text-align: center;
}

.subject-table tfoot td {
    background: #f8fafc;
    font-weight: 700;
    color: #145a42;
}

.no-subjects {
    padding: 30px 10px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}


/* ========================================
   DOWNLOAD COMPARISON BUTTON
======================================== */

.download-comparison-container {
    display: flex;
    justify-content: center;
    align-items: center;

    width: 100%;
    margin: 30px 0;
}

.download-comparison-btn {
    display: inline-block;

    padding: 13px 24px;

    background: #176b48;
    color: #ffffff;
    border: none;
    border-radius: 8px;

    font-size: 15px;
    font-weight: 600;
    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.download-comparison-btn:hover {
    background: #105438;
    transform: translateY(-2px);
}


/* ========================================
   TABLET RESPONSIVENESS
======================================== */

@media screen and (max-width: 900px) {
    .nav-container {
        padding: 0 15px;
        gap: 12px;
    }

    .nav-container .logo {
        gap: 8px;
        font-size: 19px;
    }

    .nav-links {
        gap: 16px;
    }

    .nav-links a {
        font-size: 14px;
    }

    .comparison-grid {
        grid-template-columns: 1fr;
    }

    .compare-form {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}


/* ========================================
   MOBILE NAVBAR
======================================== */

@media screen and (max-width: 600px) {
    .navbar {
        height: auto;
    }

    .nav-container {
        height: auto;
        min-height: 70px;

        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;

        padding: 12px 16px;
    }

    .nav-container .logo {
        max-width: 100%;
        flex-shrink: 1;

        justify-content: center;
        gap: 10px;

        font-size: clamp(15px, 4.5vw, 20px);
        white-space: normal;
        text-align: center;
    }

    .nav-container .portal-logo {
        width: 40px;
        height: 40px;
        flex-basis: 40px;

        transform: scale(1.2);
    }

    .nav-links {
        width: 100%;

        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px 12px;
    }

    .nav-links a {
        font-size: 13px;
    }

    .compare-page {
        padding: 25px 15px 60px;
    }

    .page-title h1 {
        font-size: 25px;
    }

    .program-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .current-program,
    .selection-section {
        padding: 20px;
    }

    .comparison-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .comparison-card,
    .comparison-details {
        min-width: 0;
    }

    .comparison-card {
        border-radius: 8px;
    }

    .comparison-details {
        margin-left: 15px;
        margin-right: 15px;
    }

    .card-prospectus {
        margin-left: 15px;
        margin-right: 15px;
    }

    .subject-table {
        font-size: 12px;
    }

    .subject-table th,
    .subject-table td {
        padding: 8px 6px;
    }

    .detail-row {
        flex-direction: column;
        gap: 5px;
    }

    .detail-row strong {
        max-width: 100%;
        text-align: left;
    }

    .compare-submit {
        width: 100%;
    }

    .download-comparison-container {
        padding: 0 10px;
    }

    .download-comparison-btn {
        width: 100%;
        max-width: 360px;
        padding: 14px 18px;
    }
}


/* ========================================
   VERY SMALL MOBILE SCREENS
======================================== */

@media screen and (max-width: 360px) {
    .compare-page {
        padding-right: 12px;
        padding-left: 12px;
    }

    .current-program,
    .selection-section {
        padding: 16px;
    }

    .nav-container {
        padding-right: 12px;
        padding-left: 12px;
    }

    .nav-container .logo {
        font-size: 15px;
    }
}


/* ========================================
   PRINT / PDF PAGE SETTINGS
======================================== */

@page {
    size: A4 landscape;
    margin: 8mm;
}


/* ========================================
   PRINT / PDF LAYOUT
======================================== */

@media print {

    html,
    body {
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;

        background: #ffffff !important;
        color: #123 !important;
        overflow: visible !important;

        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Hide page controls */

    .navbar,
    .back-link,
    .page-title,
    .current-program,
    .selection-section,
    .download-btn,
    .download-comparison-container,
    .download-comparison-btn {
        display: none !important;
    }

    /* Remove normal page restrictions */

    .compare-page {
        width: 100% !important;
        max-width: none !important;

        margin: 0 !important;
        padding: 0 !important;

        overflow: visible !important;
    }

    .comparison-section {
        display: block !important;
        width: 100% !important;

        margin: 0 !important;
        padding: 0 !important;
    }

    .comparison-section>h2 {
        display: block !important;

        margin: 0 0 10px !important;

        font-size: 16pt !important;
        color: #164f3b !important;
    }

    /* Keep programs side by side */

    .comparison-grid {
        display: grid !important;

        grid-template-columns:
            minmax(0, 1fr) minmax(0, 1fr) !important;

        gap: 6mm !important;
        align-items: start !important;

        width: 100% !important;
        overflow: visible !important;
    }

    .comparison-card {
        display: block !important;

        width: 100% !important;
        min-width: 0 !important;
        height: auto !important;

        margin: 0 !important;
        padding-bottom: 4mm !important;

        overflow: visible !important;

        border: 1px solid #dddddd !important;
        border-radius: 0 !important;
        box-shadow: none !important;

        background: #ffffff !important;

        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    /* Program information */

    .comparison-header {
        padding: 8px 10px !important;
        font-size: 9pt !important;
    }

    .comparison-logo {
        height: auto !important;
        min-height: 50px !important;
        padding: 8px !important;
    }

    .comparison-logo img {
        max-width: 60px !important;
        max-height: 60px !important;
        object-fit: contain !important;
    }

    .comparison-card>h3 {
        padding: 0 8px !important;
        margin-top: 5px !important;

        font-size: 12pt !important;
        overflow-wrap: anywhere !important;
    }

    .comparison-card .school {
        padding: 0 8px !important;
        font-size: 9pt !important;
        overflow-wrap: anywhere !important;
    }

    .comparison-details {
        margin: 10px 8px 0 !important;
    }

    .detail-row {
        gap: 8px !important;
        padding: 7px 0 !important;
        font-size: 9pt !important;

        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .detail-row strong {
        max-width: 65% !important;
        overflow-wrap: anywhere !important;
    }

    /* Prospectus content */

    .card-prospectus {
        margin: 12px 8px 0 !important;
        padding-top: 12px !important;
        overflow: visible !important;
    }

    .card-prospectus-title {
        margin-bottom: 10px !important;
    }

    .card-prospectus-title h3 {
        font-size: 12pt !important;
    }

    .card-prospectus-title p {
        font-size: 9pt !important;
    }

    .year-section {
        padding: 10px 0 !important;
        overflow: visible !important;

        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .year-section h4 {
        font-size: 11pt !important;
        margin-bottom: 8px !important;

        break-after: avoid !important;
        page-break-after: avoid !important;
    }

    .semester-section {
        margin-bottom: 10px !important;
        overflow: visible !important;

        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .semester-title {
        padding: 6px 7px !important;
        font-size: 9pt !important;

        break-after: avoid !important;
        page-break-after: avoid !important;
    }

    /* Prevent horizontal clipping */

    .subject-table-wrapper {
        display: block !important;

        width: 100% !important;
        max-width: 100% !important;

        overflow: visible !important;
    }

    .subject-table {
        width: 100% !important;
        max-width: 100% !important;

        border-collapse: collapse !important;
        table-layout: fixed !important;

        font-size: 8pt !important;
    }

    .subject-table th,
    .subject-table td {
        padding: 5px 4px !important;
        font-size: 8pt !important;
        line-height: 1.25 !important;

        white-space: normal !important;
        overflow-wrap: anywhere !important;
        word-break: normal !important;

        border: 1px solid #dddddd !important;
        vertical-align: top !important;
    }

    .subject-table th:first-child,
    .subject-table td:first-child {
        width: 22% !important;
    }

    .subject-table th:last-child,
    .subject-table td:last-child {
        width: 14% !important;
        text-align: center !important;
    }

    .subject-table tfoot {
        display: table-row-group !important;
    }

    .subject-table tr {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .subject-table thead {
        display: table-header-group !important;
    }

    .subject-table tfoot td {
        font-weight: 700 !important;
    }

    .no-subjects {
        padding: 10px !important;
        font-size: 9pt !important;
    }
}


/* ========================================
   CONTENT OVERFLOW PROTECTION
======================================== */

.comparison-card,
.comparison-details,
.detail-row>*,
.program-info,
.year-section,
.semester-section {
    min-width: 0;
}

.program-info h2,
.detail-row,
.subject-table th,
.subject-table td {
    overflow-wrap: anywhere;
}

.footer-copyright {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    padding: 18px clamp(20px, 5vw, 96px);
    color: #d0d0d0;
    background: #202020;
    font-size: 14px;
    line-height: 1.5;
}

.footer-copyright p {
    margin: 0;
}

.footer-copyright .developer-credit {
    margin: 0;
    text-align: right;
}