@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #020617;
    --bg-card: #0f172a;
    --bg-sidebar: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-primary: #38bdf8;
    --accent-success: #00ff9d;
    --accent-warning: #ffcc00;
    --accent-danger: #ff0033;
    --accent-charging: #7dd3fc;
    --sidebar-width: 260px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --glow: 0 0 15px rgba(56, 189, 248, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 2px 2px, rgba(255, 255, 255, 0.02) 1px, transparent 0);
    background-size: 40px 40px;
    color: var(--text-primary);
    overflow-x: hidden;
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Alive Background Elements */
body::before,
body::after {
    content: '';
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
}

body::before {
    background: var(--accent-primary);
    top: -200px;
    right: -200px;
    animation: drift 20s infinite alternate ease-in-out;
}

body::after {
    background: var(--accent-success);
    bottom: -200px;
    left: -200px;
    animation: drift 25s infinite alternate-reverse ease-in-out;
}

@keyframes drift {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(-100px, 100px) scale(1.2);
    }
}

/* Background Technical Particles */
.bg-animations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: var(--accent-primary);
    border-radius: 50%;
    opacity: 0.1;
    filter: blur(1px);
}

.particle:nth-child(1) {
    width: 4px;
    height: 4px;
    top: 20%;
    left: 10%;
    animation: float 15s infinite;
}

.particle:nth-child(2) {
    width: 6px;
    height: 6px;
    top: 60%;
    left: 80%;
    animation: float 20s infinite reverse;
}

.particle:nth-child(3) {
    width: 3px;
    height: 3px;
    top: 40%;
    left: 50%;
    animation: float 12s infinite 2s;
}

.particle:nth-child(4) {
    width: 5px;
    height: 5px;
    top: 80%;
    left: 30%;
    animation: float 18s infinite -5s;
}

.particle:nth-child(5) {
    width: 2px;
    height: 2px;
    top: 10%;
    left: 70%;
    animation: float 14s infinite 1s;
    background: var(--accent-success);
}

.particle:nth-child(6) {
    width: 4px;
    height: 4px;
    top: 90%;
    left: 60%;
    animation: float 22s infinite -3s;
}

.particle:nth-child(7) {
    width: 3px;
    height: 3px;
    top: 30%;
    left: 90%;
    animation: float 16s infinite 4s;
    background: var(--accent-warning);
}

.particle:nth-child(8) {
    width: 5px;
    height: 5px;
    top: 50%;
    left: 20%;
    animation: float 19s infinite -8s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.1;
    }

    33% {
        transform: translate(100px, 50px) rotate(120deg);
        opacity: 0.3;
    }

    66% {
        transform: translate(-50px, 100px) rotate(240deg);
        opacity: 0.2;
    }

    100% {
        transform: translate(0, 0) rotate(360deg);
        opacity: 0.1;
    }
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(circle at center, black, transparent 80%);
    pointer-events: none;
}

.scan-line {
    position: absolute;
    width: 100%;
    height: 100px;
    background: linear-gradient(to bottom, transparent, rgba(56, 189, 248, 0.03), transparent);
    top: -100px;
    animation: scan 8s linear infinite;
}

@keyframes scan {
    0% {
        top: -100px;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

@keyframes powerFlash {
    0% {
        opacity: 0;
        transform: scale(1);
        box-shadow: inset 0 0 0px var(--accent-primary);
    }

    50% {
        opacity: 0.3;
        box-shadow: inset 0 0 100px var(--accent-primary);
    }

    100% {
        opacity: 0;
        transform: scale(1.1);
    }
}

/* Wake-up Glow for Cards */
.wake-up-glow {
    animation: cardWakeUp 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes cardWakeUp {
    0% {
        box-shadow: 0 0 0 rgba(56, 189, 248, 0);
        border-color: rgba(255, 255, 255, 0.05);
    }

    40% {
        box-shadow: 0 0 30px rgba(56, 189, 248, 0.6);
        border-color: var(--accent-primary);
    }

    100% {
        box-shadow: 0 0 0 rgba(56, 189, 248, 0);
        border-color: rgba(255, 255, 255, 0.05);
    }
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

/* Tombol X — di dalam kotak pojok kanan atas */
.sidebar-close {
    display: none;
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    justify-content: center;
    align-items: center;
    transition: var(--transition);
    z-index: 1002;
    flex-shrink: 0;
}

.sidebar-close:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
    transform: rotate(90deg);
}

.sidebar-close i,
.sidebar-close svg {
    width: 16px;
    height: 16px;
}

/* Badge ECU untuk mobile - tersembunyi di desktop */
.mobile-ecu-badge {
    display: none;
    align-items: center;
    gap: 6px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 10px;
    padding: 6px 12px;
    color: var(--accent-primary);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.mobile-ecu-badge i,
.mobile-ecu-badge svg {
    width: 16px;
    height: 16px;
}

.sidebar-header .logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), #818cf8);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: white;
}

/* Hidden by default (Desktop) */
.top-bar-left,
.menu-toggle {
    display: none;
}

.nav-menu {
    list-style: none;
    flex-grow: 1;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-footer .engine-btn {
    flex: 1;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-primary);
}

/* Nav-link style khusus mobile — mirip Teknolab */
@media (max-width: 992px) {
    .nav-item {
        margin-bottom: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

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

    .nav-link {
        padding: 1.1rem 1.25rem;
        border-radius: 0;
        font-size: 1rem;
        font-weight: 700;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        color: var(--text-primary);
        gap: 1.25rem;
    }

    .nav-link:hover {
        background: rgba(56, 189, 248, 0.08);
        color: var(--accent-primary);
        padding-left: 1.75rem;
    }

    .nav-link.active {
        background: rgba(56, 189, 248, 0.12);
        color: var(--accent-primary);
        border-left: 3px solid var(--accent-primary);
    }

    .nav-link i,
    .nav-link svg {
        width: 20px;
        height: 20px;
        opacity: 0.8;
    }
}

/* Main Content Wrapper */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 2rem;
    width: calc(100% - var(--sidebar-width));
}

.view-section {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Header Info - Hidden by default */
.mobile-header-info,
.mobile-main-title {
    display: none;
}

/* Top Bar Desktop */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-info {
    flex: 1;
}

.header-info h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.header-info p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    max-width: 550px;
    line-height: 1.4;
}

/* Logo Boxes */
.logo-container {
    display: flex;
    gap: 1rem;
}

.logo-box {
    width: 65px;
    height: 65px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    text-align: center;
    padding: 5px;
    text-decoration: none;
    transition: var(--transition);
}

.logo-box:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.logo-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.tei-logo-img {
    transform: scale(1.4);
}

/* Top Bar Elements */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.engine-control-panel {
    background: rgba(30, 41, 59, 0.5);
    padding: 0.5rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    width: 100%;
}

.engine-btn {
    height: 45px;
    width: 100%;
    border: none;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    padding: 0 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.engine-btn.save-btn {
    background: var(--accent-primary);
    color: #020617;
    border: none;
    width: 100%;
    margin-top: 1rem;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2);
}

.engine-btn.save-btn:hover {
    background: #0ea5e9;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(56, 189, 248, 0.4);
}

.engine-btn.on {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: white;
    border: none;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    padding: 0 1rem;
}

.engine-btn.on i {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.1);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Engine Off State - Keep cards opaque but fade content (Dashboard only) */
body.engine-off #view-dashboard .card>*,
body.engine-off #view-dashboard .mini-card>* {
    opacity: 0.3;
    filter: grayscale(1);
    transition: var(--transition);
}

body.engine-off #view-dashboard .card,
body.engine-off #view-dashboard .mini-card {
    background: #0f172a;
    /* Solid background even when off to block animations */
    border-color: rgba(255, 255, 255, 0.02);
}

/* Wake-up Animation Effect */
.card.wake-up,
.mini-card.wake-up {
    animation: wakeUpBloom 1s ease-out;
}

@keyframes wakeUpBloom {
    0% {
        border-color: rgba(56, 189, 248, 0.1);
        box-shadow: 0 0 0 rgba(56, 189, 248, 0);
    }

    50% {
        border-color: var(--accent-primary);
        box-shadow: 0 0 30px rgba(56, 189, 248, 0.3);
    }

    100% {
        border-color: rgba(255, 255, 255, 0.05);
        box-shadow: 0 0 0 rgba(56, 189, 248, 0);
    }
}

/* Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.gauge-wrapper {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}

.card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: visible !important;
    transition: var(--transition);
}


.mini-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

.mini-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.4), rgba(15, 23, 42, 0.6));
    backdrop-filter: blur(8px);
    padding: 1.25rem;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: visible !important;
    transition: var(--transition);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.mini-card .label {
    font-size: 0.6rem;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.mini-card .value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin: 0.25rem 0;
}

.mini-card .unit {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-left: 2px;
}

.card-footer-info {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

.card-footer-info .highlight {
    color: var(--accent-primary);
    font-weight: 700;
}

.status-text {
    font-size: 0.7rem;
    color: var(--accent-success);
    margin-top: 8px;
    min-height: 14px;
    font-weight: 600;
}

.status-text.standby {
    color: var(--text-secondary);
}

/* Synchronized Pulse Layer */
.card::after,
.mini-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    border: 2px solid transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease, border-color 0.5s ease;
    z-index: 1;
    /* Always running in the background to keep all cards synchronized */
    animation: fieryNeonPulse 0.8s infinite cubic-bezier(0.4, 0, 0.6, 1);
    will-change: box-shadow, transform, opacity;
}


.card:hover,
.mini-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(56, 189, 248, 0.15);
    z-index: 10;
}

.mini-card i,
.mini-card svg {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
    opacity: 0.4;
    transition: var(--transition);
}

.mini-card:hover i,
.mini-card:hover svg {
    opacity: 1;
    transform: scale(1.2);
    color: var(--text-primary);
}

/* Fuel Bar Dynamic Color */
.progress-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    margin-top: 12px;
    overflow: hidden;
    position: relative;
}

#fuel-bar {
    height: 100%;
    width: 0%;
    transition: width 0.8s ease, background 0.8s ease;
    border-radius: 20px;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

/* Status Pill */
.status-pill {
    padding: 0.35rem 0.875rem;
    border-radius: 50px;
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 auto;
}

.status-online {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-success);
}

.status-alert {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-danger);
}

/* Logs View Styling */
.logs-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
}

.log-panel {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 400px;
    height: auto;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.log-panel:hover {
    transform: translateY(-5px);
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.log-panel h3 {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--accent-primary);
}

.log-list {
    overflow-y: auto;
    flex-grow: 1;
}

.log-item {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.mini-card .label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.log-msg {
    font-size: 0.85rem;
    font-weight: 500;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table th {
    text-align: left;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.data-table td {
    padding: 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.data-table tr:hover td {
    background: rgba(56, 189, 248, 0.05);
    color: var(--accent-primary);
}

/* Menu Toggle & Overlay */
.menu-toggle {
    display: none;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    width: 45px;
    height: 45px;
    border-radius: 12px;
    cursor: pointer;
    justify-content: center;
    align-items: center;
    transition: var(--transition);
    z-index: 1001;
}

.menu-toggle:hover {
    background: rgba(56, 189, 248, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    /* Gelap tapi TIDAK blur, konten tetap terlihat */
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-active .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 992px) {

    /* === TOP BAR MOBILE === */
    .top-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 0;
        margin-bottom: 1.5rem;
    }

    .top-bar-left {
        display: flex;
        justify-content: flex-start;
    }

    .menu-toggle {
        display: flex;
        width: 42px;
        height: 42px;
        border-radius: 10px;
        background: var(--bg-card);
        border: 1px solid rgba(255, 255, 255, 0.1);
        justify-content: center;
        align-items: center;
    }

    .header-info {
        display: none;
    }

    .mobile-main-title {
        display: block;
        text-align: center;
        margin-bottom: 1.5rem;
    }

    .mobile-main-title h2 {
        font-size: 1.4rem;
        font-weight: 900;
        color: #fff;
        text-transform: uppercase;
        letter-spacing: 2px;
        margin-bottom: 5px;
        background: linear-gradient(to right, #fff, var(--accent-primary));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .mobile-main-title p {
        font-size: 0.75rem;
        color: var(--text-secondary);
        font-weight: 400;
        line-height: 1.5;
        max-width: 90%;
        margin: 0 auto;
    }

    .mobile-header-info {
        display: block;
        background: var(--bg-card);
        padding: 1.5rem;
        border-radius: 24px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        margin-bottom: 1.5rem;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    }

    .mobile-header-info h1 {
        font-size: 1.2rem;
        font-weight: 800;
        color: var(--accent-primary);
        margin-bottom: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .mobile-header-info p {
        font-size: 0.75rem;
        color: var(--text-secondary);
        line-height: 1.6;
    }

    .header-actions {
        display: flex;
        justify-content: flex-end;
    }

    .logo-container {
        display: flex;
        gap: 0.5rem;
    }

    .logo-box {
        width: 55px;
        height: 55px;
        border-radius: 12px;
        padding: 5px;
    }

    .tei-logo-img {
        transform: scale(1.3);
    }

    /* === DRAWER MOBILE === */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 55%;
        /* 55% sesuai permintaan */
        max-width: 320px;
        min-width: 240px;
        transform: translateX(-110%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 50px rgba(0, 0, 0, 0.8);
        z-index: 2000;
        background: #0b1222;
        padding-top: 3.5rem;
        display: flex;
        flex-direction: column;
        border-right: 1px solid rgba(255, 255, 255, 0.05);
    }

    body.sidebar-active .sidebar {
        transform: translateX(0);
    }

    .sidebar-close {
        display: flex;
        position: absolute;
        top: 1rem;
        right: 1rem;
        /* Di dalam kotak pojok kanan atas */
        width: 34px;
        height: 34px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 50%;
        color: var(--text-secondary);
        justify-content: center;
        align-items: center;
    }

    .sidebar-header {
        padding: 0 1.25rem 1rem 1.25rem;
        margin-bottom: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }

    .nav-menu {
        padding: 0;
        flex-grow: 1;
    }

    .nav-item {
        margin-bottom: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    }

    .nav-link {
        padding: 1.1rem 1.25rem;
        border-radius: 0;
        font-size: 0.9rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .nav-link.active {
        background: rgba(56, 189, 248, 0.1);
        color: var(--accent-primary);
        border-left: 3px solid var(--accent-primary);
    }

    .sidebar-footer {
        padding: 1.25rem;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .engine-control-panel {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        width: 100% !important;
        margin-bottom: 1rem;
    }

    .engine-btn {
        width: 100% !important;
        height: 50px !important;
        font-size: 0.85rem !important;
        border-radius: 12px !important;
    }

    .sidebar-footer .status-pill {
        width: auto;
        margin: 0 auto;
        justify-content: center;
        display: inline-flex;
        gap: 6px;
    }

    /* Konten utama */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    /* Mobile Specific Settings Alignment */
    .view-section .label {
        display: flex;
        align-items: center;
        min-height: 2.2rem;
        line-height: 1.2;
    }

    .settings-grid {
        gap: 0.75rem;
    }
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

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

    .logs-container {
        grid-template-columns: 1fr;
    }
}

/* Settings Layout */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.settings-card {
    max-width: 650px;
    width: 100%;
    margin: 0 auto 2rem auto;
    padding: 1.5rem !important;
}



.view-section .label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

/* Settings Inputs */
.settings-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    margin-top: 0.5rem;
    transition: var(--transition);
}

.settings-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

/* Segment Control for Transmission */
.trans-selector {
    display: flex;
    background: rgba(15, 23, 42, 0.8);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0.5rem;
}

.trans-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 9px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.trans-btn.active {
    background: var(--accent-primary);
    color: #020617;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

/* Realistic Fiery Neon Danger Pulse */
@keyframes fieryNeonPulse {
    0% {
        box-shadow:
            0 0 15px rgba(255, 0, 51, 0.4),
            0 0 30px rgba(255, 0, 51, 0.1),
            inset 0 0 15px rgba(255, 0, 51, 0.2);
        transform: scale(1);
    }

    50% {
        box-shadow:
            0 0 35px rgba(255, 0, 51, 0.9),
            0 0 70px rgba(255, 0, 51, 0.5),
            0 0 110px rgba(255, 60, 0, 0.3),
            inset 0 0 30px rgba(255, 0, 51, 0.5);
        transform: scale(1.01);
        /* Very subtle scale on the pulse layer */
    }

    100% {
        box-shadow:
            0 0 15px rgba(255, 0, 51, 0.4),
            0 0 30px rgba(255, 0, 51, 0.1),
            inset 0 0 15px rgba(255, 0, 51, 0.2);
        transform: scale(1);
    }
}

.danger-pulse {
    border-color: #ff0033 !important;
    position: relative;
}

.danger-pulse::after {
    opacity: 1 !important;
    border-color: #ff0033 !important;
}



/* Debug Slider Styles */
.debug-control {
    margin-top: 3rem;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 20px;
    border: 1px dashed rgba(56, 189, 248, 0.2);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.debug-slider {
    width: 100%;
    -webkit-appearance: none;
    background: #1e293b;
    height: 8px;
    border-radius: 5px;
    outline: none;
    accent-color: var(--accent-primary);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 280px;
    transform: translateX(130%);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateX(0);
}

.toast i {
    color: var(--accent-primary);
    font-size: 1.2rem;
}

.toast.success {
    border-left: 5px solid var(--accent-success);
}

.toast.success i {
    color: var(--accent-success);
}

.debug-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}



/* Fix for Settings Input & Buttons */
.settings-input {
    background-color: rgba(15, 23, 42, 0.8) !important;
    color: var(--text-primary) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.trans-btn {
    background: transparent !important;
    color: var(--text-secondary) !important;
    border: none !important;
    -webkit-appearance: none;
    appearance: none;
}

.trans-btn.active {
    background: var(--accent-primary) !important;
    color: var(--bg-dark) !important;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

/* ============================================
   RESPONSIVE - TABLET (max 1024px)
   ============================================ */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 220px;
    }

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

    .gauge-wrapper {
        max-width: 260px;
    }

    /* Transmission Selector */
    .trans-selector {
        display: flex;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }

    .trans-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 0.75rem;
        background: rgba(30, 41, 59, 0.5);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 10px;
        color: var(--text-secondary);
        font-size: 0.75rem;
        font-weight: 700;
        cursor: pointer;
        transition: var(--transition);
    }

    .trans-btn:hover {
        background: rgba(56, 189, 248, 0.1);
        color: var(--text-primary);
    }

    .trans-btn.active {
        background: var(--accent-primary);
        color: #020617;
        border-color: var(--accent-primary);
        box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
    }

}

/* Footer Styling (Global) */
.main-footer {
    margin-top: 4rem;
    padding: 2rem 0;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.main-footer::before {
    content: '';
    width: 60%;
    max-width: 600px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin-bottom: 1.5rem;
}

.main-footer p {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    margin: 0;
    letter-spacing: 0.5px;
}

/* Mobile Overrides (Keep at bottom) */
@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .settings-card {
        margin: 0 0 1.5rem 0;
        border-radius: 24px;
        border-color: rgba(255, 255, 255, 0.08);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
        padding: 1.25rem !important;
    }

    /* TIGHT SPACING FOR MOBILE */
    .view-section .label {
        margin-bottom: 0px !important;
    }

    .settings-input,
    .trans-selector {
        margin-top: 2px !important;
    }
}

/* ============================================
   DETAIL ANALISIS VIEW
   ============================================ */

/* Page Header */
.analisis-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.analisis-title {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #f8fafc, var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.35rem;
}

.analisis-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.analisis-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--accent-danger);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: var(--transition);
}

.analisis-status-badge.online {
    background: rgba(0, 255, 157, 0.08);
    border-color: rgba(0, 255, 157, 0.3);
    color: var(--accent-success);
}

.analisis-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-danger);
    display: inline-block;
    animation: dotPulse 1.5s infinite;
    transition: background 0.4s ease;
}

.analisis-status-badge.online .analisis-dot {
    background: var(--accent-success);
}

@keyframes dotPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.7);
    }
}

/* Category Sections */
.analisis-category {
    margin-bottom: 2rem;
}

.analisis-category-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.analisis-category-header span {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

.analisis-category-header i,
.analisis-category-header svg {
    width: 16px;
    height: 16px;
    color: var(--accent-primary);
    opacity: 0.7;
}

/* Analisis Grid */
.analisis-grid {
    display: grid;
    gap: 1.5rem;
}

/* 4-column structure for balanced rows across categories */
.grid-4-col {
    grid-template-columns: repeat(4, 1fr);
}


/* Analisis Card */
.analisis-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.7));
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 1.6rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    position: relative;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    cursor: default;
}

.analisis-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.4), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.analisis-card:hover {
    transform: translateY(-5px);
    border-color: rgba(56, 189, 248, 0.2);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(56, 189, 248, 0.08);
}

.analisis-card:hover::before {
    opacity: 1;
}

/* Danger state */
.analisis-card.ac-danger {
    border-color: rgba(255, 0, 51, 0.4) !important;
    box-shadow: 0 0 20px rgba(255, 0, 51, 0.15);
    animation: acDangerPulse 1.2s infinite ease-in-out;
}

@keyframes acDangerPulse {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(255, 0, 51, 0.15);
    }

    50% {
        box-shadow: 0 0 35px rgba(255, 0, 51, 0.4), 0 0 60px rgba(255, 0, 51, 0.15);
    }
}

/* Card Top Row (icon + badge) */
.ac-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.ac-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.analisis-card:hover .ac-icon-wrap {
    transform: scale(1.1);
}

.ac-icon-wrap i,
.ac-icon-wrap svg {
    width: 17px;
    height: 17px;
}

/* Icon color variants */
.ac-blue {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
}

.ac-amber {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.ac-teal {
    background: rgba(20, 184, 166, 0.12);
    color: #14b8a6;
}

.ac-orange {
    background: rgba(249, 115, 22, 0.12);
    color: #f97316;
}

.ac-red {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.ac-green {
    background: rgba(0, 255, 157, 0.10);
    color: #00ff9d;
}

.ac-pink {
    background: rgba(236, 72, 153, 0.12);
    color: #ec4899;
}

/* PGN Badge - Hidden as per user request */
.ac-badge {
    display: none !important;
}

/* Parameter Label */
.ac-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Value Row */
.ac-value {
    display: flex;
    align-items: baseline;
    gap: 4px;
    line-height: 1;
    margin: 0.2rem 0;
}

.ac-value span:first-child {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    transition: color 0.4s ease;
}

.ac-value span:first-child.ac-danger-text {
    color: var(--accent-danger);
}

.ac-unit {
    font-size: 0.8rem !important;
    color: var(--text-secondary) !important;
    font-weight: 500 !important;
}

/* Progress Bar */
.ac-bar-track {
    height: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.ac-bar {
    height: 100%;
    border-radius: 10px;
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s ease;
}

/* Bar color variants */
.ac-bar-blue {
    background: linear-gradient(90deg, #0ea5e9, #38bdf8);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.ac-bar-amber {
    background: linear-gradient(90deg, #d97706, #f59e0b);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.ac-bar-teal {
    background: linear-gradient(90deg, #0d9488, #14b8a6);
    box-shadow: 0 0 8px rgba(20, 184, 166, 0.4);
}

.ac-bar-orange {
    background: linear-gradient(90deg, #ea580c, #f97316);
    box-shadow: 0 0 8px rgba(249, 115, 22, 0.4);
}

.ac-bar-red {
    background: linear-gradient(90deg, #dc2626, #ef4444);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.ac-bar-green {
    background: linear-gradient(90deg, #059669, #10b981);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.ac-bar-pink {
    background: linear-gradient(90deg, #db2777, #f472b6);
    box-shadow: 0 0 8px rgba(236, 72, 153, 0.4);
}

/* Warning bar override (approaching danger) */
.ac-bar.bar-warning {
    background: linear-gradient(90deg, #d97706, #f59e0b) !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5) !important;
}

/* Danger bar override */
.ac-bar.bar-danger {
    background: linear-gradient(90deg, #b91c1c, #ff0033) !important;
    box-shadow: 0 0 14px rgba(255, 0, 51, 0.7) !important;
    animation: barDangerPulse 1s infinite ease-in-out;
}

@keyframes barDangerPulse {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(255, 0, 51, 0.5);
    }

    50% {
        box-shadow: 0 0 18px rgba(255, 0, 51, 0.9);
    }
}

/* Status Line */
.ac-status {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    min-height: 14px;
    margin-top: 2px;
    transition: color 0.4s ease;
}

.ac-status.normal {
    color: var(--accent-success);
}

.ac-status.warning {
    color: var(--accent-warning);
}

.ac-status.danger {
    color: var(--accent-danger);
}

.ac-status.offline {
    color: rgba(255, 255, 255, 0.25);
}

/* Responsive Analisis */
@media (max-width: 992px) {
    .mobile-ecu-badge {
        display: flex;
    }

    .analisis-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .analisis-title {
        font-size: 1.2rem;
    }

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

    .ac-value span:first-child {
        font-size: 1.4rem;
    }
}

@media (max-width: 600px) {
    .grid-4-col {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .analisis-card {
        padding: 1rem;
    }

    .ac-value span:first-child {
        font-size: 1.2rem;
    }

    .ac-icon-wrap {
        width: 30px;
        height: 30px;
    }

    /* Table optimization on mobile */
    .data-table th,
    .data-table td {
        padding: 0.6rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
}

@media (max-width: 480px) {
    .grid-4-col {
        grid-template-columns: 1fr;
    }

    /* Stack mini cards on extra small screens to prevent label overflow */
    .mini-grid {
        grid-template-columns: 1fr !important;
        gap: 0.85rem !important;
    }

    .gauge-wrapper {
        max-width: 220px !important;
    }

    .mobile-header-info {
        padding: 1rem !important;
        border-radius: 16px !important;
    }
}

/* Simplified Analisis Card Styles */
.ac-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.ac-icon {
    width: 22px;
    height: 22px;
    opacity: 0.85;
    flex-shrink: 0;
}

.ac-icon.ac-blue { color: #38bdf8; }
.ac-icon.ac-amber { color: #f59e0b; }
.ac-icon.ac-teal { color: #14b8a6; }
.ac-icon.ac-orange { color: #f97316; }
.ac-icon.ac-red { color: #ef4444; }
.ac-icon.ac-green { color: #00ff9d; }
.ac-icon.ac-pink { color: #ec4899; }

.ac-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ac-body {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    margin-top: 0.15rem;
    flex-wrap: nowrap;
    overflow: hidden;
}

.ac-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease;
    min-width: 0;
    white-space: nowrap;
}

.ac-value.ac-danger-text {
    color: var(--accent-danger);
    text-shadow: 0 0 12px rgba(255, 0, 51, 0.35);
}

.ac-unit {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    padding-bottom: 0.15rem;
    flex-shrink: 0;
    white-space: nowrap;
}