/* Wallkat portal global styles.
   Component-scoped styles live beside the components in *.razor.css files.
   Uses MudBlazor CSS variables so everything follows the active dark/light palette. */

/* ---- Scrollbars (ported from the legacy portal look) ---- */
.academy-tour-spotlight {
    border: 3px solid var(--mud-palette-primary);
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgb(4 10 20 / 72%);
    pointer-events: none;
    position: fixed;
    transition: left 140ms ease, top 140ms ease, width 140ms ease, height 140ms ease;
    z-index: 1501;
}

@media (prefers-reduced-motion: reduce) {
    .academy-tour-spotlight {
        transition: none;
    }
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
    background-color: var(--mud-palette-background);
}

::-webkit-scrollbar-track {
    background-color: var(--mud-palette-background);
}

::-webkit-scrollbar-thumb {
    background-color: var(--mud-palette-lines-default);
    border-radius: 4px;
}

    ::-webkit-scrollbar-thumb:hover {
        background-color: var(--mud-palette-action-default);
    }

/* ---- Page frame ---- */
.wallkat-page {
    box-sizing: border-box;
    margin: 0 auto;
    max-width: 1600px;
    padding: 24px 24px 48px;
    width: 100%;
}

.wallkat-page--wide {
    max-width: 2400px;
}

.wallkat-page--workspace {
    max-width: none;
    padding-inline: clamp(16px, 2vw, 48px);
}

/* ---- Hero banner (refreshed legacy gradient) ---- */
.wallkat-hero {
    background: linear-gradient(100deg, #1b4b96 0%, #14659e 55%, #0f8894 100%);
    border-radius: 12px;
    color: #ffffff;
    padding: 2rem 2rem 3.5rem;
    margin-bottom: -2rem;
}

    .wallkat-hero .wallkat-hero-subtitle {
        color: rgb(255 255 255 / 72%);
    }

    /* The hero keeps its dark blue gradient in both themes, so anything sitting
       on it must stay light-on-dark rather than follow the active palette. */
    .wallkat-hero .mud-chip.mud-chip-outlined,
    .wallkat-hero .mud-chip.mud-chip-filled.mud-chip-color-surface {
        background: rgb(255 255 255 / 14%);
        border-color: rgb(255 255 255 / 45%);
        color: #fff;
    }

    .wallkat-hero .mud-button-outlined,
    .wallkat-hero .mud-button-text {
        border-color: rgb(255 255 255 / 45%);
        color: #fff;
    }

/* Content that overlaps the bottom of the hero */
.wallkat-hero-overlap {
    position: relative;
    z-index: 1;
    margin: 0 0.5rem;
}

.wallkat-hero > .mud-stack-row,
.wallkat-sticky-actions .mud-stack-row {
    flex-wrap: wrap;
    gap: 0.75rem;
}

.wallkat-hero-actions {
    flex: 0 0 auto;
}

/* ---- Stat cards ---- */
.wallkat-stat-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--mud-palette-divider);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.wallkat-stat-card-link {
    color: inherit;
    display: block;
    height: 100%;
    text-decoration: none;
}

.wallkat-stat-card-link:hover .wallkat-stat-card {
    border-color: var(--mud-palette-primary);
    box-shadow: var(--mud-elevation-4);
    transform: translateY(-2px);
}

.wallkat-stat-card-link:focus-visible {
    border-radius: var(--mud-default-borderradius);
    outline: 3px solid var(--mud-palette-primary);
    outline-offset: 3px;
}

/* ---- General content surfaces ---- */
.wallkat-content-card {
    border: 1px solid var(--mud-palette-divider);
    border-radius: 12px;
    height: auto;
}

.wallkat-content-card.wallkat-fill-height {
    height: 100%;
}

.wallkat-toolbar {
    gap: 1rem;
}

.wallkat-responsive-row,
.wallkat-card-actions,
.wallkat-card-metadata {
    flex-wrap: wrap;
}

.wallkat-card-actions {
    justify-content: flex-end;
}

.wallkat-search {
    width: min(100%, 420px);
}

.wallkat-empty-state {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    justify-content: center;
    min-height: 240px;
    padding: 2rem;
    text-align: center;
}

.wallkat-icon-tile {
    align-items: center;
    background: color-mix(in srgb, var(--mud-palette-primary) 14%, transparent);
    border-radius: 10px;
    color: var(--mud-palette-primary);
    display: inline-flex;
    flex: 0 0 auto;
    height: 48px;
    justify-content: center;
    width: 48px;
}

.wallkat-icon-success {
    background: color-mix(in srgb, var(--mud-palette-success) 14%, transparent);
    color: var(--mud-palette-success);
}

.wallkat-payment-card {
    min-height: 285px;
}

/* ---- Media library ---- */
.wallkat-upload-button {
    align-items: center;
    cursor: pointer;
    display: inline-flex;
    min-height: 36px;
    padding: 6px 16px;
}

.wallkat-upload-button input[type="file"] {
    height: 1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    width: 1px;
}

.wallkat-media-card {
    border: 1px solid var(--mud-palette-divider);
    height: 100%;
    overflow: hidden;
}

.wallkat-media-preview {
    align-items: center;
    background:
        linear-gradient(45deg, rgb(128 128 128 / 8%) 25%, transparent 25%),
        linear-gradient(-45deg, rgb(128 128 128 / 8%) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgb(128 128 128 / 8%) 75%),
        linear-gradient(-45deg, transparent 75%, rgb(128 128 128 / 8%) 75%);
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
    display: flex;
    height: 190px;
    justify-content: center;
    overflow: hidden;
}

.wallkat-media-preview img {
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.wallkat-media-preview-link {
    display: block;
}

.wallkat-media-preview-link:focus-visible {
    outline: 3px solid var(--mud-palette-primary);
    outline-offset: -3px;
}

.wallkat-media-preview-link:hover img {
    transform: scale(1.02);
}

.wallkat-media-preview-link img {
    transition: transform 160ms ease;
}

.wallkat-media-unavailable {
    align-items: center;
    background:
        linear-gradient(135deg, transparent 46%, rgb(127 159 199 / 8%) 46% 54%, transparent 54%),
        var(--mud-palette-background-grey);
    color: var(--mud-palette-text-secondary);
    display: flex;
    flex-direction: column;
    gap: .55rem;
    height: 100%;
    justify-content: center;
    width: 100%;
}

.wallkat-data-source-card,
.wallkat-data-source-option {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.wallkat-data-source-option {
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.wallkat-data-source-option-link {
    color: inherit;
    display: block;
    height: 100%;
    text-decoration: none;
}

.wallkat-data-source-option-link:hover .wallkat-data-source-option {
    border-color: var(--mud-palette-primary);
    box-shadow: var(--mud-elevation-4);
    transform: translateY(-2px);
}

.wallkat-data-source-option-link:focus-visible {
    border-radius: var(--mud-default-borderradius);
    outline: 3px solid var(--mud-palette-primary);
    outline-offset: 3px;
}

.wallkat-data-source-card .mud-card-content,
.wallkat-data-source-option .mud-card-content {
    flex: 1;
}

.wallkat-form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wallkat-selection-list {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    background: var(--mud-palette-surface);
}

.wallkat-field {
    color: var(--mud-palette-text-primary);
    display: flex;
    flex-direction: column;
    font-size: .82rem;
    gap: .4rem;
}

.wallkat-field-wide {
    grid-column: 1 / -1;
}

.wallkat-field input,
.wallkat-field select {
    background: transparent;
    border: 1px solid var(--mud-palette-lines-inputs);
    border-radius: var(--mud-default-borderradius);
    color: var(--mud-palette-text-primary);
    font: inherit;
    font-size: 1rem;
    min-height: 3.5rem;
    outline: none;
    padding: .75rem 1rem;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.wallkat-field input:focus,
.wallkat-field select:focus {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--mud-palette-primary) 20%, transparent);
}

.wallkat-submit-button {
    align-items: center;
    background: var(--mud-palette-success);
    border: 0;
    border-radius: var(--mud-default-borderradius);
    box-shadow: var(--mud-elevation-2);
    color: var(--mud-palette-success-text);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 600;
    gap: .5rem;
    min-height: 2.5rem;
    padding: .55rem 1.15rem;
    text-transform: uppercase;
}

@media (max-width: 600px) {
    .wallkat-responsive-row {
        gap: .75rem;
    }

    .wallkat-card-actions {
        justify-content: flex-start;
    }

    .wallkat-form-grid {
        grid-template-columns: 1fr;
    }

    .wallkat-field-wide {
        grid-column: auto;
    }
}

.wallkat-sticky-actions {
    border: 1px solid var(--mud-palette-divider);
    bottom: 1rem;
    position: sticky;
    z-index: 3;
}

/* ---- Referral progress trail ---- */
.wallkat-referral-trail {
    align-items: flex-start;
    display: flex;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

    .wallkat-referral-trail li {
        align-items: center;
        color: var(--mud-palette-text-secondary);
        display: flex;
        flex: 1 1 0;
        flex-direction: column;
        gap: 0.35rem;
        max-width: 130px;
        position: relative;
        text-align: center;
    }

        /* Connector between steps */
        .wallkat-referral-trail li + li::before {
            background: var(--mud-palette-lines-default);
            content: "";
            height: 3px;
            left: -50%;
            position: absolute;
            top: 15px;
            width: 100%;
        }

        .wallkat-referral-trail li.reached + li.reached::before,
        .wallkat-referral-trail li.reached::before {
            background: var(--mud-palette-success);
        }

        .wallkat-referral-trail li .mud-icon-root {
            background: var(--mud-palette-lines-default);
            border-radius: 50%;
            color: var(--mud-palette-surface);
            height: 32px;
            padding: 6px;
            position: relative;
            width: 32px;
            z-index: 1;
        }

        .wallkat-referral-trail li.reached .mud-icon-root {
            background: var(--mud-palette-success);
            color: var(--mud-palette-success-text);
        }

.wallkat-referral-step-label {
    font-size: 0.7rem;
    line-height: 1.2;
}

/* ---- Add-report chooser ---- */
.wallkat-add-report-option {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease;
}

    .wallkat-add-report-option:hover {
        background: var(--mud-palette-action-default-hover);
        border-color: var(--mud-palette-primary);
    }

/* ---- Plan cards ---- */
.wallkat-plan-card {
    border: 1px solid var(--mud-palette-divider);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
    transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

    .wallkat-plan-card:hover {
        border-color: var(--mud-palette-success);
        box-shadow: 0 10px 30px rgb(0 0 0 / 18%);
        transform: translateY(-3px);
    }

.wallkat-plan-card-current {
    border-color: var(--mud-palette-primary);
}

/* A corner pill rather than a rotated ribbon: the card clips its overflow, and a
   45-degree band across the corner always cut the label at some card width. */
.wallkat-plan-flag {
    background: var(--mud-palette-primary);
    border-radius: 999px;
    color: var(--mud-palette-primary-text);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 4px 12px;
    position: absolute;
    right: 12px;
    text-transform: uppercase;
    top: 12px;
    white-space: nowrap;
}

.wallkat-plan-flag-popular {
    background: linear-gradient(81deg, #0250c4 0%, #0ba2bf 100%);
    color: #fff;
}

.wallkat-plan-label {
    border-radius: 4px;
    /* Shrink-wrap so the label never runs under the corner badge. */
    display: inline-block;
    font-weight: 700;
    padding: 4px 12px;
    width: fit-content;
}

.wallkat-plan-label-pro {
    background: color-mix(in srgb, var(--mud-palette-text-secondary) 18%, transparent);
    color: var(--mud-palette-text-primary);
}

.wallkat-plan-label-executive {
    background: color-mix(in srgb, var(--mud-palette-success) 20%, transparent);
    color: var(--mud-palette-success);
}

.wallkat-plan-label-epic {
    background: color-mix(in srgb, var(--mud-palette-info) 20%, transparent);
    color: var(--mud-palette-info);
}

.wallkat-plan-price {
    font-size: 2.4rem;
    font-weight: 300;
    line-height: 1.2;
    margin-top: 0.75rem;
}

    .wallkat-plan-price span {
        color: var(--mud-palette-text-secondary);
        font-size: 1rem;
    }

.wallkat-plan-features {
    border-top: 1px solid var(--mud-palette-divider);
    flex: 1 1 auto;
    margin-top: 1rem;
    padding-top: 0.5rem;
}

.wallkat-plan-action {
    margin-top: 1rem;
}

/* ---- Invoice document ---- */
.wallkat-invoice-document {
    border: 1px solid var(--mud-palette-divider);
    border-radius: 12px;
    margin: 0 auto;
    max-width: 900px;
    padding: 2.5rem;
}

.wallkat-invoice-head {
    align-items: flex-start;
    border-bottom: 1px solid var(--mud-palette-divider);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding-bottom: 1.5rem;
}

/* The logo artwork has a baked-in white background, so give it a deliberate
   white plate rather than letting it float as a bare block on the dark surface. */
.wallkat-invoice-logo {
    background: #fff;
    border-radius: 6px;
    max-width: 180px;
    padding: 6px 10px;
    width: 40%;
}

.wallkat-invoice-parties {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 2fr 1fr;
    padding: 1.5rem 0;
}

.wallkat-invoice-table {
    border-collapse: collapse;
    width: 100%;
}

    .wallkat-invoice-table th,
    .wallkat-invoice-table td {
        border-bottom: 1px solid var(--mud-palette-divider);
        padding: 0.7rem 0.6rem;
        text-align: left;
        vertical-align: top;
    }

    .wallkat-invoice-table th {
        background: var(--mud-palette-background-grey);
        color: var(--mud-palette-text-secondary);
        font-size: 0.75rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .wallkat-invoice-table .numeric {
        text-align: right;
        white-space: nowrap;
    }

.wallkat-invoice-plan {
    color: var(--mud-palette-text-secondary);
    display: block;
    font-size: 0.8rem;
}

.wallkat-invoice-empty {
    color: var(--mud-palette-text-secondary);
    padding: 1.5rem 0.6rem;
    text-align: center;
}

.wallkat-invoice-totals {
    display: flex;
    justify-content: flex-end;
    padding-top: 1.25rem;
}

    .wallkat-invoice-totals dl {
        display: grid;
        gap: 0.35rem 2rem;
        grid-template-columns: auto auto;
        margin: 0;
        min-width: 300px;
    }

    .wallkat-invoice-totals dt {
        color: var(--mud-palette-text-secondary);
        font-size: 0.875rem;
    }

    .wallkat-invoice-totals dd {
        font-size: 0.875rem;
        margin: 0;
        text-align: right;
    }

    .wallkat-invoice-totals .grand {
        border-top: 1px solid var(--mud-palette-divider);
        color: var(--mud-palette-text-primary);
        font-size: 1.05rem;
        font-weight: 700;
        padding-top: 0.5rem;
    }

.wallkat-invoice-foot {
    border-top: 1px solid var(--mud-palette-divider);
    color: var(--mud-palette-text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 2rem;
    padding-top: 1.25rem;
    text-align: center;
}

@media (max-width: 700px) {
    .wallkat-invoice-document {
        padding: 1.25rem;
    }

    .wallkat-invoice-parties {
        grid-template-columns: 1fr;
    }
}

@media print {
    .wallkat-no-print,
    .mud-appbar,
    .mud-drawer,
    .wallkat-footer,
    .mud-snackbar-provider {
        display: none !important;
    }

    .mud-main-content {
        padding: 0 !important;
    }

    .wallkat-page {
        padding: 0 !important;
    }

    .wallkat-hero-overlap {
        margin: 0;
    }

    .wallkat-invoice-document {
        border: 0;
        box-shadow: none;
        color: #000;
        max-width: none;
        padding: 0;
    }

    .wallkat-invoice-table th {
        background: #f2f2f2;
    }
}

/* ---- Theme preference cards ---- */
.wallkat-theme-card {
    cursor: pointer;
    height: 100%;
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.wallkat-theme-card:hover,
.wallkat-theme-card-selected {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 8px 24px rgb(0 0 0 / 12%);
    transform: translateY(-2px);
}

.wallkat-theme-preview {
    border-radius: 8px;
    display: grid;
    gap: 6px;
    grid-template-columns: 28% 1fr;
    grid-template-rows: 14px 1fr;
    height: 92px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    padding: 8px;
}

.wallkat-theme-preview span {
    border-radius: 4px;
}

.wallkat-theme-preview span:first-child {
    grid-column: 1 / -1;
}

.wallkat-theme-preview span:nth-child(2) {
    grid-row: 2;
}

.wallkat-theme-preview span:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
}

.wallkat-theme-dark {
    background: #0c1422;
}

.wallkat-theme-dark span {
    background: #26344c;
}

.wallkat-theme-dark span:first-child {
    background: #6ea3e0;
}

.wallkat-theme-light {
    background: #eef1f6;
}

.wallkat-theme-light span {
    background: #ffffff;
}

.wallkat-theme-light span:first-child {
    background: #3d6ca8;
}

.wallkat-theme-blue {
    background: #dce8f6;
}

.wallkat-theme-blue span {
    background: #ffffff;
}

.wallkat-theme-blue span:first-child {
    background: #0067a7;
}

.wallkat-theme-wallpunk {
    background: #16131f;
}

.wallkat-theme-wallpunk span {
    background: #30233d;
}

.wallkat-theme-wallpunk span:first-child {
    background: linear-gradient(90deg, #f43b94, #7048e8);
}

    .wallkat-stat-card .wallkat-stat-body {
        flex: 1 1 auto;
    }

    .wallkat-stat-card .wallkat-stat-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        border-top: 1px solid var(--mud-palette-divider);
        padding: 0.5rem 1rem;
    }

        .wallkat-stat-card .wallkat-stat-footer span {
            color: var(--mud-palette-text-default);
            font-size: 0.8125rem;
        }

/* ---- Nav section headings ---- */
.wallkat-nav-heading {
    color: var(--mud-palette-text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    margin: 1.25rem 1rem 0.25rem;
    text-transform: uppercase;
}

/* ---- Footer ---- */
.wallkat-footer {
    border-top: 1px solid var(--mud-palette-divider);
    color: var(--mud-palette-text-secondary);
    font-size: 0.8125rem;
    padding: 1rem 1.5rem;
    text-align: center;
}

/* ---- Native colour inputs (report editor) ---- */
.wallkat-color-input {
    background: transparent;
    block-size: 40px;
    border: 1px solid var(--mud-palette-lines-inputs);
    border-radius: var(--mud-default-borderradius);
    cursor: pointer;
    inline-size: 48px;
    padding: 4px;
}

.wallkat-color-input-small {
    block-size: 32px;
    inline-size: 40px;
}

@media (prefers-reduced-motion: reduce) {
    .wallkat-stat-card,
    .wallkat-data-source-option,
    .wallkat-resource-card,
    .wallkat-media-preview-link img {
        transition: none;
    }

    .wallkat-stat-card-link:hover .wallkat-stat-card,
    .wallkat-data-source-option-link:hover .wallkat-data-source-option,
    .wallkat-resource-card-link:hover .wallkat-resource-card,
    .wallkat-media-preview-link:hover img {
        transform: none;
    }
}

@media (max-width: 600px) {
    .wallkat-page {
        padding: 12px 12px 36px;
    }

    .wallkat-hero {
        padding: 1.5rem 1.25rem 3rem;
    }

    .wallkat-hero .mud-stack-row,
    .wallkat-toolbar,
    .wallkat-sticky-actions .mud-stack-row {
        align-items: stretch !important;
        flex-direction: column !important;
    }

    .wallkat-hero-actions {
        width: 100%;
    }

    .wallkat-sticky-actions .mr-auto {
        margin-right: 0 !important;
    }

    .wallkat-card-actions .mr-auto {
        margin-right: 0 !important;
    }

    .wallkat-sticky-actions .mud-button-root,
    .wallkat-card-actions .mud-button-root {
        width: 100%;
    }

    .wallkat-search {
        width: 100%;
    }
}
