/*
 * Admin panel theme: dark navigation with gold accents, light content area, plain cards.
 * Loaded after the compiled Enigma theme (public/build/assets/app.*.css) and overrides it.
 * The theme's --color-primary holds an invalid value, so colours are set explicitly here.
 */
:root {
    --adm-bg: #f4f5f7;
    --adm-surface: #ffffff;
    --adm-border: #e4e7ec;
    --adm-divider: #eef0f3;
    --adm-text: #1d2330;
    --adm-muted: #667085;
    --adm-nav-bg: #111318;
    --adm-nav-text: #aeb3be;
    --adm-nav-label: #6b7080;
    --adm-nav-hover: rgba(255, 255, 255, .06);
    --adm-accent: #d4a21a;
    --adm-accent-hover: #b8860b;
    --adm-accent-text: #8a6608;
    --adm-accent-soft: rgba(212, 162, 26, .16);
    --adm-btn: #1d2330;
    --adm-btn-hover: #000000;
    --adm-radius: 12px;
    --adm-topbar-h: 64px;
}

/* ---------- Page frame ---------- */
/* overflow-x: elements slide in from the right on load (intro-x animations); without this,
   phones widen the page to fit them and the menu button ends up off screen. */
html:has(.side-nav) {
    background: var(--adm-bg);
    overflow-x: hidden;
}

@media (max-width: 767px) {
    html:has(.side-nav) {
        background: var(--adm-nav-bg);
    }
}

.content {
    background: var(--adm-bg);
    color: var(--adm-text);
}

@media (min-width: 768px) {
    .content {
        padding: var(--adm-topbar-h) 28px 40px;
    }
}

@media (max-width: 767px) {
    .content {
        border-radius: 20px 20px 0 0;
        margin-top: 1rem;
        padding: 20px 16px 32px;
    }
}

.content h2.text-lg {
    font-size: 1.25rem;
    font-weight: 600;
}

/* ---------- Top bar ---------- */
/* On tablet and desktop the bar covers only the content area; the logo is at the top of the sidebar. */
@media (min-width: 768px) {
    .top-bar-boxed {
        left: 105px !important;
        height: var(--adm-topbar-h) !important;
        background: none !important;
        padding-left: 28px !important;
        padding-right: 28px !important;
    }

    .top-bar-boxed:after {
        margin: 0 !important;
        height: var(--adm-topbar-h);
        border-radius: 0;
        background-color: var(--adm-surface);
        border-bottom: 1px solid var(--adm-border);
        box-shadow: none;
    }

    .top-bar-boxed .logo {
        display: none !important;
    }

    .top-bar-boxed .breadcrumb.breadcrumb-light {
        color: var(--adm-muted);
    }

    .top-bar-boxed .breadcrumb.breadcrumb-light .breadcrumb-item.active {
        color: var(--adm-text) !important;
        font-weight: 500;
    }

    .top-bar-boxed .breadcrumb.breadcrumb-light .breadcrumb-item:not(:first-child):before {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
    }
}

@media (min-width: 1280px) {
    .top-bar-boxed {
        left: 260px !important;
    }
}

.top-bar-boxed .breadcrumb {
    margin-left: 0;
    border-left: 0;
    padding-left: 0;
}

/* Account dropdown */
#change-modal .modal-dialog {
    width: 28rem !important;
    max-width: calc(100vw - 32px);
}

/* ---------- Side navigation ---------- */
@media (min-width: 768px) {
    .side-nav {
        background: var(--adm-nav-bg);
        margin-top: 0;
        padding: 16px 12px 32px;
        height: auto;
        min-height: 100vh;
    }
}

/* Logo at the top of the sidebar, shown at its natural 3:2 shape */
.side-nav .side-nav__logo {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.side-nav .side-nav__logo img {
    width: 180px;
    height: auto;
}

@media (max-width: 1279px) {
    .side-nav .side-nav__logo img {
        width: 72px;
    }
}

.side-nav .side-menu {
    height: 42px;
    margin-bottom: 2px;
    padding-left: 12px;
    border-radius: 8px;
    color: var(--adm-nav-text);
}

.side-nav .side-menu .side-menu__title {
    margin-left: 12px;
    font-size: 14px;
}

.side-nav .side-menu .side-menu__title .side-menu__sub-icon {
    margin-right: 8px;
}

.side-nav .side-menu .side-menu__icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.75;
}

.side-nav .side-menu .side-menu__icon:before {
    display: none;
}

.side-nav>ul>li>.side-menu:hover:not(.side-menu--active):not(.side-menu--open) {
    background: var(--adm-nav-hover);
    color: #fff;
}

.side-nav>ul>li>.side-menu:hover:not(.side-menu--active):not(.side-menu--open):before {
    display: none;
}

.side-nav>ul>li>.side-menu.side-menu--open {
    color: #fff;
}

.side-nav>ul>li>.side-menu.side-menu--active {
    background: var(--adm-accent-soft);
}

.side-nav>ul>li>.side-menu.side-menu--active:before,
.side-nav>ul>li>.side-menu.side-menu--active:after {
    display: none;
}

.side-nav>ul>li>.side-menu.side-menu--active .side-menu__icon,
.side-nav>ul>li>.side-menu.side-menu--active .side-menu__title {
    color: var(--adm-accent);
    font-weight: 600;
}

/* Sub menus */
.side-nav>ul ul {
    margin: 2px 0 6px;
    padding: 4px 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .03);
}

.side-nav>ul ul:before {
    display: none;
}

.side-nav>ul ul .side-menu {
    height: 38px;
    padding-left: 20px;
}

.side-nav>ul ul li a:not(.side-menu--active) {
    color: var(--adm-nav-text);
}

.side-nav>ul ul li a:not(.side-menu--active):hover {
    color: #fff;
    background: var(--adm-nav-hover);
}

.side-nav>ul ul li a.side-menu--active .side-menu__icon,
.side-nav>ul ul li a.side-menu--active .side-menu__title {
    color: var(--adm-accent);
    font-weight: 600;
}

/* Section label, e.g. "Account" */
.side-nav .side-nav__label {
    padding: 18px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--adm-nav-label);
}

@media (max-width: 1279px) {
    .side-nav .side-nav__label {
        margin: 12px 8px 6px;
        padding: 0;
        height: 1px;
        overflow: hidden;
        font-size: 0;
        background: rgba(255, 255, 255, .08);
    }
}

/* ---------- Mobile menu ---------- */
.mobile-menu .mobile-menu-bar {
    background: var(--adm-nav-bg);
}

.mobile-menu .mobile-menu-bar__logo {
    width: 84px;
    max-width: none;
    height: 56px;
}

.mobile-menu .scrollable {
    background-color: var(--adm-nav-bg);
}

/* The close button is fixed to the right edge; keep it out of the layout while the menu is closed,
   otherwise it widens the page on phones and pushes the menu button off screen. */
.mobile-menu:not(.mobile-menu--active) .scrollable .mobile-menu-toggler {
    display: none;
}

.mobile-menu .menu {
    height: 46px;
    margin: 0 8px 2px;
    padding-left: 14px;
    padding-right: 14px;
    border-radius: 8px;
    color: var(--adm-nav-text);
}

.mobile-menu .menu.menu--active {
    background: var(--adm-accent-soft);
    color: var(--adm-accent);
    font-weight: 600;
}

.mobile-menu ul li ul {
    margin: 2px 8px 6px;
    background: rgba(255, 255, 255, .03);
}

.mobile-menu .menu__label {
    padding: 18px 22px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--adm-nav-label);
}

/* ---------- Cards ---------- */
.content .box {
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius);
    box-shadow: none;
}

.report-box:before {
    display: none;
}

/* ---------- Buttons ---------- */
.btn {
    border-radius: 8px;
    font-weight: 500;
}

.btn.shadow-md {
    box-shadow: none;
}

.btn-primary {
    background-color: var(--adm-btn);
    border-color: var(--adm-btn);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--adm-btn-hover);
    border-color: var(--adm-btn-hover);
}

.btn-outline-secondary {
    border-color: var(--adm-border);
    background: var(--adm-surface);
    color: var(--adm-text);
}

.btn-outline-secondary:hover:not(:disabled) {
    background: #f8f9fb;
}

/* ---------- Forms ---------- */
.form-label {
    font-weight: 500;
    color: var(--adm-text);
}

.form-control,
.form-select {
    border-color: var(--adm-border);
    border-radius: 8px;
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--adm-accent);
    box-shadow: 0 0 0 3px var(--adm-accent-soft);
}

.form-check-input[type=radio]:checked,
.form-check-input[type=checkbox]:checked,
.form-switch .form-check-input:checked {
    border-color: var(--adm-accent);
    background-color: var(--adm-accent);
}

input[type=file]::file-selector-button {
    margin-right: 8px;
    padding: 6px 12px;
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    background: var(--adm-surface);
    color: var(--adm-text);
    font: inherit;
    cursor: pointer;
}

input[type=file]::file-selector-button:hover {
    background: #f8f9fb;
}

/* Settings and other tabbed pages */
.nav.nav-link-tabs .nav-item .nav-link {
    color: var(--adm-muted);
}

.nav.nav-link-tabs .nav-item .nav-link.active {
    border-bottom-color: var(--adm-accent);
    color: var(--adm-text);
    font-weight: 600;
}

/* ---------- Tables ---------- */
.table-report:not(.table-report--bordered):not(.table-report--tabulator) {
    border-spacing: 0;
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius);
}

.table-report:not(.table-report--bordered):not(.table-report--tabulator) th {
    padding: 12px 14px;
    background: #f8f9fb;
    border-bottom: 1px solid var(--adm-border);
    color: var(--adm-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.table-report:not(.table-report--bordered):not(.table-report--tabulator) th:first-child {
    border-top-left-radius: var(--adm-radius);
}

.table-report:not(.table-report--bordered):not(.table-report--tabulator) th:last-child {
    border-top-right-radius: var(--adm-radius);
}

.table-report:not(.table-report--bordered):not(.table-report--tabulator) td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--adm-divider);
    border-radius: 0 !important;
    box-shadow: none;
}

.table-report:not(.table-report--bordered):not(.table-report--tabulator) tbody tr:last-child td {
    border-bottom: 0;
}

.table-report:not(.table-report--bordered):not(.table-report--tabulator) td.table-report__action:before {
    display: none;
}

.table-report img {
    box-shadow: none;
}

.pagination .page-item.active .page-link {
    background-color: var(--adm-btn);
    color: #fff;
    box-shadow: none;
}

/* ---------- Dashboard and profile components ---------- */
.adm-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 8px 0 20px;
}

@media (min-width: 768px) {
    .adm-page-head {
        margin-top: 2.5rem;
    }
}

.adm-page-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: var(--adm-text);
}

.adm-page-subtitle {
    margin-top: 4px;
    color: var(--adm-muted);
    font-size: 14px;
}

.adm-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

@media (min-width: 1024px) {
    .adm-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.adm-stat {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius);
    color: inherit;
    transition: border-color .15s;
}

.adm-stat:hover {
    border-color: var(--adm-accent);
}

.adm-stat__icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--adm-accent-soft);
    color: var(--adm-accent-text);
}

.adm-stat__icon svg {
    width: 22px;
    height: 22px;
}

.adm-stat__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.adm-stat__value {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--adm-text);
    font-variant-numeric: tabular-nums;
}

.adm-stat__label {
    margin-top: 2px;
    color: var(--adm-muted);
    font-size: 13px;
}

@media (max-width: 479px) {
    .adm-stats {
        gap: 12px;
    }

    .adm-stat {
        gap: 10px;
        padding: 14px;
    }

    .adm-stat__icon {
        width: 36px;
        height: 36px;
    }

    .adm-stat__value {
        font-size: 20px;
    }
}

.adm-split {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 16px;
}

@media (max-width: 1023px) {
    .adm-split {
        grid-template-columns: minmax(0, 1fr);
    }
}

.adm-card {
    padding: 20px;
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius);
}

.adm-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.adm-card__head:last-child {
    margin-bottom: 0;
}

.adm-card__title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--adm-text);
}

.adm-card__subtitle {
    margin-top: 2px;
    color: var(--adm-muted);
    font-size: 13px;
}

.adm-pill {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--adm-accent-soft);
    color: var(--adm-accent-text);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.adm-chart {
    position: relative;
    height: 280px;
}

.adm-link {
    color: var(--adm-accent-text);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.adm-link:hover {
    text-decoration: underline;
}

.adm-user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--adm-divider);
}

.adm-card__head+.adm-user-row {
    padding-top: 0;
    border-top: 0;
}

.adm-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--adm-divider);
}

.adm-avatar--lg {
    width: 88px;
    height: 88px;
}

.adm-user-row__main {
    flex: 1;
    min-width: 0;
}

.adm-user-row__name,
.adm-user-row__meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adm-user-row__name {
    font-weight: 600;
    color: var(--adm-text);
}

.adm-user-row__meta {
    color: var(--adm-muted);
    font-size: 12.5px;
}

.adm-user-row__date {
    color: var(--adm-muted);
    font-size: 12px;
    white-space: nowrap;
}

.adm-empty {
    color: var(--adm-muted);
}

.adm-narrow {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 760px;
}

.adm-profile-photo {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.adm-profile-photo:has(input:focus-visible) label.btn {
    outline: 2px solid var(--adm-accent);
    outline-offset: 2px;
}

.adm-hint {
    margin-top: 8px;
    color: var(--adm-muted);
    font-size: 12.5px;
}

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

@media (max-width: 639px) {
    .adm-form-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.adm-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.adm-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- Login page ---------- */
.login:before {
    background-color: var(--adm-nav-bg);
}
