/* Cookie consent banner for legacy pages (ENG-10658). Plain CSS so it needs no build; the values match the
   Tailwind classes of the new frontend's ConsentBanner.vue, so both apps look the same. */

/* Legacy styles bare elements (p in Assistant, with its own size and bottom padding). Inside the banner, text
   takes its font and spacing from the bar or window instead. :where() keeps this at class weight, so the rules
   below still win. */
.sr-consent-root :where(p, h2) {
    margin: 0;
    padding: 0;
}

.sr-consent-root :where(p, span, strong, a, h2) {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    letter-spacing: normal;
}

/* Above legacy's own fixed bottom bars (the calculator's mobile navigation is z-80, the compare bars z-90), so they
   can never cover the choice. */
.sr-consent-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 -6px 24px rgba(16, 24, 40, 0.12);
    color: #0f172a;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.sr-consent-inner {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 14px 16px 18px;
    box-sizing: border-box;
}

.sr-consent-text {
    flex: 1 1 0%;
    min-width: 0;
    margin: 0;
    font-size: 13px;
    line-height: 20px;
    color: #475569;
}

.sr-consent-gpc {
    display: flex;
    flex: 1 1 0%;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sr-consent-badge {
    display: none;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    background: #e6f3ea;
    color: #007c27;
}

.sr-consent-honored {
    font-weight: 600;
    color: #007c27;
}

.sr-consent-link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 500;
    white-space: nowrap;
    color: #1e293b;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.sr-consent-link:hover {
    color: #0f172a;
}

.sr-consent-icon {
    display: inline-block;
    flex: none;
    margin-right: 6px;
    vertical-align: -2px;
}

.sr-consent-actions {
    display: flex;
    flex: none;
    flex-direction: column;
    gap: 8px;
}

.sr-consent-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

/* Reject all and Accept all share this style: the CPRA requires equal weight. */
.sr-consent-primary {
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: #0068ce;
    color: #fff;
    font: 600 14px/1 Inter, ui-sans-serif, system-ui, sans-serif;
    white-space: nowrap;
    cursor: pointer;
}

.sr-consent-primary:hover {
    background: #128aff;
}

.sr-consent-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Under the buttons on mobile, to their left on desktop. */
.sr-consent-manage {
    align-self: center;
    padding: 4px 8px;
    border: 0;
    background: none;
    color: #334155;
    font: 500 13px/20px Inter, ui-sans-serif, system-ui, sans-serif;
    white-space: nowrap;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.sr-consent-manage:hover {
    color: #0f172a;
}

.sr-consent-desktop-only {
    display: none;
}

@media (max-width: 1023px) and (max-height: 480px) and (orientation: landscape) {
    .sr-consent-ask {
        max-height: 25vh;
        overflow-y: auto;
    }

    .sr-consent-ask .sr-consent-inner {
        gap: 4px;
        padding-top: 3px;
        padding-bottom: 3px;
    }
}

@media (min-width: 768px) {
    .sr-consent-inner {
        padding-right: 40px;
        padding-left: 40px;
    }
}

@media (min-width: 1024px) {
    .sr-consent-inner {
        flex-direction: row;
        align-items: center;
        gap: 40px;
        min-height: 80px;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .sr-consent-text {
        font-size: 13.5px;
    }

    .sr-consent-badge {
        display: flex;
    }

    .sr-consent-actions {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .sr-consent-buttons {
        display: flex;
        gap: 10px;
    }

    .sr-consent-primary {
        min-width: 120px;
    }

    .sr-consent-manage {
        order: -1;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .sr-consent-mobile-only {
        display: none;
    }

    p.sr-consent-desktop-only {
        display: block;
    }

    .sr-consent-actions.sr-consent-desktop-only {
        display: flex;
    }
}

/* The preferences window */

.sr-consent-dialog {
    width: 600px;
    max-width: calc(100% - 2rem);
    padding: 0;
    border: 0;
    border-radius: 16px;
    color: #0f172a;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* A browser without <dialog> support treats it as an unknown element and would show the window in the page. */
.sr-consent-dialog:not([open]) {
    display: none;
}

.sr-consent-dialog::backdrop {
    background: rgba(15, 23, 42, 0.7);
}

.sr-consent-dialog:not([data-gpc]) [data-consent-gpc-only] {
    display: none;
}

.sr-consent-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 20px 0;
}

.sr-consent-dialog-head h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 28px;
}

.sr-consent-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: #64748b;
    cursor: pointer;
}

.sr-consent-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.sr-consent-dialog-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 12px 20px 20px;
    font-size: 14px;
    line-height: 20px;
    color: #475569;
}

.sr-consent-dialog-body p {
    margin: 0;
}

.sr-consent-dialog a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sr-consent-gpc-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border: 1px solid #bfe2ca;
    border-radius: 8px;
    background: #e6f3ea;
    font-size: 13px;
    line-height: 20px;
    color: #00531a;
}

.sr-consent-gpc-note svg {
    flex: none;
    margin-top: 1px;
}

.sr-consent-rows {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.sr-consent-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 16px;
}

.sr-consent-row + .sr-consent-row {
    border-top: 1px solid #e2e8f0;
}

.sr-consent-row > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.sr-consent-row-title {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

.sr-consent-row-text {
    font-size: 13px;
    line-height: 20px;
}

.sr-consent-row-gpc {
    font-size: 12px;
    font-weight: 600;
    color: #007c27;
}

.sr-consent-always {
    flex: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    color: #007c27;
}

.sr-consent-switch {
    display: flex;
    flex: none;
    width: 48px;
    height: 28px;
    margin-top: 2px;
    padding: 3px;
    border: 0;
    border-radius: 9999px;
    background: #94a3b8;
    cursor: pointer;
    transition: background-color 0.15s;
}

.sr-consent-switch span {
    width: 22px;
    height: 22px;
    border-radius: 9999px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: transform 0.15s;
}

.sr-consent-switch[aria-checked="true"] {
    background: #0068ce;
}

.sr-consent-switch[aria-checked="true"] span {
    transform: translateX(20px);
}

.sr-consent-switch:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sr-consent-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
}

.sr-consent-dialog-actions .sr-consent-primary {
    flex: 1 1 0%;
    min-height: 48px;
    font-size: 15px;
}

.sr-consent-secondary {
    width: 100%;
    min-height: 48px;
    padding: 0 20px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #0f172a;
    font: 600 15px/1 Inter, ui-sans-serif, system-ui, sans-serif;
    cursor: pointer;
}

.sr-consent-secondary:hover {
    background: #f8fafc;
}

.sr-consent-dialog-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 20px;
    padding: 12px 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
}

.sr-consent-saved {
    margin-right: auto;
    font-weight: 600;
    color: #007c27;
}

.sr-consent-saved[data-failed] {
    color: #b42318;
}

.sr-consent-root .sr-consent-fallback:not(:empty) {
    position: fixed;
    top: 16px;
    right: 16px;
    left: 16px;
    z-index: 101;
    max-width: 640px;
    margin: 0 auto;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font: 600 14px/20px Inter, ui-sans-serif, system-ui, sans-serif;
}

.sr-consent-saved a {
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (min-width: 640px) {
    .sr-consent-dialog-head {
        padding: 24px 28px 0;
    }

    .sr-consent-dialog-body {
        padding-right: 28px;
        padding-left: 28px;
    }

    .sr-consent-dialog-actions {
        padding-right: 28px;
        padding-left: 28px;
    }

    .sr-consent-dialog-actions .sr-consent-primary {
        flex: none;
        min-width: 132px;
    }

    .sr-consent-secondary {
        width: auto;
        margin-right: auto;
    }

    .sr-consent-dialog-foot {
        padding-right: 28px;
        padding-left: 28px;
    }
}

/* The footer link and the "Opt-Out Request Honored" chip, shown for a GPC browser once <html> is marked. */

/* Its top margin comes from the footer's own mt-8, like the links beside it. */
.sr-consent-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.sr-consent-choices {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sr-consent-chip {
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid rgba(77, 173, 107, 0.5);
    border-radius: 9999px;
    background: rgba(0, 138, 43, 0.15);
    color: #99d0aa;
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    white-space: nowrap;
}

html[data-consent-gpc] .sr-consent-chip[hidden] {
    display: inline-flex;
}
