/*  CSP-1870 - Tender details page, version 3.
    Only loaded when tenders.feature.common.tender.details.version is 3, so the legacy
    tenderDetails.jsp keeps its existing appearance untouched.

    Colours reuse the --primary-blue name already established by buy/theme.css and
    accountSettings.css rather than introducing another per-page palette. The fallbacks
    keep the page correct on tenants that do not load a theme. */

/*  ct.css puts a fixed photograph behind every page, which the legacy details page covered
    with a .white-container card. The V3 design is a flat white page instead, so the photo is
    switched off here the same way accountSettings.css and opportunitySearchResultsV3.css do.
    This stylesheet is only loaded by tenderDetailsV3.jsp, so the override reaches no one else. */
body {
    background-image: none;
    background-color: #FFF;
}

.tenderDetailsV3 {
    --td-blue-dark: #007EC3;
    --td-blue: var(--primary-blue, #19ACEE);
    --td-hero-bg: #CCEEFB;
    --td-pale-blue: #F1FBFF;
    --td-ink: #191919;
    --td-body: #414042;
    --td-muted: #6B7280;
    --td-border: #DEE2E6;
    --td-radius: 12px;
    --td-radius-sm: 6px;

    color: var(--td-body);
}

.tenderDetailsV3 .tenderHero {
    background: var(--td-hero-bg);
    padding: 32px 0 40px;
    margin-bottom: 40px;
}

/*  Matches #headerV3 .ctnav-container so the status pill and title line up with the logo
    in the nav directly above. Keep the two in step if the nav's container changes. */
.tenderDetailsV3 .tenderHeroInner,
.tenderDetailsV3 .tenderBody {
    max-width: 1440px;
    margin: 0 auto;
    padding-inline: 32px;
}

.tenderDetailsV3 .tenderHeroTop {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.tenderDetailsV3 .tenderStatus {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.4;
}

.tenderDetailsV3 .tenderStatus.open {
    background: #CDF1CC;
    color: #10730E;
}

.tenderDetailsV3 .tenderStatus.closed {
    background: #F5D3D3;
    color: #9B1C1C;
}

.tenderDetailsV3 .tenderHeroActions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/*  Share and bookmark are icon only, so each sits in a round button big enough to tap, matching the
    hero buttons' white surface and blue hover. */
.tenderDetailsV3 .tenderHeroActions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    line-height: 1;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 126, 195, 0.25);
    color: var(--td-body);
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.tenderDetailsV3 .tenderHeroActions .btn i {
    font-size: 1rem;
}

.tenderDetailsV3 .tenderHeroActions .btn:hover,
.tenderDetailsV3 .tenderHeroActions .btn:focus-visible {
    background: #FFF;
    border-color: var(--td-blue-dark);
    color: var(--td-blue-dark);
}

.tenderDetailsV3 .tenderHeroMain {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-top: 12px;
}

.tenderDetailsV3 .tenderTitle {
    color: var(--td-blue-dark);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    max-width: 46ch;
}

.tenderDetailsV3 .tenderBuyer {
    color: var(--td-body);
    font-size: 1rem;
    margin: 8px 0 0;
}

.tenderDetailsV3 .tenderHeroButtons {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

/*  style.css sizes bare buttons globally, so height and line-height are reset here to
    stop the hero buttons inheriting the legacy control metrics. */
.tenderDetailsV3 .tenderHeroButtons .btn {
    height: auto;
    line-height: 1.5;
    padding: 10px 32px;
    border-radius: var(--td-radius-sm);
    font-weight: 600;
    white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.tenderDetailsV3 .btn-tender-primary {
    background: var(--td-blue-dark);
    border: 1px solid var(--td-blue-dark);
    color: #FFF;
}

.tenderDetailsV3 .btn-tender-primary:hover:not(:disabled) {
    background: #006BA6;
    border-color: #006BA6;
    color: #FFF;
}

.tenderDetailsV3 .btn-tender-secondary {
    background: #FFF;
    border: 1px solid var(--td-blue-dark);
    color: var(--td-blue-dark);
}

.tenderDetailsV3 .btn-tender-secondary:hover:not(:disabled) {
    background: var(--td-pale-blue);
    color: var(--td-blue-dark);
}

.tenderDetailsV3 .tenderHeroButtons .btn:disabled {
    opacity: 0.5;
}

.tenderDetailsV3 .tenderHeroLogo {
    max-height: 64px;
    width: auto;
}

/* ---- body layout ---- */

.tenderDetailsV3 .tenderBody {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 48px;
    align-items: start;
    padding-bottom: 56px;
}

.tenderDetailsV3 .tenderSection {
    margin-bottom: 32px;
}

.tenderDetailsV3 .tenderSection h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--td-ink);
    margin: 0 0 12px;
}

.tenderDetailsV3 .tenderDescription {
    font-size: 0.9375rem;
    line-height: 1.7;
    word-break: break-word;
}

.tenderDetailsV3 .tenderDescription p:last-child {
    margin-bottom: 0;
}

/* ---- categories ---- */

.tenderDetailsV3 .categoryPills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.tenderDetailsV3 .categoryPill {
    background: var(--td-pale-blue);
    border: 1px solid #CCEEFB;
    border-radius: 999px;
    color: var(--td-body);
    font-size: 0.8125rem;
    padding: 5px 14px;
}

.tenderDetailsV3 .categoryToggle {
    background: none;
    border: none;
    color: var(--td-blue-dark);
    font-size: 0.8125rem;
    padding: 5px 4px;
    height: auto;
    text-decoration: underline;
}

/* ---- sidebar ---- */

.tenderDetailsV3 .tenderSidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tenderDetailsV3 .tenderFactCard {
    background: var(--td-pale-blue);
    border-radius: var(--td-radius);
    padding: 24px;
}

.tenderDetailsV3 .tenderFact + .tenderFact {
    margin-top: 20px;
}

.tenderDetailsV3 .tenderFactLabel {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--td-muted);
    margin-bottom: 4px;
}

.tenderDetailsV3 .tenderFactValue {
    font-size: 1.0625rem;
    color: var(--td-ink);
    line-height: 1.4;
}

.tenderDetailsV3 .tenderFactValue.closed {
    color: #9B1C1C;
}

.tenderDetailsV3 .tenderFactRegions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

/*  Duplicated from opportunitySearchResultsV3.css, which the details page does not load.
    Keep the two lists in step; they are a candidate for a shared component stylesheet. */
.tenderDetailsV3 .regionBadge {
    color: #FFF;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
    padding: 2px 7px;
    border-radius: 6px;
    background: #6B7280;
}

.tenderDetailsV3 .regionBadge.SA   { background: #D9534F; }
.tenderDetailsV3 .regionBadge.WA   { background: #3A2E28; }
.tenderDetailsV3 .regionBadge.NSW  { background: #16337A; }
.tenderDetailsV3 .regionBadge.VIC  { background: #5C2D91; }
.tenderDetailsV3 .regionBadge.QLD  { background: #4FC3E8; }
.tenderDetailsV3 .regionBadge.TAS  { background: #1C8C8A; }
.tenderDetailsV3 .regionBadge.NT   { background: #D68C4A; }
.tenderDetailsV3 .regionBadge.ACT  { background: #0b5700; }
.tenderDetailsV3 .regionBadge.NZ   { background: #1A1A1A; }
.tenderDetailsV3 .regionBadge.AUS  { background: #de0d83; }

.tenderDetailsV3 .tenderContactCard {
    background: #FFF;
    border: 1px solid var(--td-border);
    border-radius: var(--td-radius);
    padding: 20px 24px;
}

.tenderDetailsV3 .tenderContact + .tenderContact {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--td-border);
}

.tenderDetailsV3 .tenderContactLayout {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px 16px;
}

.tenderDetailsV3 .tenderContactHeading {
    font-weight: 700;
    color: var(--td-ink);
    font-size: 0.875rem;
}

.tenderDetailsV3 .tenderContactLines {
    font-size: 0.875rem;
    line-height: 1.6;
}

.tenderDetailsV3 .tenderContactLines a {
    color: var(--td-blue-dark);
    word-break: break-word;
}

.tenderDetailsV3 .tenderDisclaimer {
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--td-muted);
    padding: 0 4px;
}

/* ---- briefings ---- */

.tenderDetailsV3 .briefingRow {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 32px;
}

.tenderDetailsV3 .briefingRow + .briefingRow {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--td-border);
}

.tenderDetailsV3 .briefingDetail {
    font-size: 0.875rem;
    line-height: 1.6;
}

.tenderDetailsV3 .briefingTitle {
    font-weight: 600;
    color: var(--td-ink);
}

.tenderDetailsV3 .briefingNote {
    color: var(--td-muted);
    font-size: 0.8125rem;
    margin-top: 12px;
}

.tenderDetailsV3 .briefingCancelled {
    color: #9B1C1C;
    font-weight: 600;
}

.tenderDetailsV3 .briefingActions {
    flex-shrink: 0;
}

.tenderDetailsV3 .briefingActions .btn {
    height: auto;
    line-height: 1.5;
    padding: 8px 20px;
    border-radius: var(--td-radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.tenderDetailsV3 .briefingActions form {
    margin: 0;
}

/* ---- specification documents ---- */

.tenderDetailsV3 .specDocsHeader {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 12px;
}

.tenderDetailsV3 .specDocsHeader h2 {
    margin-bottom: 0;
}

.tenderDetailsV3 .specDocsDownload {
    color: #414042;
    font-size: 0.85rem;
    text-decoration: none;
}

.tenderDetailsV3 .specDocsDownload:hover {
    color: var(--primary-blue, #19acee);
    text-decoration: underline;
}

.tenderDetailsV3 .specDocsDownloadAll {
    color: var(--td-blue-dark);
    font-size: 0.875rem;
    white-space: nowrap;
}

.tenderDetailsV3 .specDocsTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.tenderDetailsV3 .specDocsTable td {
    padding: 10px 8px;
    vertical-align: top;
    border-bottom: 1px solid #F0F0F0;
}

.tenderDetailsV3 .specDocsTable td:first-child {
    padding-left: 0;
    width: 55%;
}

.tenderDetailsV3 .specDocsTable td:last-child {
    padding-right: 0;
    text-align: right;
    white-space: nowrap;
}

.tenderDetailsV3 .specDocsTable a {
    color: var(--td-blue-dark);
}

.tenderDetailsV3 .specDocsEmpty,
.tenderDetailsV3 .briefingsEmpty {
    font-size: 0.875rem;
    color: var(--td-muted);
}

.tenderDetailsV3 .specDocsTitle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tenderDetailsV3 .specDocsCount {
    font-size: 0.75rem;
    color: var(--td-body);
    margin-left: 12px;
}

/* Stand-in rows for unauthenticated viewers; the text is placeholder, the blur only hides that. */
.tenderDetailsV3 .specDocsBlurred td {
    filter: blur(4px);
    user-select: none;
    pointer-events: none;
}

/* ---- premium lock ---- */

.tenderDetailsV3 .premiumLock {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #FFF;
    color: var(--td-ink);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}

.tenderDetailsV3 a.premiumLock {
    text-decoration: none;
}

.tenderDetailsV3 a.premiumLock:hover {
    color: var(--td-blue-dark);
}

.tenderDetailsV3 .premiumLock i {
    font-size: 0.625rem;
}

/* ---- premium banner ---- */

/* style.css pads the bottom of every page's content, which would leave a white strip between the banner and the footer. */
body:has(.premiumBanner) .content {
    padding-bottom: 0;
}

.tenderDetailsV3 .premiumBanner {
    background: var(--td-blue-dark);
    color: #FFF;
    padding: 64px 0;
}

.tenderDetailsV3 .premiumBannerInner {
    max-width: 1440px;
    margin: 0 auto;
    padding-inline: 32px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 48px;
    align-items: center;
}

.tenderDetailsV3 .premiumBannerHeading {
    color: #FFF;
    font-size: 1.75rem;
    font-weight: 400;
    margin: 0 0 8px;
}

.tenderDetailsV3 .premiumBannerLead {
    font-size: 1.125rem;
    margin: 0 0 32px;
}

.tenderDetailsV3 .premiumBannerFeatures {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;

    & li + li {
        margin-top: 6px;
    }

    & i {
        margin-right: 6px;
        font-size: 0.75rem;
    }
}

.tenderDetailsV3 .premiumBannerCard {
    background: var(--td-pale-blue);
    color: var(--td-body);
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
}

.tenderDetailsV3 .premiumBannerPlan {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 8px;
}

.tenderDetailsV3 .premiumBannerPrice {
    color: var(--td-blue-dark);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 20px;

    & span {
        color: var(--td-body);
        font-size: 0.75rem;
        font-weight: 400;
        margin-left: 4px;
    }
}

.tenderDetailsV3 .premiumBannerBilling {
    color: var(--td-muted);
    font-size: 0.6875rem;
    margin: 16px 0 0;
}

/* ---- external portal ---- */

.tenderDetailsV3 .externalPortalNote {
    font-size: 0.875rem;
    line-height: 1.7;
}

.tenderDetailsV3 .externalPortalNote a {
    color: var(--td-blue-dark);
}

.tenderDetailsV3 .tenderTimestamps {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--td-border);
    font-size: 0.75rem;
    color: var(--td-muted);
}

/* ---- share modal ---- */

#shareTenderModal {
    --bs-modal-width: 440px;
}

/* Bootstrap's .shadow is not used here as ct.css turns it into a pink glow */
#shareTenderModal .modal-content {
    box-shadow: 0 12px 40px rgba(25, 25, 25, 0.18);
}

/*  ct.css caps every .modal-body and scrolls inside it, which drew a scrollbar over the dialog's rounded
    corner when zoomed in. The dialog scrolls as a whole instead, as Bootstrap does by default. */
#shareTenderModal .modal-body {
    max-height: none;
    overflow: visible;
}

#shareTenderModal .shareLabel {
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--td-ink);
}

/* style.css hides every span inside a label */
#shareTenderModal .shareLabel .shareOptional {
    display: inline;
    font-weight: 400;
    color: var(--td-muted);
}

#shareTenderModal .shareHint,
#shareTenderModal .shareEmpty {
    color: var(--td-muted);
}

#shareTenderModal .shareHint {
    margin-top: 6px;
    font-size: 0.8125rem;
}

#shareTenderModal .horizontalDivider {
    color: var(--td-muted);
}

/*  style.css gives bare inputs a fixed height, padding and font size, and every textarea a 150px height,
    so both are reset to the page's own control metrics. */
#shareTenderModal .form-control {
    height: auto;
    min-height: 0;
    padding: 9px 12px;
    font-size: 0.9375rem;
    line-height: 1.5;
    border: 1px solid var(--td-border);
    border-radius: var(--td-radius-sm);
}

#shareTenderModal textarea.form-control {
    resize: vertical;
}

#shareTenderModal .form-control:focus {
    border-color: var(--td-blue-dark);
    box-shadow: 0 0 0 3px rgba(0, 126, 195, 0.15);
}

#shareTenderModal .shareError {
    padding: 8px 12px;
    font-size: 0.875rem;
    color: #993C1D;
    background: #FDF1EC;
    border-radius: var(--td-radius-sm);
}

#shareTenderModal .modal-footer .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#shareTenderModal .modal-footer .btn {
    height: auto;
    min-width: 96px;
    padding: 9px 20px;
    line-height: 1.5;
    font-weight: 600;
    border-radius: var(--td-radius-sm);
}

/*  Five rows of 30px avatar plus the row's py-1 padding, plus the list's own py-2 padding, so a sixth
    person and beyond scroll inside the list instead of growing the modal. */
#shareTeamList {
    max-height: calc(5 * (30px + 0.5rem) + 1rem);
    overflow-y: auto;
    background: var(--td-pale-blue);
    border: 1px solid var(--td-border);
}

#shareTenderModal .shareAvatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--td-blue-dark);
    color: #FFF;
    font-size: 0.625rem;
}

#shareTenderModal .form-check-input {
    border-color: var(--td-body);
}

#shareTenderModal .form-check-input:checked {
    background-color: var(--td-blue-dark);
    border-color: var(--td-blue-dark);
}

/* ---- responsive ---- */

@media (max-width: 991.98px) {
    .tenderDetailsV3 .tenderBody,
    .tenderDetailsV3 .premiumBannerInner {
        grid-template-columns: minmax(0, 1fr);
        gap: 32px;
    }

    .tenderDetailsV3 .tenderHeroMain {
        flex-direction: column;
        align-items: stretch;
    }

    /*  Forum is wrapped in a tooltip span, so the span is the flex item rather than the
        button. Both have to stretch or the two buttons come out different widths. */
    .tenderDetailsV3 .tenderHeroButtons > * {
        flex: 1 1 auto;
        text-align: center;
    }

    .tenderDetailsV3 .tenderHeroButtons > span > .btn {
        width: 100%;
    }

    .tenderDetailsV3 .tenderTitle {
        font-size: 1.5rem;
        max-width: none;
    }

    .tenderDetailsV3 .briefingRow {
        flex-direction: column;
        gap: 16px;
    }
}

@media (max-width: 575.98px) {
    .tenderDetailsV3 .tenderHero {
        padding: 24px 0 28px;
        margin-bottom: 28px;
    }

    .tenderDetailsV3 .tenderHeroInner,
    .tenderDetailsV3 .tenderBody,
    .tenderDetailsV3 .premiumBannerInner {
        padding-inline: 16px;
    }

    .tenderDetailsV3 .premiumBanner {
        padding: 40px 0;
    }

    .tenderDetailsV3 .tenderTitle {
        font-size: 1.25rem;
    }

    .tenderDetailsV3 .tenderHeroButtons {
        flex-direction: column;
    }

    /*  Four columns will not fit a phone, so the version and posted date fold underneath
        the document name rather than forcing the row to scroll. */
    .tenderDetailsV3 .specDocsTable,
    .tenderDetailsV3 .specDocsTable tbody,
    .tenderDetailsV3 .specDocsTable tr {
        display: block;
    }

    .tenderDetailsV3 .specDocsTable td {
        display: inline-block;
        border-bottom: none;
        padding: 2px 12px 2px 0;
    }

    .tenderDetailsV3 .specDocsTable td:first-child {
        display: block;
        width: auto;
        font-weight: 600;
        padding-top: 12px;
    }

    .tenderDetailsV3 .specDocsTable tr {
        border-bottom: 1px solid #F0F0F0;
        padding-bottom: 10px;
    }

    .tenderDetailsV3 .specDocsTable td:last-child {
        text-align: left;
    }
}
