
/* =========================================================
   ENVIRONMENTAL MONITORING SYSTEM
   DARK GREEN THEME
   Compatible dengan Dashboard, Shelter, Peta, Datalogger
========================================================= */

/* =========================================================
   1. GLOBAL
========================================================= */

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

:root {
    --bg-main: #07140f;
    --bg-sidebar: #091811;
    --bg-card: #11271e;
    --bg-card-light: #172f25;
    --bg-hover: #1b392d;

    --primary: #4db69a;
    --primary-light: #62c6aa;
    --primary-dark: #278d75;

    --text-main: #e8f3ed;
    --text-secondary: #9bb7a9;
    --text-muted: #668878;

    --border: #203c30;

    --success: #4db69a;
    --warning: #e6b85c;
    --danger: #e16f6f;

    --sidebar-width: 270px;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;

    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.5;

    color: var(--text-main);
    background: var(--bg-main);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font-family: inherit;
}


/* =========================================================
   2. LAYOUT UTAMA
========================================================= */

.app {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.main-content {
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    min-height: 100vh;

    margin-left: var(--sidebar-width);
    padding: 30px 40px;

    background: var(--bg-main);
}


/* =========================================================
   3. SIDEBAR
========================================================= */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;

    width: var(--sidebar-width);
    height: 100vh;

    display: flex;
    flex-direction: column;

    padding: 0;

    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);

    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Brand */

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;

    min-height: 105px;
    padding: 22px 25px;

    border-bottom: 1px solid var(--border);
}

.brand-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    color: var(--primary);
    background: var(--bg-card-light);

    border-radius: 14px;
    font-size: 23px;
}

.brand-text {
    min-width: 0;
}

.brand-text h2,
.brand-text h3 {
    color: var(--text-main);
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.7px;
    white-space: nowrap;
}

.brand-text span {
    display: block;
    margin-top: 4px;

    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
}


/* =========================================================
   4. MENU SIDEBAR
========================================================= */

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 7px;

    padding: 28px 20px;
}

.menu-title {
    margin: 0 12px 13px;

    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

/* Menu link utama */

.menu-link,
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;

    width: 100%;
    min-height: 48px;

    padding: 12px 15px;

    color: var(--text-secondary);
    background: transparent;

    border: 1px solid transparent;
    border-radius: 11px;

    font-size: 14px;
    font-weight: 600;

    transition: background 0.2s ease,
                color 0.2s ease,
                border-color 0.2s ease;
}

.menu-link i,
.menu-item i {
    width: 18px;
    text-align: center;
    font-size: 15px;
}

.menu-link span,
.menu-item span {
    white-space: nowrap;
}

.menu-link:hover,
.menu-item:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.menu-link.active,
.menu-item.active {
    color: #062018;
    background: var(--primary);
    border-color: var(--primary);

    font-weight: 800;
    box-shadow: 0 4px 15px rgba(77, 182, 154, 0.12);
}


/* =========================================================
   5. SIDEBAR FOOTER
========================================================= */

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    margin-top: auto;
    padding: 22px 20px;

    border-top: 1px solid var(--border);
}

.footer-status {
    display: flex;
    align-items: center;
    gap: 9px;

    color: var(--text-muted);
    font-size: 11px;
}

.footer-node {
    display: flex;
    flex-direction: column;

    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.4;
}

.footer-node strong {
    color: var(--text-secondary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    flex-shrink: 0;

    display: inline-block;

    background: var(--primary);
    border-radius: 50%;

    box-shadow: 0 0 10px rgba(77, 182, 154, 0.55);
}


/* =========================================================
   6. HEADER HALAMAN
========================================================= */

.page-header,
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    width: 100%;

    margin-bottom: 25px;
    padding-bottom: 22px;

    border-bottom: 1px solid var(--border);
}

.header-title {
    min-width: 0;
}

.page-subtitle {
    display: block;
    margin-bottom: 7px;

    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.page-header h1,
.topbar h1 {
    color: var(--text-main);
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.page-header p,
.topbar p {
    margin-top: 7px;

    color: var(--text-secondary);
    font-size: 13px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 10px;

    flex-shrink: 0;

    padding: 12px 16px;

    color: var(--primary);
    background: transparent;

    border: 1px solid var(--border);
    border-radius: 10px;

    font-size: 11px;
    font-weight: 800;
}


/* =========================================================
   7. SECTION DAN JUDUL
========================================================= */

.dashboard-section,
.content-section {
    width: 100%;
    min-width: 0;

    margin-bottom: 25px;
}

.section-heading,
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;

    margin-bottom: 14px;
}

.section-heading h2,
.section-header h2 {
    color: var(--text-main);
    font-size: 17px;
    font-weight: 800;
}

.section-heading p,
.section-header p {
    margin-top: 4px;

    color: var(--text-secondary);
    font-size: 12px;
}

.update-time {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}

.update-time strong {
    color: var(--primary);
}


/* =========================================================
   8. KARTU RINGKASAN
========================================================= */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;

    width: 100%;
}

.summary-card {
    min-width: 0;
    padding: 20px;

    background: linear-gradient(
        145deg,
        var(--bg-card-light),
        var(--bg-card)
    );

    border: 1px solid var(--border);
    border-radius: 15px;

    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.10);
}

.card-label {
    display: flex;
    align-items: center;
    gap: 8px;

    min-height: 28px;
    margin-bottom: 13px;

    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.4px;
}

.card-label i {
    color: var(--primary);
    font-size: 14px;
}

.card-value {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;

    color: var(--text-main);
    font-size: 29px;
    font-weight: 800;
}

.card-value small {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;

    margin-top: 12px;

    color: var(--text-muted);
    font-size: 10px;
}

.live-indicator {
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}


/* =========================================================
   9. KARTU MONITORING SHELTER DASHBOARD
========================================================= */

.shelter-grid,
.node-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;

    width: 100%;
}

.shelter-card,
.node-card {
    min-width: 0;
    padding: 20px;

    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 15px;

    transition: background 0.2s ease,
                border-color 0.2s ease,
                transform 0.2s ease;
}

.shelter-card:hover,
.node-card:hover {
    background: var(--bg-card-light);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
}

.shelter-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;

    padding-bottom: 14px;
    margin-bottom: 13px;

    border-bottom: 1px solid var(--border);
}

.shelter-number {
    display: block;
    margin-bottom: 4px;

    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.3px;
}

.shelter-card h3,
.node-card h3 {
    color: var(--text-main);
    font-size: 16px;
    font-weight: 800;
}

.shelter-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 5px 10px;

    color: var(--success);
    background: rgba(77, 182, 154, 0.12);

    border: 1px solid rgba(77, 182, 154, 0.25);
    border-radius: 20px;

    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.shelter-data {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.data-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    color: var(--text-secondary);
    font-size: 12px;
}

.data-row strong {
    color: var(--text-main);
    font-size: 12px;
    white-space: nowrap;
}

.detail-link,
.node-card a {
    display: inline-block;
    margin-top: 17px;

    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
}

.detail-link:hover,
.node-card a:hover {
    color: var(--primary-light);
}


/* =========================================================
   10. GRAFIK DASHBOARD
   SUHU ATAS
   KELEMBAPAN TENGAH
   ANGIN BAWAH
========================================================= */

.chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;

    width: 100%;
}

.chart-card {
    width: 100%;
    min-width: 0;

    padding: 0;

    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 15px;

    overflow: hidden;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 54px;
    padding: 16px 20px;

    background: var(--bg-card-light);
    border-bottom: 1px solid var(--border);
}

.chart-header h3 {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.chart-container,
.chart-area {
    position: relative;

    width: 100%;
    height: 290px;

    padding: 15px 18px;
}

.chart-container canvas,
.chart-area canvas {
    display: block;

    width: 100% !important;
    height: 100% !important;
}


/* =========================================================
   11. HALAMAN DETAIL SHELTER
========================================================= */

body[data-page="shelter"] .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body[data-page="shelter"] .summary-card {
    min-height: 145px;
}

body[data-page="shelter"] .chart-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
}

body[data-page="shelter"] .chart-container,
body[data-page="shelter"] .chart-area {
    height: 300px;
}


/* =========================================================
   12. BADGE STATUS
========================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 6px 12px;

    border-radius: 30px;

    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.badge.normal {
    color: #62d5b5;
    background: rgba(77, 182, 154, 0.13);
    border: 1px solid rgba(77, 182, 154, 0.25);
}

.badge.warning {
    color: #f0c36c;
    background: rgba(230, 184, 92, 0.12);
    border: 1px solid rgba(230, 184, 92, 0.25);
}

.badge.offline {
    color: #ef9292;
    background: rgba(225, 111, 111, 0.12);
    border: 1px solid rgba(225, 111, 111, 0.25);
}


/* =========================================================
   13. DATALOGGER - FILTER
========================================================= */

.filter-panel {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 15px;

    width: 100%;
    padding: 22px;

    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 15px;

    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;

    min-width: 160px;
}

.filter-group label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.filter-group select,
.filter-group input {
    width: 100%;
    min-height: 43px;

    padding: 0 13px;

    color: var(--text-main);
    background: var(--bg-card-light);

    border: 1px solid var(--border);
    border-radius: 10px;

    outline: none;
}

.filter-group select:focus,
.filter-group input:focus {
    border-color: var(--primary);
}

.filter-group select option {
    color: var(--text-main);
    background: var(--bg-card);
}

.filter-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
}


/* =========================================================
   14. BUTTON
========================================================= */

button {
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-actions button,
.map-actions button {
    min-height: 43px;
    padding: 11px 17px;

    color: var(--text-main);
    background: var(--bg-card-light);

    border: 1px solid var(--border);
    border-radius: 10px;

    font-size: 12px;
    font-weight: 700;
}

.filter-actions button:first-child {
    color: #062018;
    background: var(--primary);
    border-color: var(--primary);
}

.filter-actions button:hover,
.map-actions button:hover {
    color: #ffffff;
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}


/* =========================================================
   15. RINGKASAN DATALOGGER
========================================================= */

body[data-page="datalogger"] .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

body[data-page="datalogger"] .summary-card {
    min-height: 65px;
    padding: 15px 18px;
}


/* =========================================================
   16. TABEL DATALOGGER
========================================================= */

.table-container {
    width: 100%;
    overflow-x: auto;

    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 15px;
}

.data-table {
    width: 100%;
    min-width: 800px;

    border-collapse: collapse;
}

.data-table th {
    padding: 16px;

    color: var(--primary);
    background: var(--bg-card-light);

    border-bottom: 1px solid var(--border);

    font-size: 12px;
    font-weight: 800;
    text-align: left;
    white-space: nowrap;
}

.data-table td {
    padding: 15px 16px;

    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);

    font-size: 12px;
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}


/* =========================================================
   17. PETA LOKASI
========================================================= */

.map-container {
    width: 100%;
    height: 500px;

    overflow: hidden;

    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
}

#map {
    width: 100%;
    height: 100%;

    background: #14251d;
}

.map-actions {
    display: flex;
    justify-content: flex-end;

    margin-bottom: 13px;
}

.leaflet-container {
    font-family: Arial, Helvetica, sans-serif;
    background: #14251d;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    color: var(--text-main);
    background: var(--bg-card);
}

.leaflet-popup-content {
    font-size: 12px;
}

.leaflet-control-zoom a {
    color: #172f25 !important;
}


/* =========================================================
   18. KARTU INFORMASI LOKASI
========================================================= */

.shelter-location-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 17px;
}

.shelter-card.selected {
    background: var(--bg-card-light);
    border: 2px solid var(--primary);
}


/* =========================================================
   19. INFORMASI TAMBAHAN
========================================================= */

.info-card {
    padding: 20px;

    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.info-card p {
    color: var(--text-secondary);
    font-size: 13px;
}

.info-card strong {
    color: var(--text-main);
}


/* =========================================================
   20. FOOTER
========================================================= */

.main-footer,
.footer {
    width: 100%;

    margin-top: 30px;
    padding: 20px 0;

    color: var(--text-muted);
    border-top: 1px solid var(--border);

    font-size: 11px;
    letter-spacing: 0.5px;
}


/* =========================================================
   21. RESPONSIVE - LAPTOP KECIL
========================================================= */

@media screen and (max-width: 1200px) {

    :root {
        --sidebar-width: 240px;
    }

    .main-content {
        padding: 28px;
    }

    .summary-grid,
    .shelter-grid,
    .node-grid,
    .shelter-location-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* =========================================================
   22. RESPONSIVE - TABLET
========================================================= */

@media screen and (max-width: 900px) {

    :root {
        --sidebar-width: 210px;
    }

    .main-content {
        padding: 24px 20px;
    }

    .sidebar-brand {
        padding: 18px 15px;
    }

    .brand-text h2,
    .brand-text h3 {
        font-size: 14px;
    }

    .sidebar-menu {
        padding: 22px 12px;
    }

    .menu-link,
    .menu-item {
        padding: 11px 12px;
        font-size: 12px;
    }

    .chart-container,
    .chart-area {
        height: 260px;
    }
}


/* =========================================================
   23. RESPONSIVE - MOBILE
========================================================= */

@media screen and (max-width: 650px) {

    :root {
        --sidebar-width: 100%;
    }

    .app {
        display: block;
    }

    .sidebar {
        position: relative;

        width: 100%;
        height: auto;
        min-height: auto;
    }

    .sidebar-brand {
        min-height: 75px;
        padding: 12px 18px;
    }

    .brand-icon {
        width: 42px;
        height: 42px;
        font-size: 19px;
    }

    .sidebar-menu {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;

        padding: 12px;
    }

    .menu-title {
        width: 100%;
        margin: 0 5px 5px;
    }

    .menu-link,
    .menu-item {
        width: auto;
        min-height: 38px;
        padding: 8px 10px;
        font-size: 11px;
    }

    .menu-link i,
    .menu-item i {
        width: auto;
    }

    .sidebar-footer {
        display: none;
    }

    .main-content {
        width: 100%;
        min-height: auto;

        margin-left: 0;
        padding: 20px 15px;
    }

    .page-header,
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-header h1,
    .topbar h1 {
        font-size: 22px;
    }

    .header-status {
        align-self: flex-start;
    }

    .section-heading,
    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .summary-grid,
    body[data-page="shelter"] .summary-grid,
    body[data-page="datalogger"] .summary-grid {
        grid-template-columns: 1fr;
    }

    .shelter-grid,
    .node-grid,
    .shelter-location-grid {
        grid-template-columns: 1fr;
    }

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

    .chart-container,
    .chart-area,
    body[data-page="shelter"] .chart-container,
    body[data-page="shelter"] .chart-area {
        height: 240px;
        padding: 12px;
    }

    .filter-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .filter-actions {
        width: 100%;
    }

    .filter-actions button {
        flex: 1;
    }
}


/* =========================================================
   24. RESPONSIVE - HP KECIL
========================================================= */

@media screen and (max-width: 400px) {

    .main-content {
        padding: 15px 10px;
    }

    .page-header h1,
    .topbar h1 {
        font-size: 20px;
    }

    .summary-card,
    .shelter-card {
        padding: 16px;
    }

    .chart-container,
    .chart-area {
        height: 210px;
    }

    .chart-header {
        padding: 13px 15px;
    }
}


/* =========================================================
   25. SCROLLBAR
========================================================= */

::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: #294638;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}


/* =========================================================
   26. FOCUS
========================================================= */

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}


/* =========================================================
   END STYLE.CSS
========================================================= */
