/*
------------------------------------------------------------------------------
 NodeSniff Agent - Lightweight Linux metrics collector

 Author: Sebastian Zieba <sebastian@zieba.art>
 License: GNU GPL v3 (non-commercial use only)

 This software is licensed under the terms of the GNU General Public License
 version 3 (GPLv3) as published by the Free Software Foundation, for
 non-commercial use only.

 For commercial licensing, please contact the author directly.
------------------------------------------------------------------------------
*/
html,
body {
    width: 100%;
    height: 100%;
    font-family:
        system-ui,
        -apple-system,
        "Segoe UI",
        Roboto,
        "Helvetica Neue",
        Arial,
        sans-serif;
    background-color: #f8f9fa;
    background-size: cover;
    flex-direction: column;
}

/* CSS for active server with blue vertical line */
.list-group-item.active {
    background-color: #f0f0f0 !important;
    font-weight: 600;
    color: #000 !important;
    border-left: 4px solid #0d6efd;
    border-right: 0;
    border-top: 1px solid #dcdcdc;
    border-bottom: 1px solid #dcdcdc;
    border-radius: 0;
}

.list-group-item {
    background: #fff;
    color: #000 !important;
    font-weight: 400;
    border: 1px solid #e6e6e6;
    border-left-width: 4px;
    border-right: none;
    border-radius: 0;
    padding: 0.5rem 1rem;
    transition:
        background-color 0.15s ease-in-out,
        border-left 0.15s ease-in-out;
}

/* Hover  */
.list-group-item:hover {
    background-color: #f8f9fa;
    border-left: 4px solid #6c757d;
}

.os-icon {
    height: 14px;
    width: auto;
    vertical-align: middle;
    opacity: 0.85;
    margin-left: 3px;
}

.server-edit-icon {
    font-size: 12px;
    color: #000;
    cursor: pointer;
    line-height: 1;
    padding-left: 2px;
    opacity: 0.6;
}

.server-edit-icon:hover {
    color: #444;
    opacity: 1;
}

/* Consistent typography */
.server-details p,
#servers li,
h5,
h6,
#servers li strong {
    font-size: 1rem;
    line-height: 1.2;
}

#empty-dashboard {
    position: fixed;
    inset: 0;
    z-index: 800;
    display: flex;
    justify-content: center;
    align-items: center;
    background: none; /* no overlay */
}

/* Bigger, pure white card, no radius, no extra shadow */
.empty-dashboard-card {
    min-width: 367px;
    max-width: 630px;
    width: 100%;
    background: #fff;
    border-radius: 0 !important;
    box-shadow: none; /* NO shadow */
    border: 1px solid #d2d2d2;
    padding: 34px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: center;
}

#sort-select {
    margin-right: 0px;
}

.server-details h5 {
    font-size: 1.1rem;
    margin-bottom: 1.6rem;
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.2rem;
}

.server-details .col-md-4 {
    padding: 15px;
}

.server-actions .btn,
button.btn {
    font-size: 0.875rem;
    padding: 0.35rem 0.75rem;
    border-radius: 0 !important;
}

/* Spinner on start */
.fullpage-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: white;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Server list */
#servers li {
    padding: 0.15rem 0.3rem;
    border: 1px solid #dee2e6;
    border-radius: 0 !important;
    margin-top: 4px;
    margin-right: 4px;
}

.status-online {
    color: #198754;
    font-weight: 600;
}
.status-offline {
    color: #000;
    font-weight: 600;
}
.status-alert {
    color: #dc3545;
    font-weight: 600;
}

.metric-bar {
    height: 6px;
    background: #f1f1f1;
    margin-bottom: 4px;
    overflow: hidden;
}

.metric-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.metric-fill.cpu {
    background-color: #0d6efd;
}
.metric-fill.ram {
    background-color: #0d6efd;
}
.metric-fill.disk {
    background-color: #0d6efd;
}

.metric-fill.warn {
    background-color: #ffc107 !important;
}
.metric-fill.crit {
    background-color: #dc3545 !important;
}

#serverDetails {
    position: relative;
}

#servers-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0;
    margin-top: 0;
    padding-top: 5px;
}

#top-processes-section td {
    vertical-align: middle;
}

.ram-bar {
    height: 8px;
    border-radius: 4px;
    background-color: #dee2e6;
    overflow: hidden;
}

.ram-bar-fill {
    height: 100%;
    background-color: #0d6efd;
}
.ram-high .ram-bar-fill {
    background-color: #dc3545;
}

.cpu-bar {
    height: 8px;
    border-radius: 4px;
    background-color: #dee2e6;
    overflow: hidden;
}

.cpu-bar-fill {
    height: 100%;
    background-color: #0d6efd;
}

.cpu-high .cpu-bar-fill {
    background-color: #dc3545; /* red for high CPU */
}

#top-processes-section,
#server-location-card {
    min-height: 280px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.row-eq-height {
    display: flex;
    flex-wrap: wrap;
}
.row-eq-height > [class*="col-"] {
    display: flex;
    flex-direction: column;
}
.row-eq-height .card {
    flex: 1;
}

.card,
.card-body,
.list-group,
.list-group-item {
    border-radius: 0 !important;
}

/* Force the server list column to take full height and white background */
#servers-wrapper {
    min-height: auto;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    height: auto;
}

/* Main column: ensures equal heights */
#main-content > .row {
    display: flex;
    align-items: stretch;
    margin: 0;
    padding: 0;
    padding-top: 60px;
}

/* The main detail card also fills the container */
#serverDetails {
    flex: 1 1 auto;
}

/* Static map image styling */
#geoip-spinner {
    z-index: 20;
}

#server-location-card .card-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

#ip-map {
    flex-grow: 1;
    min-height: 200px;
    height: 100%;
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 0;
}

.leaflet-container {
    height: 100% !important;
    width: 100% !important;
}

#detail-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1050; /* Ensure the spinner appears above other elements */
}

/* Spinner for servers details */
.spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.6);
    pointer-events: none;
}

#toggle-process-btn {
    font-size: 0.8rem;
    color: #6c757d;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0;
    padding: 0.35rem 0.75rem;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

#toggle-process-btn:hover {
    background-color: #f8f9fa;
    color: #6c757d;
}

.time-range-select {
    width: 120px;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0 !important;
    height: calc(1.5em + 0.5rem + 2px);
    background-color: #fff;
    border: 1px solid #dee2e6;
    color: #6c757d;
    appearance: none;
    box-shadow: none !important;
}

.time-range-select:focus {
    border-color: #ced4da;
    outline: none;
    box-shadow: none !important;
}

.time-range-select:hover {
    /*background-color: #f8f9fa;*/
    cursor: pointer;
}

#custom-date {
    width: 120px;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0 !important;
    height: calc(1.5em + 0.5rem + 2px);
    background-color: #fff;
    border: 1px solid #dee2e6;
    color: #6c757d;
    box-shadow: none !important;
    font-family:
        system-ui,
        -apple-system,
        "Segoe UI",
        Roboto,
        "Helvetica Neue",
        Arial,
        sans-serif;
}

#custom-date:hover {
    /*background-color: #f8f9fa;*/
    cursor: pointer;
}

#custom-date:focus {
    border-color: #dee2e6;
    outline: none;
    box-shadow: none !important;
}

#reset-now-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0 !important;
    height: calc(1.5em + 0.5rem + 2px);
    background-color: #fff;
    border: 1px solid #dee2e6;
    color: #6c757d;
    box-shadow: none !important;
}

.superuser-welcome {
    color: #dc3545 !important; /* Bootstrap red */
    font-weight: bold;
}

.server-details .card {
    border: 1px solid #dee2e6 !important;
    border-radius: 0 !important;
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
}
.modal.show {
    display: flex;
}

#serverModal .modal-content {
    border-radius: 0 !important;
    border: none;
}

#serverModal .form-control-lg {
    font-size: 1.1rem;
    padding: 0.7rem 1rem;
}

#serverModal .modal-header {
    background: #f8f9fa;
}

#serverModal .modal-footer {
    background: #f8f9fa;
}

input.form-control,
button.btn,
.btn,
.form-control {
    border-radius: 0 !important;
}

.alert {
    border-radius: 0 !important;
}

#servers {
    position: relative;
    overflow: visible !important;
}

#serverModal input.form-control {
    font-size: 1.1rem;
    padding: 0.7rem 1rem;
    width: 100%;
    min-width: 30ch;
}
/* arrow */
.list-group-item.active::after {
    content: "";
    position: absolute;
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 16px solid #0d6efd;
    z-index: 99999;
    pointer-events: none;
}

/* empty list of servers*/
#servers-empty-msg {
    border-radius: 10px;
}

/* empty details */
.empty-overlay {
    position: fixed;
    top: 62px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 62 px);
    z-index: 2000;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.empty-overlay > div {
    max-width: 480px;
    margin: 0 auto;
}

#companyKeyInput {
    font-size: 0.82rem;
    background-color: #f8f9fa;
    color: #333;
    width: 100px;
    min-width: 0;
    user-select: none;
    text-align: center;
    letter-spacing: 0.01em;
}

#copyKeyBtn {
    font-size: 1.08rem;
    border: 0;
}

.me-2 {
    margin-right: 0.5rem !important;
}

/* Modal User edit */
#profileModal .modal-content {
    margin-top: 60px;
    border-radius: 0 !important;
    border: none;
}

#profileModal .form-control-lg {
    font-size: 1.1rem;
    padding: 0.7rem 1rem;
}

#profileModal .modal-header {
    background: #f8f9fa;
}

#profileModal .modal-footer {
    background: #f8f9fa;
}

#profileModal input.form-control,
#profileModal button.btn,
#profileModal .btn,
#profileModal .form-control {
    border-radius: 0 !important;
}

#profileModal .alert {
    border-radius: 0 !important;
}

#profileDial {
    height: 38px;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border-radius: 0 !important;
    background-color: #e9ecef;
    text-align: center;
    margin-top: 2px;
}

#profilePhone {
    height: 38px;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border-radius: 0 !important;
    max-width: 150x;
}

.input-group-text {
    height: 38px;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border-radius: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.input-group {
    flex-shrink: 0;
}

/* Modal Token/Key */
#apiKeyModal .modal-dialog {
    width: 90vw;
    max-width: 500px;
    margin: 1.75rem auto;
}

@media (min-width: 768px) {
    #apiKeyModal .modal-dialog {
        width: 35%;
        max-width: none;
    }
}

#apiKeyModal .modal-content {
    border-radius: 0 !important;
}

#companyKeyInputModal {
    font-size: 0.82rem;
    background-color: #f8f9fa;
    color: #333;
    width: 100px;
    min-width: 0;
    user-select: none;
    text-align: center;
    letter-spacing: 0.01em;
    outline: none;
    box-shadow: none;
    border-radius: 0 !important;
}

/* Remove outline when the input is focused */
#companyKeyInputModal:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Rotate animation for the refresh icon */
@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
/* Default style for refresh icon - visible, but without animation */
#refreshIcon {
    display: inline-block;
    transition: transform 0.1s linear;
}

/* Footer */
#page-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding-top: 56px;
    box-sizing: border-box;
}
#main-content,
#empty-dashboard {
    flex-grow: 1;
    flex-direction: column;
}

/* Map Modal – only for #mapModal and children */
#mapModal .modal-content {
    border-radius: 0 !important;
}

#mapModal .modal-header,
#mapModal .modal-footer {
    background: #f8f9fa;
}

#mapModal .modal-header {
    border-bottom: 1px solid #dee2e6;
}

#mapModal .modal-footer {
    border-top: 1px solid #dee2e6;
}

#mapModal .modal-title {
    font-weight: 600;
}

#mapModal .modal-body {
    height: 70vh !important;
    min-height: 320px;
    padding: 0 !important;
    position: relative;
}

#leaflet-map-container-modal {
    width: 100%;
    height: 100% !important;
    min-height: 320px;
    display: block !important;
    border-radius: 0 !important;
}

#map-spinner {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 480px;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
}

#mapModal .modal-dialog {
    max-width: 90vw;
    margin: 3vh auto;
}
#map-refresh-spinner {
    vertical-align: middle;
}

.modal-footer {
    justify-content: space-between;
}

.map-legend > div {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
}
#leaflet-map-inner {
    width: 100%;
    height: 100%;
    position: relative;

    pointer-events: auto;
}
/* Tool Tips */
.leaflet-popup-content-wrapper {
    padding: 1px 1px;
    border-radius: 3px;
    font-size: 0.75rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    display: inline-block;
    margin-top: 4px;
}

/* To make a map active, able to scroll, move */
#mapModal .modal-body,
#leaflet-map-inner,
.leaflet-container {
    pointer-events: auto !important;
    z-index: 10 !important;
}
/* let's hide welcome on small screens and phones */
@media (max-width: 768px) {
    #welcome {
        display: none !important;
    }
}
