/*
 * SSPanel-v3-mod legacy "material" theme compatibility layer.
 *
 * Visual source: NimaQu/ss-panel-v3-mod_Uim (2018, MIT), whose original
 * material theme used Material Design 1: indigo #3f51b5, pink #ff4081,
 * 2px surfaces, underline inputs and low elevation shadows. This port restores
 * the historical app bar, temporary drawer, hero/content hierarchy and auth
 * card layout while retaining current PHP 8.3 behavior inside those surfaces.
 * See ../ORIGIN.md and ../LICENSE.
 */

:root {
    --legacy-brand: #3f51b5;
    --legacy-brand-dark: #303f9f;
    --legacy-accent: #ff4081;
    --legacy-green: #4caf50;
    --legacy-orange: #ff9800;
    --legacy-red: #f44336;
    --legacy-bg: #f5f5f5;
    --legacy-surface: #ffffff;
    --legacy-text: #212121;
    --legacy-text-secondary: rgba(0, 0, 0, .54);
    --legacy-divider: rgba(0, 0, 0, .12);
    --legacy-hover: rgba(154, 154, 154, .18);
    --legacy-shadow-card:
        0 -1px 0 #e5e5e5,
        0 0 2px rgba(0, 0, 0, .12),
        0 2px 4px rgba(0, 0, 0, .24);
    --legacy-shadow-button:
        0 1px 3px rgba(0, 0, 0, .15),
        0 1px 3px 1px rgba(0, 0, 0, .15);
    --tblr-primary: var(--legacy-brand);
    --tblr-primary-rgb: 63, 81, 181;
    --tblr-body-bg: var(--legacy-bg);
    --tblr-body-color: var(--legacy-text);
    --tblr-border-color: var(--legacy-divider);
    --tblr-font-sans-serif: Roboto, "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
}

[data-bs-theme="dark"] {
    --legacy-bg: #121212;
    --legacy-surface: #1e1e1e;
    --legacy-text: rgba(255, 255, 255, .87);
    --legacy-text-secondary: rgba(255, 255, 255, .60);
    --legacy-divider: rgba(255, 255, 255, .12);
    --legacy-hover: rgba(255, 255, 255, .12);
    --legacy-shadow-card:
        0 -1px 0 rgba(255, 255, 255, .04),
        0 0 2px rgba(0, 0, 0, .35),
        0 2px 4px rgba(0, 0, 0, .55);
    --tblr-primary: #7986cb;
    --tblr-primary-rgb: 121, 134, 203;
    --tblr-body-bg: var(--legacy-bg);
    --tblr-body-color: var(--legacy-text);
    --tblr-border-color: var(--legacy-divider);
}

body {
    background-color: var(--legacy-bg);
    background-image: none;
    color: var(--legacy-text);
    font-family: Roboto, "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--legacy-brand);
}

[data-bs-theme="dark"] a {
    color: #9fa8da;
}

.navbar {
    min-height: 56px;
    color: #fff !important;
    background: var(--legacy-brand) !important;
    border: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .28);
}

.navbar .navbar-brand,
.navbar .nav-link,
.navbar .text-reset,
.navbar .text-secondary {
    color: #fff !important;
}

.navbar .nav-link {
    min-height: 48px;
    padding-top: 14px;
    padding-bottom: 14px;
    font-weight: 500;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus,
.navbar .nav-link.show {
    color: #fff !important;
    background-color: rgba(255, 255, 255, .14);
}

.page-wrapper {
    background-image:
        linear-gradient(rgba(48, 63, 159, .32), rgba(63, 81, 181, .68)),
        url("./images/bg/brand.jpg");
    background-position: center top;
    background-repeat: no-repeat;
    background-size: 100% 212px;
}

.page-header {
    min-height: 154px;
    padding-top: 36px;
    padding-bottom: 58px;
}

.page-header .page-title,
.page-header .page-pretitle,
.page-header .home-title,
.page-header .home-subtitle {
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .22);
}

.page-header .page-title,
.home-title {
    font-weight: 300;
    letter-spacing: 0;
}

.page-wrapper > .page-body {
    margin-top: -58px;
}

.card {
    color: var(--legacy-text);
    background-color: var(--legacy-surface);
    border: 0;
    border-radius: 2px;
    box-shadow: var(--legacy-shadow-card);
}

.row-cards .card {
    margin-bottom: 24px;
}

.card-header,
.card-footer,
.card-header-light {
    min-height: 56px;
    background: transparent !important;
    border-color: var(--legacy-divider);
}

.card-title {
    color: var(--legacy-text);
    font-size: 20px;
    font-weight: 400;
    line-height: 28px;
}

.btn {
    min-height: 36px;
    padding: 8px;
    overflow: hidden;
    color: var(--legacy-text);
    background-color: var(--legacy-hover);
    background-image: none;
    border: 0;
    border-radius: 2px;
    box-shadow: var(--legacy-shadow-button);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    letter-spacing: .02em;
    text-transform: uppercase;
    transition: box-shadow .3s cubic-bezier(.4, 0, .2, 1),
                filter .3s cubic-bezier(.4, 0, .2, 1);
}

.btn:hover,
.btn:focus {
    color: var(--legacy-text);
    filter: brightness(1.04);
    box-shadow: 0 3px 9px rgba(0, 0, 0, .30);
}

.btn:active {
    box-shadow: 0 5px 12px rgba(0, 0, 0, .32);
}

.btn-primary,
.btn-teal {
    --tblr-btn-bg: var(--legacy-brand);
    --tblr-btn-border-color: var(--legacy-brand);
    --tblr-btn-hover-bg: var(--legacy-brand-dark);
    --tblr-btn-hover-border-color: var(--legacy-brand-dark);
    --tblr-btn-color: #fff;
    color: #fff !important;
    background: var(--legacy-brand) !important;
}

.btn-red,
.btn-danger {
    color: #fff !important;
    background: var(--legacy-red) !important;
}

.btn-outline-primary,
.btn-outline-secondary {
    color: var(--legacy-brand);
    background: transparent;
    border: 0;
    box-shadow: none;
}

[data-bs-theme="dark"] .btn-outline-primary,
[data-bs-theme="dark"] .btn-outline-secondary {
    color: #9fa8da;
}

.form-control,
.form-select,
.input-group-text {
    min-height: 36px;
    padding: 8px 0 7px;
    color: var(--legacy-text);
    background-color: transparent;
    border: 0;
    border-bottom: 1px solid var(--legacy-divider);
    border-radius: 0;
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    padding-bottom: 6px;
    color: var(--legacy-text);
    background-color: transparent;
    border-color: var(--legacy-accent);
    border-bottom-width: 2px;
    box-shadow: none;
}

.form-control[readonly],
.form-control:disabled,
.form-select:disabled {
    color: var(--legacy-text-secondary);
    background-color: transparent;
    border-style: dashed;
    opacity: 1;
}

textarea.form-control {
    min-height: 72px;
    padding: 8px;
    border: 1px solid var(--legacy-divider);
}

textarea.form-control:focus {
    padding: 7px;
    border: 2px solid var(--legacy-accent);
}

.form-label,
.form-hint,
.text-secondary,
.page-pretitle {
    color: var(--legacy-text-secondary) !important;
}

.form-check-input {
    border-color: var(--legacy-text-secondary);
}

.form-check-input:checked {
    background-color: var(--legacy-accent);
    border-color: var(--legacy-accent);
}

.dropdown-menu,
.modal-content {
    color: var(--legacy-text);
    background-color: var(--legacy-surface);
    border: 0;
    border-radius: 2px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, .28);
}

.dropdown-item {
    min-height: 40px;
    padding-top: 10px;
    padding-bottom: 10px;
    color: var(--legacy-text);
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: var(--legacy-text);
    background-color: var(--legacy-hover);
}

.table {
    --tblr-table-color: var(--legacy-text);
    --tblr-table-border-color: var(--legacy-divider);
    --tblr-table-hover-bg: var(--legacy-hover);
    color: var(--legacy-text);
}

.table > :not(caption) > * > * {
    padding-top: 12px;
    padding-bottom: 12px;
}

.badge {
    border-radius: 2px;
    font-weight: 500;
}

.pagination .page-link {
    color: var(--legacy-text);
    background: transparent;
    border: 0;
    border-radius: 2px !important;
}

.pagination .active > .page-link,
.pagination .page-link:hover {
    color: #fff;
    background: var(--legacy-brand);
}

.alert {
    border: 0;
    border-radius: 2px;
}

.hr-text::before,
.hr-text::after {
    border-color: var(--legacy-divider);
}

.jsoneditor {
    border-color: var(--legacy-divider) !important;
    border-radius: 2px;
}

.footer {
    color: var(--legacy-text-secondary);
    background: color-mix(in srgb, var(--legacy-surface) 82%, transparent);
    border-top-color: var(--legacy-divider);
}

/*
 * Legacy SSPanel material shell
 *
 * The original theme used a Material Design 1 application bar and a temporary
 * navigation drawer. These rules define the page skeleton, not only its palette.
 */
.legacy-layout {
    min-height: 100vh;
}

.legacy-shell {
    display: flex;
    min-width: 0;
    min-height: 100vh;
    flex-direction: column;
}

.legacy-shell > .page-wrapper {
    flex: 1 0 auto;
}

.legacy-topbar {
    position: sticky;
    z-index: 1020;
    top: 0;
    display: flex;
    width: 100%;
    height: 56px;
    min-height: 56px;
    padding: 0 12px;
    align-items: center;
    color: #fff;
    background: var(--legacy-brand);
    box-shadow: 0 2px 5px rgba(0, 0, 0, .26);
}

.legacy-icon-button {
    display: inline-flex;
    width: 48px;
    height: 48px;
    padding: 0;
    align-items: center;
    justify-content: center;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 50%;
}

.legacy-icon-button:hover,
.legacy-icon-button:focus-visible {
    color: inherit;
    background: rgba(255, 255, 255, .14);
}

.legacy-icon-button .ti {
    font-size: 25px;
}

.legacy-topbar-title {
    overflow: hidden;
    margin-left: 12px;
    color: #fff;
    font-size: 20px;
    font-weight: 500;
    line-height: 56px;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.legacy-topbar-title:hover {
    color: #fff;
    text-decoration: none;
}

.legacy-topbar-spacer {
    min-width: 16px;
    flex: 1 1 auto;
}

.legacy-account {
    display: flex;
    height: 48px;
    padding: 0 8px;
    align-items: center;
    gap: 10px;
    color: #fff;
    background: transparent;
    border: 0;
    border-radius: 2px;
}

.legacy-account:hover,
.legacy-account:focus-visible,
.legacy-account.show {
    color: #fff;
    background: rgba(255, 255, 255, .14);
}

.legacy-account::after {
    margin-left: 0;
}

.legacy-account .avatar {
    border: 2px solid rgba(255, 255, 255, .72);
}

.legacy-drawer {
    position: fixed;
    z-index: 1045;
    top: 0;
    bottom: 0;
    left: 0;
    overflow-x: hidden;
    overflow-y: auto;
    width: 280px;
    max-width: calc(100vw - 48px);
    color: var(--legacy-text);
    background: var(--legacy-surface);
    box-shadow: 3px 0 10px rgba(0, 0, 0, .28);
    transform: translateX(-105%);
    transition: transform 220ms cubic-bezier(.4, 0, .2, 1);
}

.legacy-drawer-open .legacy-drawer {
    transform: translateX(0);
}

.legacy-drawer-brand {
    display: flex;
    height: 64px;
    padding: 0 20px;
    align-items: center;
    gap: 16px;
    color: var(--legacy-text);
    font-size: 20px;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid var(--legacy-divider);
}

.legacy-drawer-brand:hover {
    color: var(--legacy-text);
    background: var(--legacy-hover);
    text-decoration: none;
}

.legacy-drawer-brand img {
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}

.legacy-drawer-nav {
    padding: 8px 0 24px;
}

.legacy-nav-heading {
    padding: 18px 24px 7px;
    color: var(--legacy-text-secondary);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.legacy-nav-item {
    display: flex;
    min-height: 48px;
    padding: 0 24px;
    align-items: center;
    gap: 24px;
    color: var(--legacy-text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.legacy-nav-item .ti {
    width: 24px;
    color: var(--legacy-text-secondary);
    font-size: 23px;
    text-align: center;
}

.legacy-nav-item:hover {
    color: var(--legacy-text);
    background: var(--legacy-hover);
    text-decoration: none;
}

.legacy-nav-item.active {
    color: var(--legacy-brand);
    background: color-mix(in srgb, var(--legacy-brand) 12%, transparent);
}

.legacy-nav-item.active .ti {
    color: var(--legacy-brand);
}

.legacy-drawer-backdrop {
    position: fixed;
    z-index: 1040;
    inset: 0;
    display: block;
    visibility: hidden;
    padding: 0;
    background: rgba(0, 0, 0, .52);
    border: 0;
    opacity: 0;
    transition:
        opacity 220ms cubic-bezier(.4, 0, .2, 1),
        visibility 220ms;
}

.legacy-drawer-open {
    overflow: hidden;
}

.legacy-drawer-open .legacy-drawer-backdrop {
    visibility: visible;
    opacity: 1;
}

.legacy-material .page-wrapper {
    min-height: auto;
}

.legacy-material .page-header .page-title {
    color: #fff;
}

.legacy-material .page-header .text-secondary {
    color: rgba(255, 255, 255, .78) !important;
}

.legacy-material .page-header .breadcrumb,
.legacy-material .page-header .breadcrumb a {
    color: rgba(255, 255, 255, .86);
}

.legacy-material .page-header .btn:not(.btn-primary):not(.btn-danger):not(.btn-warning):not(.btn-success) {
    color: #fff;
    background: rgba(255, 255, 255, .12);
}

.legacy-theme-credit {
    margin-left: 8px;
    color: inherit;
}

.legacy-auth-body {
    min-height: 100vh;
    background:
        linear-gradient(rgba(48, 63, 159, .48), rgba(63, 81, 181, .72)),
        url("./images/bg/brand.jpg") center / cover fixed;
}

.legacy-auth-page {
    display: flex;
    min-height: 100vh;
    padding: 48px 18px;
    align-items: center;
    justify-content: center;
}

.legacy-auth-wrap {
    width: 100%;
    max-width: 420px;
}

.legacy-auth-wrap--wide {
    max-width: 620px;
}

.legacy-tos-wrap {
    max-width: 760px;
}

.legacy-tos-content {
    font-size: 15px;
    line-height: 1.8;
}

.legacy-tos-heading {
    padding-bottom: 26px;
    text-align: center;
    border-bottom: 1px solid var(--legacy-divider);
}

.legacy-tos-kicker {
    display: block;
    margin-bottom: 8px;
    color: var(--legacy-brand);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .24em;
}

.legacy-tos-heading .legacy-auth-title {
    margin-bottom: 0;
}

.legacy-tos-description {
    max-width: 560px;
    margin: 12px auto 0;
    color: var(--legacy-text-secondary);
    line-height: 1.6;
}

.legacy-tos-document {
    padding: 28px 0 8px;
    overflow-wrap: anywhere;
}

.public-tos-document h2 {
    margin: 2rem 0 .75rem;
    color: var(--legacy-text);
    font-size: 18px;
    font-weight: 500;
}

.public-tos-document section:first-of-type h2 {
    margin-top: 1.25rem;
}

.public-tos-custom {
    overflow-wrap: anywhere;
    white-space: normal;
}

.legacy-tos-actions {
    display: flex;
    padding-top: 24px;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--legacy-divider);
}

.legacy-auth-card {
    overflow: visible;
    color: var(--legacy-text);
    background: var(--legacy-surface);
    border-radius: 2px;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, .24),
        0 8px 18px rgba(0, 0, 0, .18);
}

.legacy-auth-top {
    display: grid;
    height: 72px;
    grid-template-columns: 1fr 96px 1fr;
    align-items: center;
    border-bottom: 1px solid var(--legacy-divider);
}

.legacy-auth-logo {
    position: relative;
    z-index: 1;
    display: flex;
    width: 82px;
    height: 82px;
    margin: -32px auto 0;
    align-items: center;
    justify-content: center;
    background: var(--legacy-surface);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .34);
}

.legacy-auth-logo img {
    width: 64px;
    height: 64px;
}

.legacy-auth-tab {
    display: flex;
    height: 72px;
    align-items: center;
    justify-content: center;
    color: var(--legacy-brand);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: .12em;
    text-decoration: none;
}

.legacy-auth-tab:hover {
    color: var(--legacy-brand);
    background: var(--legacy-hover);
    text-decoration: none;
}

.legacy-auth-form {
    padding: 34px 38px 30px;
}

.legacy-auth-title {
    margin: 0 0 28px;
    color: var(--legacy-text);
    font-size: 22px;
    font-weight: 400;
    text-align: center;
}

.legacy-auth-fields {
    display: grid;
    gap: 18px;
}

.legacy-auth-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 24px;
}

.legacy-auth-actions {
    display: flex;
    margin-top: 26px;
    flex-direction: column;
    gap: 12px;
}

.legacy-auth-help {
    display: flex;
    margin-top: 18px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 13px;
}

.legacy-auth-help .form-check {
    margin: 0;
}

.legacy-auth-caption {
    margin-top: 18px;
    color: #fff;
    font-size: 14px;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

.legacy-auth-caption a {
    color: #fff;
    font-weight: 500;
    text-decoration: underline;
}

.page-center {
    position: relative;
    background-image:
        linear-gradient(rgba(48, 63, 159, .50), rgba(63, 81, 181, .72)),
        url("./images/bg/brand.jpg");
    background-position: center;
    background-size: cover;
}

.page-center .card {
    max-width: 390px;
    margin-right: auto;
    margin-left: auto;
}

.page-center .navbar-brand img {
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0, 0, 0, .38);
}

.page-center > .container-tight > .text-secondary {
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .32);
}

.page-center > .container-tight > .text-secondary a {
    color: #fff;
    text-decoration: underline;
}

@media (max-width: 767.98px) {
    .legacy-account-name {
        display: none;
    }

    .legacy-auth-page {
        padding: 42px 14px 24px;
        align-items: flex-start;
    }

    .legacy-auth-form {
        padding: 30px 24px 26px;
    }

    .legacy-auth-grid {
        grid-template-columns: 1fr;
    }

    .legacy-tos-wrap {
        max-width: 100%;
    }

    .legacy-tos-content {
        padding-right: 22px;
        padding-left: 22px;
    }

    .legacy-tos-actions {
        flex-direction: column-reverse;
    }

    .legacy-tos-actions .btn {
        width: 100%;
    }

    .page-wrapper {
        background-size: auto 184px;
    }

    .page-header {
        min-height: 126px;
        padding-top: 24px;
        padding-bottom: 42px;
    }

    .page-wrapper > .page-body {
        margin-top: -42px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}
