:root {
    --tudctf-primary: #5746d6;
    --tudctf-primary-hover: #4938bd;
    --tudctf-surface: #26292d;
    --tudctf-surface-soft: #303339;
    --tudctf-border: rgb(255 255 255 / 10%);
    --tudctf-shadow:
        0 24px 70px rgb(14 8 45 / 34%),
        0 3px 12px rgb(14 8 45 / 15%);

    --pf-v5-global--primary-color--100: var(--tudctf-primary);
    --pf-v5-global--primary-color--200: var(--tudctf-primary-hover);
    --pf-v5-global--link--Color: var(--tudctf-primary);
    --pf-v5-global--link--Color--hover: var(--tudctf-primary-hover);
}

html,
body,
#app {
    height: 100% !important;
    min-height: 0;
    overflow: hidden;
}

html {
    color-scheme: dark;
}

body {
    background: #17151f;
}

/* Use the exact same background asset as the production login theme. */
.pf-v5-c-page {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
    padding: 1rem;
    gap: 1rem;
    background: url("../../../login/tudctf/img/background.png") center top / cover no-repeat;
}

/* Header island; no custom logo means Keycloak keeps its stock brand. */
.pf-v5-c-masthead {
    width: 100%;
    min-height: 4.375rem;
    overflow: visible;
    background: rgb(38 41 45 / 96%);
    border: 1px solid var(--tudctf-border);
    border-radius: 14px;
    box-shadow: var(--tudctf-shadow);
}

.pf-v5-c-masthead__content,
.pf-v5-c-masthead .pf-v5-c-toolbar {
    background: transparent;
}

/* Sidebar island. PatternFly keeps its responsive/collapsible behavior. */
.pf-v5-c-page__sidebar {
    height: calc(100% - 1rem);
    margin-bottom: 1rem;
    overflow: hidden;
    background: rgb(38 41 45 / 96%);
    border: 1px solid var(--tudctf-border);
    border-radius: 14px;
    box-shadow: var(--tudctf-shadow);
}

.pf-v5-c-page__sidebar.pf-m-collapsed {
    border: 0;
    box-shadow: none !important;
}

.pf-v5-c-nav {
    padding-block: 0.75rem;
}

.pf-v5-c-nav__link {
    margin-inline: 0.75rem;
    border-radius: 8px;
}

.pf-v5-c-nav__link:hover {
    background: rgb(255 255 255 / 6%);
}

.pf-v5-c-nav__link.pf-m-current {
    color: #fff;
    background: var(--tudctf-primary);
    box-shadow: none;
}

.pf-v5-c-nav__link.pf-m-current:hover {
    background: var(--tudctf-primary-hover);
}

.pf-v5-c-nav__link.pf-m-current::after {
    border-left: 0;
}

/* Main content floats independently from the navigation islands. */
.pf-v5-c-page__main {
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    background: transparent;
}

.pf-v5-c-page__main > .pf-v5-c-page__main-section {
    width: min(68rem, calc(100% - clamp(2rem, 6vw, 7rem)));
    max-width: 68rem;
    margin-right: auto;
    margin-left: clamp(1.5rem, 3vw, 3.5rem);
    background: transparent;
}

.pf-v5-c-page__main > .pf-v5-c-page__main-section:first-child {
    padding: clamp(1.5rem, 4vw, 3rem) 0 1.25rem;
    color: #fff;
    text-shadow: 0 2px 18px rgb(0 0 0 / 38%);
}

.pf-v5-c-page__main > .pf-v5-c-page__main-section:first-child .pf-v5-c-title {
    color: #fff;
}

.pf-v5-c-page__main > .pf-v5-c-page__main-section:not(:first-child) {
    flex: 0 0 auto;
    padding: clamp(1.5rem, 3vw, 2.25rem);
    /* Let the deep card shadow fade before the scrolling column clips it. */
    margin-bottom: 7rem;
    overflow: hidden;
    background-color: var(--tudctf-surface);
    background-image: none;
    border: 1px solid var(--tudctf-border);
    border-radius: 14px;
    box-shadow: var(--tudctf-shadow);
}

/* Keycloak nests page sections on security screens; keep one visual surface. */
.pf-v5-c-page__main > .pf-v5-c-page__main-section:not(:first-child) .pf-v5-c-page__main-section {
    padding-inline: 0;
    background: transparent;
}

.pf-v5-c-card {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.pf-v5-c-card__header,
.pf-v5-c-card__body,
.pf-v5-c-card__footer {
    padding-inline: 0;
}

.pf-v5-c-form-control,
.pf-v5-c-menu-toggle,
.pf-v5-c-button {
    border-radius: 6px;
}

.pf-v5-c-button {
    touch-action: manipulation;
}

.pf-v5-c-button.pf-m-primary {
    background: var(--tudctf-primary);
}

.pf-v5-c-button.pf-m-primary:hover {
    background: var(--tudctf-primary-hover);
}

a {
    color: var(--tudctf-primary);
}

a:hover {
    color: var(--tudctf-primary-hover);
}

/* One jump target does not justify a separate navigation column. */
.pf-v5-l-grid__item:has(.pf-v5-c-jump-links__item:only-child) {
    display: none;
}

.pf-v5-l-grid:has(.pf-v5-c-jump-links__item:only-child) > .pf-v5-l-grid__item:first-child {
    grid-column: 1 / -1;
    max-width: 56rem;
}

/* Native content/applications launcher page. */
.tudctf-launcher {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10.5rem, 12rem));
    gap: 0.875rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.tudctf-launcher-item {
    display: flex;
}

.tudctf-launcher-heading p {
    margin-top: 0.5rem;
}

.tudctf-launcher-card {
    display: flex;
    width: 100%;
    min-height: 9.5rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1rem;
    overflow: hidden;
    color: #fff;
    text-align: center;
    text-decoration: none;
    background: var(--tudctf-surface-soft);
    border: 1px solid var(--tudctf-border);
    border-radius: 14px;
    transition:
        transform 140ms ease,
        border-color 140ms ease,
        box-shadow 140ms ease,
        background-color 140ms ease;
}

.tudctf-launcher-card:hover {
    transform: translateY(-2px);
    color: #fff;
    text-decoration: none;
    background: #35383f;
    border-color: rgb(87 70 214 / 80%);
    box-shadow: 0 12px 28px rgb(14 8 45 / 28%);
}

.tudctf-launcher-card:focus-visible {
    outline: 2px solid #8d80ee;
    outline-offset: 2px;
}

.tudctf-launcher-icon {
    position: relative;
    display: grid;
    width: 3.5rem;
    height: 3.5rem;
    flex: 0 0 3.5rem;
    place-items: center;
    overflow: hidden;
    color: #c9c4ff;
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1;
    background: rgb(87 70 214 / 18%);
    border-radius: 14px;
}

.tudctf-launcher-icon img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: inherit;
    background: var(--tudctf-surface-soft);
}

.tudctf-launcher-copy {
    display: grid;
    gap: 0.25rem;
    max-width: 100%;
}

.tudctf-launcher-name {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
}

.tudctf-launcher-description {
    color: rgb(255 255 255 / 68%);
    font-size: 0.78rem;
    line-height: 1.35;
}

/* Environment-aware infrastructure directory. */
.tudctf-infrastructure {
    display: grid;
}

.tudctf-infrastructure-card {
    --tudctf-environment-color: #8d80ee;

    display: grid;
    grid-template-columns: minmax(12rem, 0.9fr) minmax(0, 1.6fr);
    align-items: center;
    gap: 1.5rem;
    min-width: 0;
    padding-block: 1.25rem;
    border-top: 1px solid var(--tudctf-border);
}

.tudctf-infrastructure-card:first-child {
    padding-top: 0;
    border-top: 0;
}

.tudctf-infrastructure-card:last-child {
    padding-bottom: 0;
}

.tudctf-infrastructure-card.is-production {
    --tudctf-environment-color: #ff7b72;
}

.tudctf-infrastructure-card.is-test {
    --tudctf-environment-color: #f0c36a;
}

.tudctf-infrastructure-card.is-development {
    --tudctf-environment-color: #63c5da;
}

.tudctf-infrastructure-card-header {
    min-width: 0;
    padding-inline-start: 0.25rem;
}

.tudctf-infrastructure-card-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.tudctf-infrastructure-card-header p {
    max-width: 24rem;
    margin: 0.4rem 0 0 1.15rem;
    color: rgb(255 255 255 / 66%);
    font-size: 0.82rem;
    line-height: 1.45;
}

.tudctf-infrastructure-environment {
    margin: 0;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
    text-wrap: balance;
}

.tudctf-infrastructure-environment-dot {
    width: 0.5rem;
    height: 0.5rem;
    flex: none;
    background: var(--tudctf-environment-color);
    border-radius: 50%;
    box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--tudctf-environment-color) 14%, transparent);
}

.tudctf-infrastructure-services {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr));
    gap: 0.75rem;
    min-width: 0;
}

.tudctf-infrastructure-service {
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    min-height: 4.25rem;
    padding: 0.7rem 0.8rem;
    color: #fff;
    text-decoration: none;
    background: rgb(255 255 255 / 3%);
    border: 1px solid var(--tudctf-border);
    border-radius: 10px;
    transition:
        transform 140ms ease,
        border-color 140ms ease,
        background-color 140ms ease;
}

a.tudctf-infrastructure-service:hover {
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
    background: rgb(255 255 255 / 7%);
    border-color: color-mix(in srgb, var(--tudctf-primary) 70%, transparent);
}

a.tudctf-infrastructure-service:focus-visible {
    outline: 2px solid var(--tudctf-primary);
    outline-offset: 2px;
}

.tudctf-infrastructure-service.is-disabled {
    color: rgb(255 255 255 / 62%);
}

.tudctf-infrastructure-service.is-disabled .tudctf-infrastructure-service-copy {
    opacity: 0.62;
}

.tudctf-infrastructure-service.is-disabled .tudctf-infrastructure-service-arrow {
    display: none;
}

.tudctf-infrastructure-service-icon {
    display: grid;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    color: #fff;
    font-weight: 700;
    background: #5746d6;
    border-radius: 9px;
    overflow: hidden;
}

.tudctf-infrastructure-service-icon.is-argocd {
    background: #ef7b4d;
}

.tudctf-infrastructure-service-icon.is-rancher {
    background: #2453ff;
}

.tudctf-infrastructure-service-icon.is-ctfd {
    background: #c43c4b;
}

.tudctf-infrastructure-service-icon.has-image {
    background: rgb(255 255 255 / 96%);
}

.tudctf-infrastructure-service-icon.has-image .tudctf-infrastructure-service-icon-fallback {
    display: none;
}

.tudctf-infrastructure-service-icon img {
    width: 1.8rem;
    height: 1.8rem;
    object-fit: contain;
}

.tudctf-infrastructure-service-copy {
    display: grid;
    min-width: 0;
    gap: 0.15rem;
}

.tudctf-infrastructure-service-copy strong,
.tudctf-infrastructure-service-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tudctf-infrastructure-service-copy strong {
    font-size: 0.9rem;
}

.tudctf-infrastructure-service-copy span {
    color: rgb(255 255 255 / 55%);
    font-size: 0.72rem;
}

.tudctf-infrastructure-service-arrow {
    color: rgb(255 255 255 / 48%);
    font-size: 1rem;
}

/* Previous card-based concept, retained temporarily for comparison. */
.tudctf-infrastructure--previous {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.tudctf-infrastructure--previous .tudctf-infrastructure-card {
    display: block;
    padding: 0;
    overflow: hidden;
    background:
        linear-gradient(
            180deg,
            color-mix(in srgb, var(--tudctf-environment-color) 13%, transparent),
            transparent 6rem
        ),
        var(--tudctf-surface-soft);
    border: 1px solid var(--tudctf-border);
    border-radius: 14px;
}

.tudctf-infrastructure--previous .tudctf-infrastructure-card-header {
    min-height: 8.25rem;
    padding: 1.25rem;
    border-bottom: 1px solid var(--tudctf-border);
}

.tudctf-infrastructure--previous .tudctf-infrastructure-card-title {
    display: block;
}

.tudctf-infrastructure--previous .tudctf-infrastructure-environment-dot {
    display: none;
}

.tudctf-infrastructure--previous .tudctf-infrastructure-environment {
    display: inline-flex;
    align-items: center;
    min-height: 1.75rem;
    padding-inline: 0.7rem;
    color: var(--tudctf-environment-color);
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgb(0 0 0 / 20%);
    border: 1px solid color-mix(in srgb, var(--tudctf-environment-color) 42%, transparent);
    border-radius: 999px;
}

.tudctf-infrastructure--previous .tudctf-infrastructure-card-header p {
    max-width: none;
    margin: 0.75rem 0 0;
    font-size: 0.86rem;
    line-height: 1.5;
}

.tudctf-infrastructure--previous .tudctf-infrastructure-services {
    grid-template-columns: 1fr;
    gap: 0.65rem;
    padding: 0.85rem;
}

.tudctf-infrastructure--previous .tudctf-infrastructure-service {
    min-height: auto;
    padding: 0.75rem;
    background: rgb(14 15 18 / 34%);
    border-color: transparent;
}

@media (prefers-reduced-motion: reduce) {
    .tudctf-launcher-card,
    .tudctf-infrastructure-service {
        transition: none;
    }

    .tudctf-launcher-card:hover,
    a.tudctf-infrastructure-service:hover {
        transform: none;
    }
}

@media (max-width: 1050px) {
    .tudctf-infrastructure-card {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .tudctf-infrastructure-card-header {
        padding-inline-start: 0;
    }

    .tudctf-infrastructure-card-header p {
        max-width: none;
    }

    .tudctf-infrastructure--previous {
        grid-template-columns: 1fr;
    }

    .tudctf-infrastructure--previous .tudctf-infrastructure-card-header {
        min-height: 0;
        padding: 1.25rem;
    }
}

@media (max-width: 767px) {
    .pf-v5-c-page {
        padding: 0.625rem;
        gap: 0.625rem;
    }

    .pf-v5-c-masthead,
    .pf-v5-c-page__sidebar,
    .pf-v5-c-page__main > .pf-v5-c-page__main-section:not(:first-child) {
        border-radius: 10px;
    }

    .pf-v5-c-page__sidebar {
        position: static;
        height: calc(100% - 0.625rem);
        margin-bottom: 0.625rem;
    }

    .pf-v5-c-page__main > .pf-v5-c-page__main-section {
        width: calc(100% - 0.5rem);
        margin-inline: auto;
    }

    .pf-v5-c-page__main > .pf-v5-c-page__main-section:not(:first-child) {
        padding: 1.25rem;
    }

    .tudctf-launcher {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tudctf-launcher-card {
        min-height: 8.75rem;
    }

    .tudctf-infrastructure-card {
        padding-block: 1rem;
    }

    .tudctf-infrastructure-services {
        grid-template-columns: 1fr;
    }

    .tudctf-infrastructure--previous .tudctf-infrastructure-services {
        padding: 0.75rem;
    }
}

