/* ===============================
   RESET
================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', sans-serif;
}

body {
    background: #f5f6fa;
}

/* ===============================
   LAYOUT
================================ */
.app {
    display: flex;
    height: 100vh;
}
/* ===============================
   SIDEBAR MODERN
================================ */
.sidebar {
    width: 240px;
    background: #2f6fed;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    flex-shrink: 0;
}

.logo {
    text-align: center;
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 30px;
}

/* MENU */
.sidebar ul.menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar ul.menu li {
    margin-bottom: 6px;
}

.sidebar ul.menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;              /* ⚡ klik seluruh area */
    padding: 12px 20px;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.3s, transform 0.2s;
}

.sidebar ul.menu li a .icon {
    font-size: 18px;
}

.sidebar ul.menu li a .text {
    font-size: 15px;
    font-weight: 500;
}

/* HOVER & ACTIVE */
.sidebar ul.menu li a:hover,
.sidebar ul.menu li.active a {
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transform: translateX(3px);
}

/* ===============================
   MAIN
================================ */
.main {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* ===============================
   TOPBAR
================================ */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2ecc71;
}

/* ===============================
   SUMMARY
================================ */
.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    color: #fff;
    padding: 20px;
    border-radius: 14px;
}

.summary-card h2 {
    font-size: 32px;
}

.summary-card.green {
    background: linear-gradient(135deg, #3bb54a, #6edc82);
}

/* ===============================
   DEVICE GRID
================================ */
.device-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}


/* ===============================
   DEVICE CARD BASE
================================ */
.device-card {
    flex: 1 1 220px; /* fleksibel tapi minimal 220px */
    max-width: 250px; /* tidak melebar terlalu banyak */
    border-radius: 12px;
    padding: 15px;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: 0.3s;
    cursor: pointer;
}

.device-card h4 {
    margin-bottom: 6px;
    font-size: 15px;
}

.device-card small {
    font-size: 12px;
    color: #555;
}

/* ===============================
   CARD STATUS (FINAL)
================================ */
.device-card.online {
    background: #e8f8ee;
    border-left: 6px solid #2ecc71;
}

.device-card.offline {
    background: #eeeeee;
    border-left: 6px solid #9e9e9e;
    opacity: 0.85;
}

.device-card.critical {
    background: #fdecea;
    border-left: 6px solid #e53935;
    animation: pulse 1.2s infinite;
}
.device-card.critical {
    border: 2px solid #e74c3c;
    background-color: #fdecea;
    position: relative;
}

.badge-alert {
    background-color: #e74c3c;
    color: #fff;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
}

.device-card .metric span {
    font-weight: bold;
}

/* ===============================
   METRICS
================================ */
.metrics {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
}

.metric {
    text-align: center;
    font-size: 13px;
}

.metric span {
    display: block;
    font-size: 18px;
    font-weight: bold;
}

/* COLOR LEVEL */
.safe   { color: #2ecc71; }
.warn   { color: #f1c40f; }
.danger { color: #e74c3c; }

/* ===============================
   STATUS TEXT
================================ */
.status {
    margin-top: 10px;
    font-weight: bold;
    font-size: 13px;
}

.status.online  { color: #2ecc71; }
.status.offline { color: #9e9e9e; }

/* ===============================
   BADGE
================================ */
.badge-alert {
    background: #e53935;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: 6px;
}

/* ===============================
   MODAL
================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 999;
    inset: 0;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: #fff;
    width: 500px;
    max-height: 80vh;
    margin: 5% auto;
    border-radius: 12px;
    padding: 20px;
    overflow-y: auto;
}

.close {
    float: right;
    font-size: 22px;
    cursor: pointer;
}

/* ===============================
   ANIMATION
================================ */
@keyframes pulse {
    0%   { box-shadow: 0 0 0 rgba(229,57,53,.4); }
    50%  { box-shadow: 0 0 14px rgba(229,57,53,.8); }
    100% { box-shadow: 0 0 0 rgba(229,57,53,.4); }
}


/* ===============================
   MOBILE RESPONSIVE
================================ */
@media (max-width: 768px) {

    .app {
        flex-direction: column;
    }

    /* SIDEBAR OFF-CANVAS */
    /* SIDEBAR */
/* ===============================
   SIDEBAR MODERN
================================ */
.sidebar {
    width: 240px;
    background: #2f6fed;
    color: #fff;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.logo {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 30px;
    color: #fff;
}

/* MENU */
.sidebar ul.menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar ul.menu li {
    margin-bottom: 8px;
}

.sidebar ul.menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 20px;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    transition: 0.3s;
}

.sidebar ul.menu li a .icon {
    font-size: 18px;
}

.sidebar ul.menu li a .text {
    font-size: 15px;
    font-weight: 500;
}

/* Hover & active */
.sidebar ul.menu li a:hover,
.sidebar ul.menu li.active a {
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

/* ===============================
   RESPONSIVE SIDEBAR (mobile)
================================ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        height: 100%;
        z-index: 1000;
        transition: 0.3s;
    }

    .sidebar.show {
        left: 0;
    }
}


/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    /* ===============================
   SIDEBAR MODERN
================================ */
.sidebar {
    width: 240px;
    background: #2f6fed;
    color: #fff;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.logo {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 30px;
    color: #fff;
}

/* MENU */
.sidebar ul.menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar ul.menu li {
    margin-bottom: 8px;
}

.sidebar ul.menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 20px;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    transition: 0.3s;
}

.sidebar ul.menu li a .icon {
    font-size: 18px;
}

.sidebar ul.menu li a .text {
    font-size: 15px;
    font-weight: 500;
}

/* Hover & active */
.sidebar ul.menu li a:hover,
.sidebar ul.menu li.active a {
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

/* ===============================
   RESPONSIVE SIDEBAR (mobile)
================================ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        height: 100%;
        z-index: 1000;
        transition: 0.3s;
    }

    .sidebar.show {
        left: 0;
    }
}

}


    /* MAIN FULL WIDTH */
    .main {
        padding: 15px;
    }

    /* TOPBAR */
    .topbar {
        gap: 10px;
    }

    /* HAMBURGER */
    .menu-btn {
        font-size: 22px;
        cursor: pointer;
        color: #2f6fed;
    }

    /* OVERLAY */
    .overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 999;
    }

    .overlay.show {
        display: block;
    }
}

.site-group {
    margin-bottom: 20px;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #5380be;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
}

 

.site-content {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0;
}

.site-content.collapsed {
    display: none;
}

 


/* ===============================
   MASTER SITE PAGE
================================ */
h2 {
    font-size: 22px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* BUTTON */
button {
    background: #2f6fed;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: 0.3s;
    margin-bottom: 15px;
}

button:hover {
    background: #1a4dc3;
}

/* TABLE */
#siteTable {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

#siteTable th, #siteTable td {
    padding: 12px 15px;
    text-align: left;
}

#siteTable th {
    background: #2f6fed;
    color: #fff;
    font-weight: 600;
}

#siteTable tbody tr {
    border-bottom: 1px solid #eee;
}

#siteTable tbody tr:hover {
    background: #f5f6fa;
}

#siteTable td button {
    background: #e74c3c;
    padding: 5px 10px;
    font-size: 12px;
}

#siteTable td button:hover {
    background: #c0392b;
}

/* MODAL */
.modal-content {
    width: 400px;
    max-width: 90%;
    padding: 20px;
    border-radius: 12px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-content h3 {
    margin-bottom: 10px;
    font-size: 18px;
}

.modal-content input,
.modal-content textarea {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    width: 100%;
}

.modal-content textarea {
    resize: vertical;
}

.modal-content button {
    align-self: flex-start;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    #siteTable th, #siteTable td {
        padding: 10px;
        font-size: 13px;
    }

    .modal-content {
        width: 90%;
    }
}

.map-section {
    margin: 15px;
}

#map {
    width: 100%;
    height: 350px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,.15);
}

.leaflet-marker-icon.blink {
    animation: blink-marker 1s infinite;
}

@keyframes blink-marker {
    0%   { opacity: 1; }
    50%  { opacity: 0.3; }
    100% { opacity: 1; }
}

.filter-bar {
    margin: 10px 0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-bar select {
    padding: 6px 10px;
    border-radius: 6px;
}
