@font-face {
    font-family: "Mojangles";
    src: url("/assets/fonts/mojangles.ttf");
}

/* ── Variables ── */
:root {
    --mc-primary: #B533D6;
    --mc-primary-2: #9311B4;
    --mc-dark: #111;
    --mc-surface: #1c1c1e;
    --mc-card: #222;
    --mc-border: #2c2c2e;
    --mc-text: #e5e5ea;
    --mc-muted: #636366;
    --mc-green: #4caf50;
    --mc-warning: #ffa726;
    --mc-danger: #ef5350;
    --topbar-h: 56px;
    --bottomnav-h: 80px;
    --sidebar-w: 230px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    background: var(--mc-dark);
    color: var(--mc-text);
    font-family: "Mojangles", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overscroll-behavior: none;
}

/* ════════════════════════════════
       GLOBALS
    ════════════════════════════════ */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-success,
.btn-warning,
.btn-info {
    border: none;
}

.btn,
.form-control,
.input-group,
.input-group-text {
    border-radius: 0px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn {
    padding: 6px 10px;
}

.btn-mc {
    border-bottom: 4px solid var(--mc-primary-2);
}

.text-success {
    color: #99CC99 !important;
}

/* ════════════════════════════════
       TOPBAR
    ════════════════════════════════ */
#topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: var(--topbar-h);
    background: rgba(17, 17, 17, .92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--mc-border);
    display: flex;
    align-items: center;
    padding-right: 1rem;
    gap: .75rem;
    background-image: url("/assets/images/logo-bg.svg");
    background-size: cover;
    background-repeat: no-repeat;
}

body[data-window-controls-overlay-visible="true"] #topbar {
    padding-right: calc(100% - env(titlebar-area-width, 100%));
    height: calc(env(titlebar-area-height) + 1px);
    -webkit-app-region: drag;
}

body[data-window-controls-overlay-visible="true"] #topbar .btn {
    padding: 0px 10px !important;
    border: none !important;
    background-color: transparent !important;
    min-height: 32px !important;
    height: 100%;
    -webkit-app-region: no-drag !important;
}

body[data-window-controls-overlay-visible="true"] #main {
    padding-top: calc(var(--topbar-h) + env(titlebar-area-height, 0px));
}

@media (min-width: 768px) {
    #topbar {
        left: var(--sidebar-w);
        padding: 0 1rem;
        background-image: none;
    }
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: normal;
    font-size: 1rem;
    font-family: "Mojangles";
    line-height: 1.0;
    color: var(--mc-primary);
    text-shadow: 3px 3px 1px #453a6f;
}

.topbar-brand img {
    width: auto;
    height: calc(var(--topbar-h) - 16px - 1px);
    margin-left: 15px;
}

#page-title {
    font-size: 1rem;
    font-weight: normal; /* 600 */
    margin: 0;
    flex: 1;
}

.status-chip {
    display: flex;
    align-items: center;
    gap: .35rem;
    background: var(--mc-card);
    border: 1px solid var(--mc-border);
    border-radius: 20px;
    padding: .25rem .65rem;
    font-size: .75rem;
    color: var(--mc-muted);
}

.dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background .3s;
}

.dot.online {
    background: #22CC22;
    box-shadow: 0 0 5px #22CC22;
    margin-top: -2px;
}

.dot.offline {
    background: #f44336;
}

/* ════════════════════════════════
       SIDEBAR (desktop only)
    ════════════════════════════════ */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: #0a0a0a;
    border-right: 1px solid var(--mc-border);
    display: none;
    flex-direction: column;
    z-index: 300;
    overflow-y: auto;
}

#sidebar svg {
    width: auto;
    height: 1.5em;
}

@media (min-width: 768px) {
    #sidebar {
        display: flex;
    }
}

.sidebar-brand {
    padding-right: 1rem;
    height: var(--topbar-h);
    border-bottom: 1px solid var(--mc-border);
    display: flex;
    align-items: center;
    gap: .6rem;
    background-image: url("/assets/images/logo-bg.svg");
    background-size: cover;
    background-repeat: no-repeat;
}

.sidebar-brand img {
    width: auto;
    height: calc(var(--topbar-h) - 16px - 1px);
    margin-left: 15px;
}

.sidebar-brand .brand-text {
    font-weight: normal;
    font-size: 20px;
    font-family: "Mojangles";
    color: var(--mc-primary);
    line-height: 20px;
    margin-top: 7px;
    margin-left: 7px;
    text-shadow: 3px 3px 1px #453a6f;
}

.sidebar-brand .brand-sub {
    font-size: .68rem;
    color: var(--mc-muted);
    font-weight: 400;
}

#sidebar nav {
    padding: .5rem 0;
}

#sidebar nav a {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .65rem 1.1rem;
    color: #888;
    text-decoration: none;
    font-size: .88rem;
    border-left: 3px solid transparent;
    transition: all .15s;
    user-select: none;
}

#sidebar nav a:hover {
    color: #ddd;
    background: rgba(255, 255, 255, .04);
}

#sidebar nav a.active {
    color: var(--mc-primary);
    border-left-color: var(--mc-primary);
    background: rgba(76, 175, 80, .07);
}

#sidebar nav a i {
    font-size: 1.05rem;
    width: 18px;
    text-align: center;
}

#sidebar nav .nav-section {
    font-size: .65rem;
    color: var(--mc-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: .9rem 1.1rem .3rem;
    font-weight: normal; /* 600 */
}

.sidebar-footer {
    margin-top: auto;
    padding: .75rem 1rem;
    border-top: 1px solid var(--mc-border);
    font-size: .75rem;
    color: var(--mc-muted);
}

.sidebar-footer .srv-name {
    color: #aaa;
    font-weight: normal; /* 600 */
    font-size: .8rem;
}

/* ════════════════════════════════
       MAIN CONTENT
    ════════════════════════════════ */
#main {
    padding-top: var(--topbar-h);
    padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
    min-height: 100vh;
}

@media (min-width: 768px) {
    #main {
        margin-left: var(--sidebar-w);
        padding-bottom: 1.5rem;
    }
}

.content-pad {
    padding: 1rem;
}

@media (min-width: 768px) {
    .content-pad {
        padding: 1.5rem;
    }
}

/* ════════════════════════════════
       PAGES
    ════════════════════════════════ */
.page {
    display: none;
    height: 100%;
}

.page.active {
    display: block;
}

/* ════════════════════════════════
       BOTTOM NAV (mobile only)
    ════════════════════════════════ */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
    background: rgba(17, 17, 17, .96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--mc-border);
    display: flex;
    align-items: flex-start;
    padding: .3rem 0;
    z-index: 200;
}

@media (min-width: 768px) {
    #bottom-nav {
        display: none;
    }
}

.bn-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
    padding: .3rem .25rem 0;
    background: none;
    border: none;
    color: var(--mc-muted);
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: .01em;
    transition: color .15s;
    cursor: pointer;
    min-height: 44px;
}

.bn-btn i {
    font-size: 1.35rem;
    display: block;
}

.bn-btn.active {
    color: var(--mc-primary);
}

.bn-btn:active {
    opacity: .7;
}

/* ════════════════════════════════
       CARDS
    ════════════════════════════════ */
.mc-card {
    background: var(--mc-card);
    border: 1px solid var(--mc-border);
    /* border-radius: .875rem; */
    border-radius: 0px;
}

.mc-card-pad {
    padding: 1rem 1.1rem;
}

.card-label {
    font-size: .7rem;
    color: var(--mc-muted);
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: normal; /* 600 */
    margin-bottom: .75rem;
}

/* Stat cards */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    padding: 1rem;
    text-align: center;
}

.stat-val {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: #99CC99;
}

.stat-val.muted {
    color: #555;
}

.stat-val.danger {
    color: #ef5350;
}

.stat-lbl {
    font-size: .72rem;
    color: var(--mc-muted);
    margin-top: .3rem;
}

/* ════════════════════════════════
       PLAYER ITEMS (card list)
    ════════════════════════════════ */
.player-item {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--mc-border);
    transition: background .1s;
}

.player-item:last-child {
    border-bottom: none;
}

.player-item:active {
    background: rgba(255, 255, 255, .03);
}

.mc-avatar {
    width: 40px;
    height: 40px;
    /* border-radius: 6px; */
    border-radius: 0px;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.mc-avatar-sm {
    width: 30px;
    height: 30px;
    /* border-radius: 4px; */
    border-radius: 0px;
    image-rendering: pixelated;
}

.player-name {
    font-weight: normal; /* 600 */
    font-size: .93rem;
    color: var(--mc-text);
}

.player-meta {
    font-size: .73rem;
    color: var(--mc-muted);
}

.player-actions {
    margin-left: auto;
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-shrink: 0;
}

/* ════════════════════════════════
       BUTTONS
    ════════════════════════════════ */
.btn-mc {
    background: var(--mc-primary);
    border: 1px solid var(--mc-primary-2);
    border-bottom: 4px solid var(--mc-primary-2);
    color: #fff;
    font-weight: normal;
}

.btn-mc:hover {
    background-color: var(--mc-primary) !important;
    outline: 2px solid var(--mc-text) !important;
    border-bottom: 4px solid var(--mc-primary-2);
}

.btn-mc:active {
    border-bottom-width: 1px;
    border-color: var(--mc-primary-2) !important;
    background-color: var(--mc-primary) !important;
    margin-top: 3px;
}

.btn-mc:active:not(.input-group .btn-mc) {
    transform: translateY(3px);
    margin-top: 0;
}

.btn-primary {
    background-color: #0d6efd10;
    border: 1px solid #0a58ca;
    border-bottom: 4px solid #0a58ca;
    color: #fff;
    font-weight: normal; /* 600 */
}

.btn-primary:hover {
    background-color: #0d6efd !important;
    outline: 2px solid var(--mc-text) !important;
    border-bottom: 4px solid #0a58ca;
}

.btn-primary:active,
.btn-primary.active {
    border-bottom-width: 1px;
    border-color: #0a58ca !important;
    background-color: #0d6efd !important;
    margin-top: 3px;
}

.btn-primary:active:not(.input-group .btn-primary) {
    transform: translateY(3px);
    margin-top: 0;
}

.btn-secondary {
    background: #6c757d10;
    border: 1px solid #565e64;
    border-bottom: 4px solid #565e64;
    color: #fff;
    font-weight: normal; /* 600 */
}

.btn-secondary:hover {
    background-color: #6c757d !important;
    outline: 2px solid var(--mc-text) !important;
    border-bottom: 4px solid #565e64;
}

.btn-secondary:active {
    border-bottom-width: 1px;
    border-color: #565e64 !important;
    background-color: #6c757d !important;
    margin-top: 3px;
}

.btn-secondary:active:not(.input-group .btn-secondary) {
    transform: translateY(3px);
    margin-top: 0;
}

.btn-success {
    background: #19875410;
    border: 1px solid #146c43;
    border-bottom: 4px solid #146c43;
    color: #fff;
    font-weight: normal; /* 600 */
}

.btn-success:hover {
    background-color: #198754 !important;
    outline: 2px solid var(--mc-text) !important;
    border-bottom: 4px solid #146c43;
}

.btn-success:active {
    border-bottom-width: 1px;
    border-color: #146c43 !important;
    background-color: #198754 !important;
    margin-top: 3px;
}

.btn-success:active:not(.input-group .btn-success) {
    transform: translateY(3px);
    margin-top: 0;
}

.btn-danger {
    background: #dc354510;
    border: 1px solid #b02a37;
    border-bottom: 4px solid #b02a37;
    color: #fff;
    font-weight: normal; /* 600 */
}

.btn-danger:hover {
    background-color: #dc3545 !important;
    outline: 2px solid var(--mc-text) !important;
    border-bottom: 4px solid #b02a37;
}

.btn-danger:active {
    border-bottom-width: 1px;
    border-color: #b02a37 !important;
    background-color: #dc3545 !important;
    margin-top: 3px;
}

.btn-danger:active:not(.input-group .btn-danger) {
    transform: translateY(3px);
    margin-top: 0;
}

.btn-warning {
    background: #ffc10710;
    border: 1px solid #cc9a06;
    border-bottom: 4px solid #cc9a06;
    font-weight: normal; /* 600 */
    color: var(--mc-text);
}

.btn-warning:hover {
    color: #000;
    background-color: #ffc107 !important;
    outline: 2px solid var(--mc-text) !important;
    border-bottom: 4px solid #cc9a06;
}

.btn-warning:active {
    border-bottom-width: 1px;
    border-color: #cc9a06 !important;
    background-color: #ffc107 !important;
    margin-top: 3px;
}

.btn-warning:active:not(.input-group .btn-warning) {
    transform: translateY(3px);
    margin-top: 0;
}

.btn-info {
    background: #0dcaf010;
    border: 1px solid #0aa2c0;
    border-bottom: 4px solid #0aa2c0;
    font-weight: normal; /* 600 */
    color: var(--mc-text);
}

.btn-info:hover {
    color: #000;
    background-color: #0dcaf0 !important;
    outline: 2px solid var(--mc-text) !important;
    border-bottom: 4px solid #0aa2c0;
}

.btn-info:active {
    border-bottom-width: 1px;
    border-color: #0aa2c0 !important;
    background-color: #0dcaf0 !important;
    margin-top: 3px;
}

.btn-info:active:not(.input-group .btn-info) {
    transform: translateY(3px);
    margin-top: 0;
}

.btn.no-bg {
    /* background-color: transparent; */
    /* border-color: transparent; */
    outline: none !important;
    /* color: var(--mc-text); */

    &:not(:hover, :active) {
        color: var(--mc-text) !important;
    }
}

.btn,
.form-control,
.form-select {
    min-height: 44px;
}

.btn-sm {
    min-height: 36px;
}

.btn-xs {
    min-height: 32px;
    padding: .2rem .5rem;
    font-size: .8rem;
}

/* ════════════════════════════════
       FORMS
    ════════════════════════════════ */
.form-control,
.form-select {
    background: #1a1a1c;
    border-color: var(--mc-border);
    color: var(--mc-text);
    font-size: 1rem;
}

.form-control:focus,
.form-select:focus {
    background: #1e1e20;
    border-color: var(--mc-primary);
    color: var(--mc-text);
    box-shadow: 0 0 0 .15rem rgba(76, 175, 80, .2);
}

.form-control::placeholder {
    color: #555;
}

/* ════════════════════════════════
       SEGMENT CONTROL
    ════════════════════════════════ */
.segment-control {
    display: flex;
    background: #1a1a1c;
    border: 1px solid var(--mc-border);
    /* border-radius: .6rem; */
    border-radius: 0px;
    padding: .2rem;
    gap: .2rem;
}

.segment-control .seg-btn {
    flex: 1;
    padding: .4rem .6rem;
    background: none;
    border: none;
    /* border-radius: .4rem; */
    border-radius: 0px;
    color: var(--mc-muted);
    font-size: .8rem;
    font-weight: 500;
    transition: all .15s;
    cursor: pointer;
    min-height: auto;
}

.segment-control .seg-btn.active {
    background: var(--mc-primary);
    color: #fff;
}

/* ════════════════════════════════
       SECTION PILLS (time/weather/diff)
    ════════════════════════════════ */
.pill-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
}

.pill-grid.cols2 {
    grid-template-columns: repeat(2, 1fr);
}

.pill-grid .btn {
    min-height: 48px;
    font-size: .85rem;
}

.pill-grid .btn.active {
    outline: 2px solid #fff !important;
    outline-offset: -2px;
}

/* ════════════════════════════════
       BROADCAST PREVIEW
    ════════════════════════════════ */
.mc-preview {
    background: #000;
    font-family: 'Courier New', monospace;
    /* border-radius: .6rem; */
    border-radius: 0px;
    padding: .75rem 1rem;
    font-size: .9rem;
    border: 1px solid #333;
}

/* ════════════════════════════════
       CONSOLE
    ════════════════════════════════ */
#console-output {
    background: #000;
    /* border-radius: .6rem; */
    border-radius: 0px;
    padding: .85rem 1rem;
    font-family: "Mojangles", 'Courier New', monospace;
    font-size: .82rem;
    color: var(--mc-primary);
    height: 300px;
    overflow-y: auto;
    margin-bottom: .75rem;
    border: 1px solid #1a1a1a;
}

@media (min-width: 768px) {
    #console-output {
        height: 420px;
    }
}

/* ════════════════════════════════
       TOAST
    ════════════════════════════════ */
#toast-container {
    position: fixed;
    z-index: 9999;
    bottom: calc(var(--bottomnav-h) + .75rem + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: .4rem;
    align-items: center;
    pointer-events: none;
}

@media (min-width: 768px) {
    #toast-container {
        bottom: 1.5rem;
        left: auto;
        right: 1.5rem;
        transform: none;
        align-items: flex-end;
    }
}

.mc-toast {
    background: #2a2a2c;
    border: 1px solid var(--mc-border);
    /* border-radius: .65rem; */
    border-radius: 0px;
    padding: .7rem 1rem;
    font-size: .85rem;
    color: var(--mc-text);
    display: flex;
    align-items: center;
    gap: .5rem;
    animation: toastIn .2s ease;
    min-width: 240px;
    max-width: 90vw;
    pointer-events: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .5);
}

.mc-toast.success {
    border-left: 3px solid var(--mc-primary);
}

.mc-toast.error {
    border-left: 3px solid #f44336;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(.96);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ════════════════════════════════
       MOBILE OFFCANVAS MENU
    ════════════════════════════════ */

#mobileMenu {
    transition-duration: 0.15s;
    transition-timing-function: ease-out;
}

#mobileMenu .offcanvas-body a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1rem;
    color: #aaa;
    text-decoration: none;
    /* border-radius: .5rem; */
    border-radius: 0px;
    font-size: .95rem;
    min-height: 52px;
}

#mobileMenu .offcanvas-body a:hover,
#mobileMenu .offcanvas-body a.active {
    color: var(--mc-primary);
    background: rgba(76, 175, 80, .08);
}

#mobileMenu .offcanvas-body a i {
    font-size: 1.2rem;
    width: 22px;
    text-align: center;
}

/* ════════════════════════════════
       EMPTY STATE
    ════════════════════════════════ */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--mc-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: .75rem;
    display: block;
}

/* ════════════════════════════════
       MISC
    ════════════════════════════════ */
.divider {
    border-color: var(--mc-border);
}

.text-mc {
    color: var(--mc-primary);
}

.badge-online {
    background: rgba(76, 175, 80, .15);
    color: #22CC22;
    font-size: .68rem;
    padding: .2rem .5rem;
    /* border-radius: 4px; */
    border-radius: 0px;
}

.badge-banned {
    background: rgba(244, 67, 54, .12);
    color: #ef5350;
    font-size: .68rem;
    padding: .2rem .5rem;
    /* border-radius: 4px; */
    border-radius: 0px;
}

.section-gap {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ════════════════════════════════
       COMMAND PALETTE
    ════════════════════════════════ */
.icon-pick-btn {
    width: 36px;
    height: 36px;
    background: #1a1a1c;
    border: 1px solid var(--mc-border);
    border-radius: 0px;
    color: var(--mc-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: border-color .15s, color .15s;
    min-height: unset;
    padding: 0;
}

.icon-pick-btn:hover {
    border-color: var(--mc-primary);
    color: var(--mc-primary);
}

.icon-pick-btn.selected {
    border-color: var(--mc-primary);
    background: rgba(76,175,80,.12);
    color: var(--mc-primary);
}

.builder-slot {
    display: flex;
    flex-direction: column;
}

/* Member palette card */
.palette-cmd-card {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--mc-border);
    cursor: pointer;
    transition: background .12s;
}

.palette-cmd-card:last-child {
    border-bottom: none;
}

.palette-cmd-card:active {
    background: rgba(255,255,255,.03);
}

.palette-cmd-icon {
    width: 40px;
    height: 40px;
    background: rgba(76,175,80,.1);
    border-radius: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--mc-primary);
    flex-shrink: 0;
}

.palette-cmd-name {
    font-weight: normal; /* 600 */
    font-size: .93rem;
}

.palette-cmd-desc {
    font-size: .75rem;
    color: var(--mc-muted);
    margin-top: .1rem;
}

/* ════════════════════════════════
       MODALS
    ════════════════════════════════ */
.modal-dialog {
    margin: 1rem auto;
}

.modal.fade .modal-dialog {
  transform: translate(0, 50px);
  transition: transform 0.3s ease-out;
}

.modal.show .modal-dialog {
  transform: none;
}

.modal-content {
    border-radius: 0px;
}

.modal-header,
.modal-body,
.modal-footer {
    padding: 1.75rem;
}