/* ===== Modern Dashboard Theme (Dark by default) ===== */
:root {
    --bg: #0b1220;
    --panel: rgba(255, 255, 255, .06);
    --panel-2: rgba(255, 255, 255, .08);
    --border: rgba(255, 255, 255, .10);
    --text: rgba(255, 255, 255, .92);
    --muted: rgba(255, 255, 255, .62);

    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --radius: 16px;

    --primary: #6d5efc;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #38bdf8;

    --ring: 0 0 0 4px rgba(109, 94, 252, .20);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
    color: var(--text);
    background: radial-gradient(900px 420px at 20% 0%, rgba(109, 94, 252, .25), transparent 55%),
                radial-gradient(700px 380px at 90% 10%, rgba(56, 189, 248, .18), transparent 55%),
                radial-gradient(900px 500px at 50% 100%, rgba(34, 197, 94, .10), transparent 60%),
                var(--bg);
    background-attachment: fixed; /* Menjaga latar belakang tetap saat scroll */
    overflow-x: hidden; /* Menyembunyikan scrollbar horizontal */
}

/* Tambahkan efek overlay jika perlu */
body::before {
    content: '';
    position: fixed; /* Overlay mengikuti scroll */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3); /* Overlay hitam transparan (sesuaikan sesuai kebutuhan) */
    z-index: -1; /* Menempatkan di belakang konten */
}

/* Reset untuk menghindari masalah margin/padding */
* {
    box-sizing: border-box;
}

/* App container */
.app {
    max-width: 1050px;
    margin: 0 auto;
    padding: 22px 16px 60px;
}

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .04);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.brand__title {
    font-weight: 800;
    letter-spacing: .6px;
    font-size: 18px;
    line-height: 1.1;
}

.brand__subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: var(--muted);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, .04);
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

/* Content layout */
.content {
    margin-top: 18px;
    display: grid;
    gap: 14px;
}

/* Cards */
.card {
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.card__header {
    padding: 16px 16px 0;
}

.card__header.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card__title {
    margin: 0;
    font-size: 16px;
    letter-spacing: .2px;
}

.card__hint {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

/* Stats */
.stats {
    padding: 16px;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat {
    border: 1px solid var(--border);
    background: var(--panel-2);
    border-radius: 14px;
    padding: 14px;
    position: relative;
    overflow: hidden;
}

.stat::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .18;
    background: linear-gradient(135deg, rgba(255, 255, 255, .15), transparent);
    pointer-events: none;
}

.stat__label {
    font-size: 12px;
    color: #FFD700;;
    position: relative;
}

.stat__value {
    position: relative;
    margin-top: 6px;
    font-weight: 800;
    font-size: 30px;
    letter-spacing: .2px;
    line-height: 1.1;
}

.stat__suffix {
    font-size: 16px;
    font-weight: 700;
    color: var(--muted);
    margin-left: 4px;
}

.stat--info { border-color: rgba(56, 189, 248, .25); }
.stat--success { border-color: rgba(34, 197, 94, .25); }
.stat--danger { border-color: rgba(239, 68, 68, .25); }
.stat--warning { border-color: rgba(245, 158, 11, .25); }

/* Search */
.search {
    padding: 16px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.search__field {
    flex: 1;
}

.input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, .20);
    color: var(--text);
    outline: none;
}

.input::placeholder { color: rgba(255, 255, 255, .45); }

.input:focus {
    border-color: rgba(109, 94, 252, .55);
    box-shadow: var(--ring);
}

/* Buttons */
.btn {
    height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .06);
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
}

.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }

.btn--primary {
    background: linear-gradient(135deg, rgba(109, 94, 252, 1), rgba(56, 189, 248, .9));
    border-color: rgba(255, 255, 255, .14);
}

.btn--ghost {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    height: auto;
    border-radius: 12px;
}

/* Table */
.table-wrap {
    padding: 14px 16px 16px;
    overflow: auto;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 620px;
}

.table thead th {
    text-align: left;
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
    padding: 12px 12px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(11, 18, 32, .88);
    backdrop-filter: blur(10px);
}

.table tbody td {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, .04);
}

.td-name {
    font-weight: 650;
}

.link {
    color: rgba(255, 255, 255, .90);
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 255, 255, .28);
}

.link:hover {
    border-bottom-color: rgba(255, 255, 255, .55);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .3px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .06);
}

.badge--up {
    border-color: rgba(34, 197, 94, .35);
    background: rgba(34, 197, 94, .14);
    color: rgba(215, 255, 229, .95);
}

.badge--down {
    border-color: rgba(239, 68, 68, .35);
    background: rgba(239, 68, 68, .14);
    color: rgba(255, 221, 221, .95);
}

/* Empty state */
.empty {
    padding: 18px 16px 16px;
    color: var(--muted);
}

/* Footer */
.footer {
    margin-top: 16px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

/* To top button */
.toTop {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, .35);
    color: var(--text);
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: .18s ease;
}

.toTop--show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Responsive */
@media (max-width: 920px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
    .topbar { flex-direction: column; align-items: flex-start; }
    .search { flex-direction: column; align-items: stretch; }
    .btn { width: 100%; }
    .stats { grid-template-columns: 1fr; }
}

/* ===== Grouped Online/Offline Blocks ===== */
.group {
    margin: 14px 16px 16px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .10);
}

.group__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.group__title {
    font-weight: 900;
    letter-spacing: .8px;
    font-size: 14px;
}

.group__sub {
    margin-top: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, .70);
}

/* Online block color */
.group--online {
    background: linear-gradient(180deg, rgba(34, 197, 94, .16), rgba(255, 255, 255, .03));
    border-color: rgba(34, 197, 94, .25);
}

.group--online .group__header {
    background: rgba(34, 197, 94, .14);
}

/* Offline block color */
.group--offline {
    background: linear-gradient(180deg, rgba(239, 68, 68, .16), rgba(255, 255, 255, .03));
    border-color: rgba(239, 68, 68, .25);
}

.group--offline .group__header {
    background: rgba(239, 68, 68, .14);
}

/* Row block tint (biar “kebaca” seblok) */
.table--group tbody tr.row--online {
    background: rgba(34, 197, 94, .07);
}

.table--group tbody tr.row--offline {
    background: rgba(239, 68, 68, .07);
}

.table--group tbody tr:hover {
    filter: brightness(1.06);
}

/* ===== Mobile: table jadi "kartu" agar tidak perlu geser ===== */
@media (max-width: 640px) {
    /* Matikan min-width yang bikin harus scroll kanan kiri */
    .table { min-width: 0; }

    /* Sembunyikan header tabel di mode mobile */
    .table thead {
        display: none;
    }

    /* Jadikan setiap row seperti card */
    .table tbody tr {
        display: block;
        border: 1px solid rgba(255, 255, 255, .10);
        border-radius: 14px;
        margin-bottom: 10px;
        overflow: hidden;
    }

    /* Setiap cell jadi 2 kolom: label kiri, value kanan */
    .table tbody td {
        display: grid;
        grid-template-columns: 140px 1fr;
        gap: 10px;
        align-items: center;
        padding: 10px 12px;
        border-bottom: 1px solid rgba(255, 255, 255, .06);
    }

    .table tbody td:last-child {
        border-bottom: none;
    }

    /* Label diambil dari data-label */
    .table tbody td::before {
        content: attr(data-label);
        color: rgba(255, 255, 255, .65);
        font-size: 12px;
        font-weight: 700;
        letter-spacing: .2px;
    }

    /* Biar nama kelihatan dominan */
    .td-name {
        font-weight: 800;
    }

    /* Supaya badge status rata kanan */
    .table tbody td[data-label="Status"] {
        align-items: center;
    }

    /* Link IP jangan kepanjangan */
    .link {
        word-break: break-word;
    }

    /* Table wrap tidak perlu scroll horizontal di mobile */
    .table-wrap {
        overflow: visible;
    }
}

.pill--btn {
    cursor: pointer;
    border: 0;
    background: rgba(255, 255, 255, .10);
}

.pill--btn:active {
    transform: translateY(1px);
}

/* Mobile: bikin tampilan "blok" lebih kebaca seperti layout lama */
@media (max-width: 640px) {
    /* Biar konten benar-benar full lebar */
    .app {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Card lebih rapat dan enak dibaca */
    .card {
        padding: 12px;
    }

    /* Ringkasan: jangan 1 baris kecil-kecil, bikin 2 kolom (atau 1 kolom) */
    .stats {
        display: grid;
        grid-template-columns: 1fr 1fr; /* jadi 2x2 */
        gap: 10px;
    }

    .stat {
        min-width: 0;
    }

    .stat__value {
        font-size: 22px; /* biar angka kebaca */
        line-height: 1.1;
    }

    .stat__label {
        font-size: 12px;
    }

    /* Search: tombol & input full lebar biar gak sempit */
    .search {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .search__field .input,
    .search .btn {
        width: 100%;
    }

    /* Tabel: sedikit kecilkan padding biar muat */
    .table th,
    .table td {
        padding: 10px 10px;
    }

    .table {
        font-size: 12px;
    }
}

.on-top {
    position: fixed;
    right: 30px;
    bottom: 50px;
    z-index: 9999;

    width: auto;

    display: inline-flex;
    align-items: center;

    /* Meningkatkan padding untuk memperbesar tombol */
    padding: 18px 23px; /* Ubah padding untuk ukuran yang lebih besar */

    border-radius: 999px; /* Anda bisa mengubah ini jika ingin sudut yang lebih tajam */
    border: 1px solid rgba(255, 255, 255, .16);

    background: rgba(20, 20, 24, .72);
    color: #fff;

    box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
    backdrop-filter: blur(10px);

    cursor: pointer;
    transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;

    overflow: visible;
    white-space: nowrap;
}

.on-top:hover {
    background: rgba(20, 20, 24, .85);
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .42);
}

.on-top:focus-visible {
    outline: 2px solid rgba(120, 180, 255, .9);
    outline-offset: 3px;
}

.on-top::after {
    content: "Ke Atas";
    margin-left: 15px;

    /* Meningkatkan padding untuk tampilan yang lebih besar */
    padding: 12px 17px; /* Ubah padding untuk ukuran yang lebih besar */
    border-radius: 999px;

    background: rgba(0, 0, 0, .45);
    border: 5px solid rgba(255, 255, 255, .12);
    color: #fff;

    /* Meningkatkan ukuran font untuk tampilan yang lebih jelas */
    font-size: 20px; /* Ubah ukuran font */
    font-weight: 600;
    white-space: nowrap;

    display: inline-block;
    vertical-align: middle;
}

.stat__value--uptime {
    font-size: 24px;   /* coba 14–18 */
    line-height: 1.4;
    font-weight: 800;
}

/* ===== Custom Background Colors for Stats ===== */

/* Uptime box color */
.stat--uptime {
    border-color: rgba(109, 94, 252, .25); /* Warna biru */
    background: linear-gradient(180deg, rgba(109, 94, 252, .16), rgba(255, 255, 255, .03));
}

/* Online customers box color */
.stat--online {
    border-color: rgba(34, 197, 94, .25); /* Warna hijau */
    background: linear-gradient(180deg, rgba(34, 197, 94, .16), rgba(255, 255, 255, .03));
}

/* Offline customers box color */
.stat--offline {
    border-color: rgba(239, 68, 68, .25); /* Warna merah */
    background: linear-gradient(180deg, rgba(239, 68, 68, .16), rgba(255, 255, 255, .03));
}

/* Mikrotik CPU box color */
.stat--cpu {
    border-color: rgba(245, 158, 11, .25); /* Warna kuning */
    background: linear-gradient(180deg, rgba(245, 158, 11, .16), rgba(255, 255, 255, .03));
}

/* ========== STYLING UNTUK KOLOM SEJAK & DURASI ========== */

/* Kolom Sejak */
.td-since {
    color: rgba(255, 255, 255, .85);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .2px;
    white-space: nowrap;
}

/* Kolom Durasi */
.td-duration {
    color: rgba(255, 255, 255, .75);
    font-size: 13px;
    font-weight: 650;
    font-variant-numeric: tabular-nums; /* Biar angka rata */
}

/* Tambahan warna subtle untuk durasi yang lama */
tr.row--offline .td-duration {
    color: rgba(255, 184, 184, .90); /* Merah muda untuk offline lama */
}

tr.row--online .td-duration {
    color: rgba(184, 255, 214, .90); /* Hijau muda untuk online lama */
}

/* Responsive: Mobile styling untuk kolom baru */
@media (max-width: 640px) {
    /* Label "Sejak" dan "Durasi" di mobile */
    .table tbody td.td-since::before {
        content: "Sejak";
    }
    
    .table tbody td.td-duration::before {
        content: "Durasi";
    }
    
    /* Biar font size tetap enak dibaca di mobile */
    .td-since,
    .td-duration {
        font-size: 12px;
    }
}

/* ========== AKHIR STYLING KOLOM BARU ========== */
