@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Roboto:wght@300;400;700&display=swap');

:root {
    --bg-color: #0b0f19;
    --panel-bg: #111827;
    --text-color: #e5e7eb;
    --accent-blue: #00f0ff;
    --accent-orange: #ff5e00;
    --danger-red: #ff003c;
    --warning-yellow: #facc15;
    --safe-green: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    background-image: linear-gradient(rgba(11, 15, 25, 0.9), rgba(11, 15, 25, 0.9)), url('data:image/svg+xml;utf8,<svg width="40" height="40" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h40v40H0z" fill="none"/><path d="M39.5 0v40M0 39.5h40" stroke="rgba(0, 240, 255, 0.05)" stroke-width="1"/></svg>');
}

/* Typography */
h1, h2, h3, .brand {
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
}

/* Sidebar (Flexbox untuk merapikan posisi menu dan footer) */
.sidebar {
    position: fixed;
    width: 250px;
    height: 100vh;
    background: var(--panel-bg);
    border-right: 1px solid rgba(0, 240, 255, 0.2);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 100;
    transition: transform 0.3s ease;
}

.brand {
    font-size: 1.5rem;
    color: var(--accent-blue);
    text-align: center;
    margin-bottom: 40px;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

/* Sidebar Navigasi */
/* Sidebar Navigasi */
.nav-link {
    display: block;
    padding: 15px;
    color: var(--text-color);
    text-decoration: none;
    margin-bottom: 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

/* Efek Hover: Bergeser sedikit ke kanan dan menyala */
.nav-link:hover {
    background: rgba(0, 240, 255, 0.15);
    border-left: 3px solid var(--accent-blue);
    color: var(--accent-blue);
    transform: translateX(5px);
    box-shadow: inset 5px 0 15px rgba(0, 240, 255, 0.1);
}

/* Status Menu yang Sedang Aktif/Dipilih */
.nav-link.active {
    background: rgba(0, 240, 255, 0.2);
    border-left: 3px solid var(--accent-blue);
    color: var(--accent-blue);
    box-shadow: inset 5px 0 15px rgba(0, 240, 255, 0.2);
    font-weight: bold;
}
.sidebar-footer {
    width: 100%;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Main Content */
.main-content {
    margin-left: 250px;
    padding: 30px;
}

.page-section {
    margin-bottom: 40px;
}

.section-divider {
    margin: 50px 0;
    border-top: 1px solid rgba(0, 240, 255, 0.15);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.2);
}

.logout-btn {
    display: block;
    text-align: center;
    background: transparent;
    color: var(--accent-orange);
    border: 1px solid var(--accent-orange);
    padding: 10px 15px;
    border-radius: 4px;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: var(--accent-orange);
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 94, 0, 0.5);
}

/* Cards */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--panel-bg);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid rgba(0, 240, 255, 0.1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
}

.card h3 {
    font-size: 1rem;
    color: #9ca3af;
    margin-bottom: 15px;
}

.sensor-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #fff;
}

.sensor-unit {
    font-size: 1rem;
    color: #6b7280;
}

/* Alerts */
.alert-box {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 30px;
    border: 1px solid;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 2px;
    font-size: 1.5rem;
}

.alert-aman {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--safe-green);
    color: var(--safe-green);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.alert-waspada {
    background: rgba(250, 204, 21, 0.1);
    border-color: var(--warning-yellow);
    color: var(--warning-yellow);
    box-shadow: 0 0 20px rgba(250, 204, 21, 0.2);
}

.alert-bahaya {
    background: rgba(255, 0, 60, 0.1);
    border-color: var(--danger-red);
    color: var(--danger-red);
    box-shadow: 0 0 30px rgba(255, 0, 60, 0.5);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 20px rgba(255, 0, 60, 0.4); }
    50% { box-shadow: 0 0 40px rgba(255, 0, 60, 0.8); }
    100% { box-shadow: 0 0 20px rgba(255, 0, 60, 0.4); }
}

/* Charts & Map */
.chart-container {
    background: var(--panel-bg);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid rgba(0, 240, 255, 0.1);
    margin-bottom: 20px;
}

#map {
    height: 450px;
    width: 100%;
    border-radius: 8px;
    border: 1px solid rgba(0, 240, 255, 0.2);
    z-index: 1;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: var(--panel-bg);
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

th {
    color: var(--accent-blue);
    text-transform: uppercase;
    font-size: 0.9rem;
}

tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Login Box */
.login-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box {
    background: var(--panel-bg);
    padding: 40px;
    border-radius: 8px;
    border: 1px solid rgba(0, 240, 255, 0.3);
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 4px;
}

.login-box input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: var(--accent-blue);
    color: #000;
    border: none;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
}

.login-box button:hover {
    box-shadow: 0 0 15px var(--accent-blue);
}

/* --- Animasi Shake & Responsif Mobile --- */

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(0deg); }
}

.shake {
    animation: shake 0.5s ease-in-out;
    border-color: var(--accent-orange) !important;
    box-shadow: 0 0 15px rgba(255, 94, 0, 0.6) !important;
}

/* Mobile Topbar Styling */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--panel-bg);
    border-bottom: 1px solid rgba(0, 240, 255, 0.2);
    padding: 0 20px;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
}

.menu-toggle {
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    font-size: 1.5rem;
    padding: 2px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

/* Media Queries untuk Android / Layar HP */
@media (max-width: 768px) {
    .mobile-topbar {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        top: 60px;
        height: calc(100vh - 60px);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .desktop-brand {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
        margin-top: 60px;
    }

    .sensor-value {
        font-size: 2rem;
    }

    .alert-box {
        font-size: 1.1rem;
        padding: 15px;
        letter-spacing: 1px;
    }
}