/* ── MeshDD-Bot – Tabler-enhanced layout ──────────────────────── */

/* ── Top Navbar ──────────────────────────────────────────────── */

.top-navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 48px;
    z-index: 1030;
    background: var(--tblr-bg-surface, var(--bs-body-bg));
    border-bottom: 1px solid var(--tblr-border-color, var(--bs-border-color));
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
    font-size: .875rem;
    letter-spacing: .01em;
}

/* ── Sidebar ─────────────────────────────────────────────────── */

.sidebar {
    position: fixed;
    top: 48px; left: 0; bottom: 0;
    width: 210px;
    z-index: 1020;
    overflow-y: auto;
    background: var(--tblr-bg-surface, var(--bs-body-bg));
    border-right: 1px solid var(--tblr-border-color, var(--bs-border-color));
    transition: transform 0.22s cubic-bezier(.4, 0, .2, 1);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: .625rem .5rem;
    gap: .125rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .45rem .75rem;
    color: var(--tblr-muted, var(--bs-secondary-color));
    text-decoration: none;
    font-size: .8125rem;
    font-weight: 500;
    border-radius: .375rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
    background: rgba(var(--bs-emphasis-color-rgb), .05);
    color: var(--bs-body-color);
}

.sidebar-link.active {
    background: rgba(var(--bs-info-rgb), .12);
    color: var(--bs-info);
    font-weight: 600;
}

.sidebar-link.active i {
    color: var(--bs-info);
    opacity: 1;
}

.sidebar-link i {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
    opacity: .6;
    flex-shrink: 0;
}

.sidebar-section {
    padding: .75rem .75rem .25rem;
    font-size: .6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--bs-secondary-color);
}

.sidebar-group-label {
    display: block;
    padding: .75rem .75rem .2rem;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--bs-secondary-color);
    border-top: 1px solid var(--tblr-border-color, var(--bs-border-color));
    margin-top: .25rem;
}

.sidebar-link-sub {
    padding-left: 1.5rem;
}

/* ── Mobile sidebar ──────────────────────────────────────────── */

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(2px);
    z-index: 1019;
}

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar.open ~ .sidebar-backdrop { display: block; }
    .content-wrapper { margin-left: 0 !important; }
}

/* ── Content wrapper ─────────────────────────────────────────── */

.content-wrapper {
    margin-top: 48px;
    margin-left: 210px;
    padding: .875rem;
    padding-bottom: calc(.875rem + 26px);
    min-height: calc(100vh - 48px);
    background: var(--tblr-body-bg, var(--bs-body-bg));
}

/* ── Info Boxes ──────────────────────────────────────────────── */

.info-box {
    display: flex;
    align-items: stretch;
    background: var(--tblr-bg-surface, var(--bs-body-bg));
    border: 1px solid var(--tblr-border-color, var(--bs-border-color));
    border-radius: var(--tblr-border-radius, .375rem);
    min-height: 66px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
    transition: box-shadow .15s, transform .15s;
}

.info-box:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.09);
    transform: translateY(-1px);
}

.info-box-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.info-box-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: .4rem .75rem;
    line-height: 1.25;
    min-width: 0;
}

.info-box-label {
    font-size: .6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bs-secondary-color);
}

.info-box-number {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.1;
}

/* ── Cards ───────────────────────────────────────────────────── */

.card {
    box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
}

.card-outline {
    border-top: 3px solid var(--tblr-border-color, var(--bs-border-color));
}

.card-outline.card-info    { border-top-color: var(--bs-info); }
.card-outline.card-warning { border-top-color: var(--bs-warning); }
.card-outline.card-success { border-top-color: var(--bs-success); }
.card-outline.card-primary { border-top-color: var(--bs-primary); }

.card-header {
    font-weight: 600;
    font-size: .8125rem;
    letter-spacing: .025em;
    padding: .5625rem .875rem;
}

/* ── Status dot ──────────────────────────────────────────────── */

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bs-danger);
    flex-shrink: 0;
}

.status-dot.connected {
    background: var(--bs-success);
    animation: pulse-status 2.4s ease infinite;
}

@keyframes pulse-status {
    0%, 100% { box-shadow: 0 0 0 0   rgba(25, 135, 84, .5); }
    50%       { box-shadow: 0 0 0 4px rgba(25, 135, 84, 0);  }
}

/* ── Messages ────────────────────────────────────────────────── */

.msg-item {
    padding: .4rem .75rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
    font-size: .8rem;
    transition: background .1s;
}

.msg-item:hover {
    background: rgba(var(--bs-emphasis-color-rgb), .02);
}

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

.msg-bubble {
    background: rgba(var(--bs-info-rgb), .07);
    border: 1px solid rgba(var(--bs-info-rgb), .12);
    border-radius: .375rem;
    padding: .25rem .5rem;
    display: inline-block;
    max-width: 100%;
    word-break: break-word;
}

.msg-bubble-sent {
    background: rgba(var(--bs-success-rgb), .08);
    border: 1px solid rgba(var(--bs-success-rgb), .15);
    border-left: 2px solid var(--bs-success);
}

.msg-sent {
    text-align: right;
}

.msg-sent .msg-bubble-sent {
    text-align: left;
}

/* ── Map wrapper ─────────────────────────────────────────────── */

.map-wrapper {
    padding: 0 !important;
    overflow: hidden;
}

.map-wrapper #map {
    width: 100%;
    height: calc(100vh - 48px - 26px);
}

.node-tooltip { font-size: 13px; line-height: 1.6; }
.node-tooltip strong { color: #0f3460; }
.node-tooltip .label { color: #666; }
.node-tooltip-wrap { padding: 0; }

.legend {
    background: var(--tblr-bg-surface, #ffffff);
    border: 1px solid var(--tblr-border-color, rgba(0,0,0,.12));
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,.15);
    padding: 7px 10px;
    font-size: 11.5px;
    line-height: 1.4;
    min-width: 100px;
    color: var(--tblr-body-color, #212529);
}

[data-bs-theme="dark"] .legend {
    box-shadow: 0 2px 12px rgba(0,0,0,.45);
}
.legend-section {
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--bs-secondary-color);
    margin: 5px 0 3px;
}
.legend-section:first-child { margin-top: 0; }
.legend-item { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(128,128,128,.2);
    flex-shrink: 0;
}

/* ── Full Messages Page ──────────────────────────────────────── */

.msg-full-item {
    padding: .75rem .875rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}
[data-bs-theme="dark"] .msg-full-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.msg-full-item:last-child { border-bottom: none; }

.msg-full-row {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
}
.msg-full-row-sent {
    flex-direction: column;
    align-items: flex-end;
}

.msg-full-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid;
    flex-shrink: 0;
    margin-top: 2px;
}

.msg-full-body {
    flex: 1;
    min-width: 0;
}

.msg-full-meta {
    display: flex;
    align-items: center;
    gap: .3rem;
    flex-wrap: wrap;
    margin-bottom: 3px;
    font-size: .78rem;
}

.msg-full-name {
    font-size: .78rem;
}

.msg-ch-badge {
    display: inline-block;
    padding: 0 .4rem;
    border-radius: 3px;
    border: 1px solid;
    font-size: .68rem;
    font-weight: 600;
    line-height: 1.5;
}

.msg-full-bubble {
    display: inline-block;
    background: rgba(var(--bs-info-rgb), .07);
    border: 1px solid rgba(var(--bs-info-rgb), .15);
    border-left: 3px solid currentColor;
    border-radius: 0 .375rem .375rem 0;
    padding: .3rem .55rem;
    font-size: .83rem;
    max-width: 100%;
    word-break: break-word;
    color: var(--bs-body-color);
}

.msg-full-bubble-sent {
    background: rgba(var(--bs-success-rgb), .09);
    border: 1px solid rgba(var(--bs-success-rgb), .18);
    border-right: 3px solid var(--bs-success);
    border-radius: .375rem 0 0 .375rem;
    text-align: left;
}

/* ── Packet-Log Badges ───────────────────────────────────────── */

.pkt-type-badge {
    display: inline-block;
    min-width: 5.5rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: .65rem !important;
}

/* ── Page Footer ─────────────────────────────────────────────── */

.page-footer {
    position: fixed;
    bottom: 0;
    left: 210px;
    right: 0;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .65rem;
    color: var(--bs-secondary-color);
    background: var(--tblr-bg-surface, var(--bs-body-bg));
    border-top: 1px solid var(--tblr-border-color, var(--bs-border-color));
    z-index: 900;
    letter-spacing: .02em;
}

@media (max-width: 991.98px) {
    .page-footer { left: 0; }
}

/* ── Scrollbars ──────────────────────────────────────────────── */

.table-responsive::-webkit-scrollbar,
.card-body::-webkit-scrollbar {
    width: 4px;
}

.table-responsive::-webkit-scrollbar-track,
.card-body::-webkit-scrollbar-track {
    background: transparent;
}

.table-responsive::-webkit-scrollbar-thumb,
.card-body::-webkit-scrollbar-thumb {
    background: var(--tblr-border-color, var(--bs-border-color));
    border-radius: 4px;
}
