/*
 * public/assets/shared/css/system.css
 * Páginas de erro/manutenção/Brevemente e avisos globais de manutenção.
 */

*,
*::before,
*::after {
    box-sizing: border-box;
}

.system-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    color: #21382a;
    background:
        radial-gradient(circle at 78% 48%, rgba(223, 238, 225, .92) 0, rgba(235, 246, 237, .56) 25%, transparent 49%),
        radial-gradient(circle at 8% 12%, rgba(232, 196, 124, .14) 0, transparent 31%),
        linear-gradient(145deg, #fbfdfb 0%, #f4f8f5 54%, #edf5ef 100%);
    font-family: var(--font-body, "Rubik", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

.system-page {
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100svh;
    overflow: hidden;
    padding: clamp(1.5rem, 4vw, 4rem);
}

.system-page::before,
.system-page::after {
    content: "";
    position: absolute;
    z-index: -1;
    border: 1px solid rgba(35, 105, 65, .075);
    border-radius: 50%;
    pointer-events: none;
}

.system-page::before {
    top: -15rem;
    right: -12rem;
    width: 39rem;
    height: 39rem;
    box-shadow:
        0 0 0 3.5rem rgba(35, 105, 65, .026),
        0 0 0 8rem rgba(35, 105, 65, .018);
}

.system-page::after {
    bottom: -20rem;
    left: -14rem;
    width: 35rem;
    height: 35rem;
    box-shadow:
        0 0 0 3rem rgba(208, 156, 67, .024),
        0 0 0 7rem rgba(208, 156, 67, .017);
}

.system-state {
    display: grid;
    grid-template-columns: minmax(19rem, .72fr) minmax(31rem, 1.28fr);
    align-items: center;
    gap: 0;
    width: min(86rem, 100%);
}

.system-state__content {
    width: 100%;
    max-width: 31rem;
    justify-self: end;
}

.system-state__brand {
    display: flex;
    align-items: center;
    min-height: 3.25rem;
    margin-bottom: 1.25rem;
}

.system-state__brand img {
    display: block;
    width: min(17.5rem, 82%);
    height: auto;
    max-height: 6.5rem;
    object-fit: contain;
    object-position: left center;
}

.system-state__kicker {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    border: 1px solid rgba(25, 113, 68, .14);
    border-radius: 999px;
    padding: .38rem .74rem;
    color: #17663e;
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 .35rem 1rem rgba(31, 74, 45, .045);
    font-size: .78rem;
    font-weight: 850;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.system-state h1 {
    margin: .9rem 0 .9rem;
    color: #163e28;
    font-family: var(--font-game, "Saira", "Rubik", sans-serif);
    font-size: clamp(2.35rem, 5.2vw, 4.75rem);
    font-weight: 780;
    letter-spacing: -.035em;
    line-height: .98;
    text-wrap: balance;
}

.system-state__message,
.system-state__secondary {
    max-width: 31rem;
    margin: 0;
    color: #405648;
    font-size: clamp(1rem, 1.45vw, 1.15rem);
    line-height: 1.72;
}

.system-state__secondary {
    margin-top: .65rem;
    color: #6a7a70;
    font-size: .94rem;
}

.system-state__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .72rem;
    margin-top: 1.7rem;
}

.system-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.85rem;
    border: 1px solid transparent;
    border-radius: .82rem;
    padding: .72rem 1.05rem;
    font: inherit;
    font-size: .93rem;
    font-weight: 780;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background-color .16s ease;
}

.system-button:hover {
    transform: translateY(-1px);
}

.system-button:focus-visible {
    outline: .2rem solid rgba(25, 113, 68, .24);
    outline-offset: .16rem;
}

.system-button--primary {
    color: #ffffff;
    background: #197144;
    box-shadow: 0 .65rem 1.4rem rgba(25, 113, 68, .18);
}

.system-button--primary:hover,
.system-button--primary:focus-visible {
    color: #ffffff;
    background: #145f38;
    box-shadow: 0 .8rem 1.6rem rgba(25, 113, 68, .23);
}

.system-button--secondary {
    border-color: rgba(25, 113, 68, .18);
    color: #1b5f3c;
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 .45rem 1.1rem rgba(31, 74, 45, .055);
}

.system-button--secondary:hover,
.system-button--secondary:focus-visible {
    border-color: rgba(25, 113, 68, .33);
    color: #174f33;
    background: #ffffff;
}

.system-button--quiet {
    min-height: auto;
    padding: .55rem .25rem;
    color: #37624a;
    background: transparent;
}

.system-button--quiet:hover,
.system-button--quiet:focus-visible {
    color: #174f33;
    text-decoration: underline;
    transform: none;
}

.system-state__visual {
    display: grid;
    place-items: center start;
    width: 100%;
    min-width: 0;
}

/*
 * As ilustrações são composições horizontais largas. Mesmo sem gap na grelha,
 * o início visual da imagem fica afastado do texto. No desktop aproximamos a
 * própria ilustração, e não apenas a respetiva coluna.
 */
@media (min-width: 901px) {
    .system-state__visual {
        transform: translateX(clamp(-6.5rem, -6vw, -4rem));
    }
}

.system-state__visual img {
    display: block;
    width: min(100%, 48.75rem);
    height: auto;
    max-height: 72vh;
    max-height: 72svh;
    object-fit: contain;
    filter: drop-shadow(0 1.35rem 1.7rem rgba(53, 79, 59, .105));
}

.system-state--maintenance,
.system-state--coming-soon {
    grid-template-columns: minmax(18rem, .66fr) minmax(34rem, 1.34fr);
}

.system-state--maintenance .system-state__visual img,
.system-state--coming-soon .system-state__visual img {
    width: min(100%, 51rem);
}

.system-state--403 .system-state__kicker {
    border-color: rgba(184, 114, 36, .18);
    color: #855716;
}

.system-state--500 .system-state__kicker {
    border-color: rgba(179, 72, 53, .17);
    color: #8a3f32;
}

@media (max-width: 900px) {
    /*
     * Em alguns PCs, escala do Windows/zoom do browser pode reduzir o viewport
     * CSS para menos de 900 px. Mantemos por defeito a composição desktop em
     * duas colunas, mas com mínimos flexíveis, para não empurrar o texto para
     * baixo da ilustração só por causa dessa escala.
     */
    .system-page {
        overflow: auto;
        padding: clamp(1rem, 2.5vw, 1.75rem);
    }

    .system-state,
    .system-state--maintenance,
    .system-state--coming-soon {
        grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr);
        gap: clamp(.35rem, 1.5vw, 1rem);
        width: min(64rem, 100%);
        padding-block: .5rem;
    }

    .system-state__content {
        max-width: 27rem;
        justify-self: end;
    }

    .system-state__brand {
        min-height: 2.75rem;
        margin-bottom: .9rem;
    }

    .system-state__brand img {
        width: min(15.5rem, 82%);
        max-height: 5.75rem;
    }

    .system-state h1 {
        font-size: clamp(2rem, 5.2vw, 3.3rem);
    }

    .system-state__message,
    .system-state__secondary {
        line-height: 1.58;
    }

    .system-state__visual {
        transform: translateX(clamp(-2.25rem, -3vw, -1rem));
        place-items: center start;
    }

    .system-state__visual img,
    .system-state--maintenance .system-state__visual img,
    .system-state--coming-soon .system-state__visual img {
        width: min(100%, 37rem);
        max-height: 76vh;
        max-height: 76svh;
    }
}

/*
 * Em touch/portrait o empilhamento continua a ser a solução correta. Em
 * dispositivos com um apontador fino (PC ou portátil, incluindo touch + rato)
 * prevalece a composição compacta de duas colunas definida acima.
 */
@media (max-width: 900px) and (pointer: coarse) {
    .system-state,
    .system-state--maintenance,
    .system-state--coming-soon {
        grid-template-columns: minmax(0, 1fr);
        gap: clamp(1.25rem, 4vw, 2.2rem);
        width: min(42rem, 100%);
        padding-block: 1rem;
    }

    .system-state__visual {
        grid-row: 1;
        transform: none;
        place-items: center;
    }

    .system-state__visual img,
    .system-state--maintenance .system-state__visual img,
    .system-state--coming-soon .system-state__visual img {
        width: min(100%, 32.5rem);
        max-height: none;
    }

    .system-state__content {
        grid-row: 2;
        max-width: 37rem;
        justify-self: center;
        text-align: center;
    }

    .system-state__brand {
        justify-content: center;
    }

    .system-state__brand img {
        width: min(14.5rem, 68%);
        max-height: 5.4rem;
        object-position: center;
    }

    .system-state__message,
    .system-state__secondary {
        margin-inline: auto;
    }

    .system-state__actions {
        justify-content: center;
    }
}

@media (min-width: 640px) and (max-width: 900px) and (any-pointer: fine) {
    .system-state,
    .system-state--maintenance,
    .system-state--coming-soon {
        grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr);
        gap: clamp(.35rem, 1.5vw, 1rem);
        width: min(64rem, 100%);
        padding-block: .5rem;
    }

    .system-state__visual {
        grid-row: auto;
        transform: translateX(clamp(-2.25rem, -3vw, -1rem));
        place-items: center start;
    }

    .system-state__content {
        grid-row: auto;
        max-width: 27rem;
        justify-self: end;
        text-align: left;
    }

    .system-state__brand {
        justify-content: flex-start;
    }

    .system-state__brand img {
        width: min(15.5rem, 82%);
        max-height: 5.75rem;
        object-position: left center;
    }

    .system-state__message,
    .system-state__secondary {
        margin-inline: 0;
    }

    .system-state__actions {
        justify-content: flex-start;
    }

    .system-state__visual img,
    .system-state--maintenance .system-state__visual img,
    .system-state--coming-soon .system-state__visual img {
        width: min(100%, 37rem);
        max-height: 76vh;
        max-height: 76svh;
    }
}

@media (max-width: 639px) {
    .system-state,
    .system-state--maintenance,
    .system-state--coming-soon {
        grid-template-columns: minmax(0, 1fr);
        gap: clamp(1.25rem, 4vw, 2.2rem);
        width: min(42rem, 100%);
        padding-block: 1rem;
    }

    .system-state__visual {
        grid-row: 1;
        transform: none;
        place-items: center;
    }

    .system-state__visual img,
    .system-state--maintenance .system-state__visual img,
    .system-state--coming-soon .system-state__visual img {
        width: min(100%, 32.5rem);
        max-height: none;
    }

    .system-state__content {
        grid-row: 2;
        max-width: 37rem;
        justify-self: center;
        text-align: center;
    }

    .system-state__brand {
        justify-content: center;
    }

    .system-state__brand img {
        width: min(14.5rem, 68%);
        max-height: 5.4rem;
        object-position: center;
    }

    .system-state__message,
    .system-state__secondary {
        margin-inline: auto;
    }

    .system-state__actions {
        justify-content: center;
    }
}

@media (max-width: 520px) {
    .system-page {
        place-items: start center;
        padding: 1rem 1rem 1.5rem;
    }

    .system-state {
        min-height: calc(100svh - 2.5rem);
        align-content: center;
    }

    .system-state__visual img,
    .system-state--maintenance .system-state__visual img,
    .system-state--coming-soon .system-state__visual img {
        width: min(100%, 28rem);
    }

    .system-state h1 {
        font-size: clamp(2.05rem, 12vw, 3.15rem);
    }

    .system-state__actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .system-button {
        width: 100%;
    }

    .system-button--quiet {
        width: auto;
        align-self: center;
    }
}

@media (min-width: 901px) and (max-height: 720px) {
    .system-page {
        padding-block: 1.5rem;
    }

    .system-state__visual img,
    .system-state--maintenance .system-state__visual img,
    .system-state--coming-soon .system-state__visual img {
        max-height: 61vh;
        max-height: 61svh;
    }

    .system-state h1 {
        font-size: clamp(2.2rem, 4.5vw, 3.9rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .system-button {
        transition: none;
    }
}

/* Avisos globais de manutenção usados nos layouts normais. */
.maintenance-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-height: 42px;
    padding: .65rem 1rem;
    text-align: center;
    font-size: .95rem;
    line-height: 1.4;
    z-index: 2000;
}

.maintenance-topbar strong {
    margin-right: .35rem;
}

.maintenance-topbar-active {
    border-bottom: 1px solid rgba(0, 0, 0, .15);
    color: #2b2100;
    background: #ffc107;
}

.maintenance-topbar-scheduled {
    border-bottom: 1px solid rgba(0, 0, 0, .12);
    color: #052c35;
    background: #0dcaf0;
}

body.has-maintenance-topbar {
    padding-top: 42px;
}

body.has-maintenance-topbar .main-sidebar {
    top: 42px;
    height: calc(100vh - 42px);
}

body.has-maintenance-topbar .main-header {
    margin-top: 0;
}

/* Pendências legais e etárias da conta. */
.account-requirements-notice {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 0 0 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(160, 112, 23, 0.28);
    border-radius: 0.75rem;
    background: #fff8e7;
    color: #4f3a11;
    box-shadow: 0 0.25rem 0.75rem rgba(44, 32, 8, 0.06);
}

.account-requirements-notice__icon {
    display: grid;
    flex: 0 0 2.25rem;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    border-radius: 50%;
    background: rgba(174, 121, 25, 0.14);
}

.account-requirements-notice__copy {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
    gap: 0.15rem;
}

.account-requirements-notice__copy span {
    font-size: 0.925rem;
}

.account-requirements-notice > a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
    font-weight: 700;
    color: inherit;
    text-decoration: none;
}

.account-requirements-notice > a:hover,
.account-requirements-notice > a:focus-visible {
    text-decoration: underline;
}

.account-requirements-card {
    max-width: 920px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid rgba(27, 59, 40, 0.12);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 0.6rem 1.5rem rgba(24, 47, 33, 0.08);
}

.account-requirements-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 1.5rem;
    background: linear-gradient(135deg, #edf7ef, #f8fbf8);
}

.account-requirements-card__header h2 {
    margin: 0.15rem 0 0.35rem;
}

.account-requirements-card__header p {
    margin: 0;
}

.account-requirements-card__header > i {
    font-size: 2rem;
    color: #2e6c43;
}

.account-requirements-card__eyebrow {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4d745a;
}

.account-requirements-status {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin: 1.25rem 1.5rem 0;
    padding: 0.9rem 1rem;
    border-radius: 0.75rem;
}

.account-requirements-status--pending {
    background: #fff8e7;
    color: #614714;
}

.account-requirements-status--restricted {
    background: #fff0f0;
    color: #7b2525;
}

.account-requirements-status--complete {
    background: #edf8f0;
    color: #245c35;
}

.account-requirements-form {
    padding: 0 1.5rem 1.5rem;
}

.account-requirements-section {
    margin: 1.25rem 0 0;
    padding: 1rem;
    border: 1px solid rgba(27, 59, 40, 0.13);
    border-radius: 0.75rem;
}

.account-requirements-section legend {
    width: auto;
    margin: 0;
    padding: 0 0.35rem;
    font-size: 1rem;
    font-weight: 800;
}

.account-requirements-date-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.account-requirements-date-grid label,
.account-requirements-check {
    display: flex;
    gap: 0.45rem;
}

.account-requirements-date-grid label {
    flex-direction: column;
    font-weight: 700;
}

.account-requirements-date-grid select {
    width: 100%;
    min-height: 2.55rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid #cbd5ce;
    border-radius: 0.45rem;
    background: #fff;
}

.account-requirements-check {
    align-items: flex-start;
    margin: 0.75rem 0;
}

.account-requirements-check input {
    margin-top: 0.25rem;
}

.account-requirements-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding: 1.25rem 1.5rem 1.5rem;
}

.account-requirements-form .account-requirements-actions {
    padding-right: 0;
    padding-bottom: 0;
    padding-left: 0;
}

@media (max-width: 680px) {
    .account-requirements-notice {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .account-requirements-notice > a {
        width: 100%;
        padding-left: 3.1rem;
    }

    .account-requirements-date-grid {
        grid-template-columns: 1fr;
    }
}


/* Valores técnicos -------------------------------------------------------- */
.checksum-value {
    display: inline-block;
    max-width: 100%;
    padding: .22rem .48rem;
    border-radius: .28rem;
    color: #ffffff !important;
    background: #111111;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: .88em;
    font-weight: 600;
    line-height: 1.45;
    overflow-wrap: anywher;
    word-break: break-word;
    white-space: normal;
}

.checksum-value--block {
    display: block;
    width: fit-content;
    margin-top: .35rem;
}

/* PWA offline ------------------------------------------------------------- */
.system-state--offline {
    grid-template-columns: minmax(19rem, .88fr) minmax(20rem, .68fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    width: min(72rem, 100%);
}

.system-state--offline .system-state__visual {
    place-items: center;
    transform: none;
}

.system-state--offline .system-state__visual img {
    width: min(100%, 24rem);
    max-height: 68vh;
    max-height: 68svh;
    aspect-ratio: 1;
    object-fit: contain;
    filter: drop-shadow(0 1rem 1.45rem rgba(53, 79, 59, .16));
}

@media (max-width: 900px) {
    .system-state--offline {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.4rem;
        width: min(38rem, 100%);
    }

    .system-state--offline .system-state__visual img {
        width: min(68vw, 16rem);
        max-height: none;
    }
}

/* Área administrativa / área do jogador — navegação coerente */

/*
 * A topbar da Área do Jogador replica a apresentação base do backoffice,
 * sem alterar os atalhos contextuais próprios de cada área.
 */
body.player-layout .main-header.player-navbar {
    border-bottom-color: #dee2e6;
    font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.player-layout .main-header.player-navbar .player-navbar-greeting {
    color: rgba(0, 0, 0, .5);
    font-weight: 400;
}

/*
 * Nos grupos abertos do backoffice mantemos a hierarquia visual usada na
 * Área do Jogador: o grupo recebe apenas um realce neutro e o item atual
 * continua a ser o elemento de maior destaque dentro do submenu.
 */
.main-sidebar.sidebar-dark-primary .nav-sidebar > .nav-item.menu-open > .nav-link.active {
    color: #ffffff;
    background-color: rgba(255, 255, 255, .09);
    box-shadow: none;
    font-weight: 700;
}

.main-sidebar.sidebar-dark-primary .nav-sidebar > .nav-item.menu-open > .nav-link.active:hover,
.main-sidebar.sidebar-dark-primary .nav-sidebar > .nav-item.menu-open > .nav-link.active:focus {
    color: #ffffff;
    background-color: rgba(255, 255, 255, .12);
}

