:root {
    --background: #09070d;
    --surface: #110d18;
    --surface-light: #17121f;

    --purple: #8b5cf6;
    --purple-hover: #9b6cff;
    --purple-soft: rgba(139, 92, 246, 0.16);

    --text: #f5f3ff;
    --text-muted: #91899d;

    --border: #261d31;
    --input: #0c0911;

    --danger: #f87171;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    background:
        radial-gradient(
            circle at top center,
            rgba(139, 92, 246, 0.08),
            transparent 35%
        ),
        var(--background);

    color: var(--text);

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}


/* =====================================================
   LOGIN
===================================================== */

.login-container {
    min-height: 100vh;

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

    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;

    background:
        linear-gradient(
            145deg,
            rgba(23, 18, 31, 0.98),
            rgba(13, 10, 18, 0.98)
        );

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

    border-radius: 18px;

    padding: 32px;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.45),
        0 0 40px rgba(139, 92, 246, 0.06);
}

.login-card h1 {
    margin: 0;

    font-size: 28px;
    letter-spacing: 2px;
}

.login-card p {
    margin: 8px 0 28px;

    color: var(--text-muted);
}


/* =====================================================
   FORM
===================================================== */

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;

    margin-bottom: 8px;

    color: var(--text-muted);

    font-size: 14px;
}

.form-group input {
    width: 100%;

    padding: 13px 14px;

    background: var(--input);

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

    border-radius: 10px;

    color: var(--text);

    outline: none;

    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.form-group input:focus {
    border-color: var(--purple);

    box-shadow:
        0 0 0 3px var(--purple-soft);
}

.login-card form button {
    width: 100%;

    border: none;

    padding: 13px;

    border-radius: 10px;

    background: var(--purple);

    color: white;

    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.2s,
        transform 0.15s;
}

.login-card form button:hover {
    background: var(--purple-hover);
}

.login-card form button:active {
    transform: scale(0.98);
}

#error-message {
    margin-top: 14px;

    color: var(--danger);

    font-size: 14px;

    text-align: center;
}


/* =====================================================
   DASHBOARD
===================================================== */

.dashboard {
    width: 100%;
    max-width: 1100px;

    margin: 0 auto;

    padding: 28px 20px 50px;
}


/* =====================================================
   HEADER
===================================================== */

.dashboard-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 28px;
}

.dashboard-header h1 {
    margin: 0;

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

.dashboard-header p {
    margin: 6px 0 0;

    color: var(--text-muted);
}


/* =====================================================
   LOGOUT
===================================================== */

.logout-button {
    border: 1px solid var(--border);

    background: var(--surface);

    color: var(--text);

    padding: 9px 15px;

    border-radius: 9px;

    cursor: pointer;

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

.logout-button:hover {
    background: var(--surface-light);

    border-color: var(--purple);
}


/* =====================================================
   SYSTEM CARDS
===================================================== */

.dashboard-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 14px;
}


/*
   Jarak antar kelompok dashboard.

   Grid pertama = CPU / RAM / SWAP / STORAGE
   Grid kedua   = UPTIME / LOAD / NODE / SYSTEM
*/
.dashboard-grid + .dashboard-grid {
    margin-top: 16px;
}


/* =====================================================
   DASHBOARD CARD
===================================================== */

.dashboard-card {
    position: relative;

    overflow: hidden;

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

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

    border-radius: 14px;

    padding: 20px;

    min-height: 112px;

    display: flex;

    flex-direction: column;

    justify-content: space-between;

    transition:
        border-color 0.2s,
        transform 0.2s,
        box-shadow 0.2s;
}

.dashboard-card:hover {
    border-color: rgba(139, 92, 246, 0.28);

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.16);
}

.dashboard-card::after {
    content: "";

    position: absolute;

    width: 100px;
    height: 100px;

    right: -50px;
    bottom: -50px;

    background: var(--purple);

    opacity: 0.05;

    border-radius: 50%;

    pointer-events: none;
}


/* =====================================================
   CARD LABEL
===================================================== */

.card-label {
    color: var(--text-muted);

    font-size: 13px;

    text-transform: uppercase;

    letter-spacing: 0.8px;

    line-height: 1.2;
}


/* =====================================================
   CARD MAIN VALUE
===================================================== */

.dashboard-card strong {
    display: block;

    margin-top: 12px;

    font-size: 25px;

    line-height: 1.15;

    color: var(--text);

    overflow-wrap: anywhere;
}


/* =====================================================
   CARD DETAIL
===================================================== */

.card-detail {
    display: block;

    margin-top: 6px;

    color: var(--text-muted);

    font-size: 12px;

    line-height: 1.45;

    overflow-wrap: anywhere;
}


/* =====================================================
   SECTIONS
===================================================== */

.upload-section,
.bot-section {
    margin-top: 26px;
}

.section-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-bottom: 14px;
}

.section-header h2 {
    margin: 0;

    font-size: 19px;
}


/* =====================================================
   UPLOAD CARD
===================================================== */

.upload-card {
    background:
        linear-gradient(
            145deg,
            var(--surface-light),
            var(--surface)
        );

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

    border-radius: 14px;

    padding: 20px;
}

.upload-description {
    margin: 0 0 18px;

    color: var(--text-muted);

    line-height: 1.6;

    font-size: 14px;
}

#bot-zip {
    display: block;

    width: 100%;

    padding: 12px;

    background: var(--input);

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

    border-radius: 10px;

    color: var(--text-muted);

    margin-bottom: 14px;
}

#bot-zip::file-selector-button {
    border: 1px solid var(--border);

    background: var(--surface-light);

    color: var(--text);

    padding: 8px 12px;

    border-radius: 7px;

    cursor: pointer;

    margin-right: 10px;
}

.upload-status {
    min-height: 21px;

    margin-top: 14px;

    color: var(--text-muted);

    font-size: 14px;
}


/* =====================================================
   BUTTONS
===================================================== */

.primary-button,
.danger-button,
.secondary-button {
    border: none;

    border-radius: 9px;

    padding: 10px 14px;

    font-size: 14px;

    font-weight: 600;

    cursor: pointer;

    transition:
        opacity 0.2s,
        transform 0.15s;
}

.primary-button:hover,
.danger-button:hover,
.secondary-button:hover {
    opacity: 0.9;
}

.primary-button:active,
.danger-button:active,
.secondary-button:active {
    transform: scale(0.98);
}


/* =====================================================
   GREEN START / RESTART
===================================================== */

.primary-button {
    background: #22c55e;

    color: #061006;
}

.primary-button:hover {
    background: #16a34a;

    opacity: 1;
}


/* =====================================================
   DANGER / CANCEL
===================================================== */

.danger-button {
    background: #dc2626;

    color: #ffffff;

    padding: 10px 16px;

    border-radius: 8px;

    cursor: pointer;

    font-weight: 600;
}

.danger-button:hover {
    background: #ef4444;

    opacity: 1;
}


/* =====================================================
   SECONDARY / STOP
===================================================== */

.secondary-button {
    background: var(--surface-light);

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

    color: var(--text);
}


/* =====================================================
   DISABLED
===================================================== */

.primary-button:disabled,
.danger-button:disabled,
.secondary-button:disabled {
    opacity: 0.5;

    cursor: not-allowed;
}


/* =====================================================
   DELETE
===================================================== */

.delete-button {
    border: none;

    border-radius: 9px;

    padding: 10px 14px;

    font-size: 14px;

    font-weight: 600;

    cursor: pointer;

    background: #7f1d1d;

    color: #fecaca;

    transition:
        background 0.2s,
        transform 0.15s,
        opacity 0.2s;
}

.delete-button:hover {
    background: #991b1b;
}

.delete-button:active {
    transform: scale(0.98);
}


/* =====================================================
   BOT LIST
===================================================== */

#bot-list {
    display: flex;

    flex-direction: column;

    gap: 14px;
}


/* =====================================================
   BOT CARD
===================================================== */

.bot-card {
    background:
        linear-gradient(
            145deg,
            var(--surface-light),
            var(--surface)
        );

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

    border-radius: 14px;

    padding: 18px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.12);
}


/* =====================================================
   BOT INFO
===================================================== */

.bot-info {
    display: flex;

    align-items: center;

    gap: 13px;

    min-width: 0;
}


/* =====================================================
   BOT AVATAR
===================================================== */

.bot-icon {
    width: 48px;
    height: 48px;

    flex-shrink: 0;

    display: flex;

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

    border-radius: 13px;

    background:
        linear-gradient(
            145deg,
            rgba(139, 92, 246, 0.22),
            rgba(139, 92, 246, 0.08)
        );

    border: 1px solid rgba(
        139,
        92,
        246,
        0.25
    );

    font-size: 22px;

    box-shadow:
        0 5px 18px rgba(
            0,
            0,
            0,
            0.18
        );
}


/* =====================================================
   BOT DETAILS
===================================================== */

.bot-details {
    min-width: 0;
}

.bot-info h3 {
    margin: 0 0 6px;

    font-size: 16px;

    word-break: break-word;
}


/* =====================================================
   STATUS
===================================================== */

.status {
    display: inline-flex;

    align-items: center;

    gap: 7px;

    font-size: 13px;

    font-weight: 600;
}

.status::before {
    content: "";

    width: 8px;
    height: 8px;

    flex-shrink: 0;

    border-radius: 50%;
}


/* =====================================================
   ONLINE = GREEN DOT
===================================================== */

.status.online {
    color: #4ade80;
}

.status.online::before {
    background: #4ade80;

    box-shadow:
        0 0 8px rgba(
            74,
            222,
            128,
            0.8
        );
}


/* =====================================================
   OFFLINE = GRAY DOT
===================================================== */

.status.offline {
    color: #9ca3af;
}

.status.offline::before {
    background: #6b7280;

    box-shadow: none;
}


/* =====================================================
   BOT ACTIONS
===================================================== */

.bot-actions {
    display: flex;

    align-items: center;

    gap: 8px;

    flex-shrink: 0;
}


/* =====================================================
   EMPTY
===================================================== */

.empty-bots {
    background: var(--surface);

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

    border-radius: 14px;

    padding: 25px;

    color: var(--text-muted);

    text-align: center;
}


/* =====================================================
   MOBILE
===================================================== */

@media (max-width: 700px) {

    .dashboard {
        padding:
            20px 14px 40px;
    }

    .dashboard-header {
        align-items: flex-start;
    }

    .dashboard-header h1 {
        font-size: 25px;
    }

    .dashboard-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 12px;
    }

    /*
       Tetap ada jarak yang jelas antara:
       CPU/RAM/SWAP/STORAGE
       dan
       UPTIME/LOAD/NODE/SYSTEM
    */
    .dashboard-grid + .dashboard-grid {
        margin-top: 14px;
    }

    .dashboard-card {
        min-height: 108px;

        padding: 16px;
    }

    .dashboard-card strong {
        font-size: 22px;
    }

    .card-detail {
        font-size: 11.5px;

        line-height: 1.4;
    }

    .bot-card {
        align-items: stretch;

        flex-direction: column;
    }

    .bot-actions {
        width: 100%;
    }

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


/* =====================================================
   SMALL MOBILE
===================================================== */

@media (max-width: 420px) {

    .dashboard {
        padding:
            18px 12px 35px;
    }

    .dashboard-grid {
        gap: 10px;
    }

    .dashboard-grid + .dashboard-grid {
        margin-top: 12px;
    }

    .dashboard-card {
        padding: 14px;

        min-height: 100px;

        border-radius: 12px;
    }

    .card-label {
        font-size: 11px;

        letter-spacing: 0.6px;
    }

    .dashboard-card strong {
        margin-top: 9px;

        font-size: 20px;
    }

    .card-detail {
        margin-top: 5px;

        font-size: 10.5px;
    }

    .section-header h2 {
        font-size: 17px;
    }

    .upload-card {
        padding: 15px;
    }

    .bot-card {
        padding: 15px;
    }

    .bot-icon {
        width: 44px;
        height: 44px;

        border-radius: 11px;

        font-size: 20px;
    }
}


/* =====================================================
   VERY SMALL PHONE
===================================================== */

@media (max-width: 340px) {

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

    .dashboard-grid + .dashboard-grid {
        margin-top: 12px;
    }

    .dashboard-card {
        min-height: 92px;
    }
}