/*****************************************************/
/* BASE - Styles partages a toutes les pages          */
/* (fonts, couleurs, layout commun). A charger AVANT  */
/* le CSS specifique de chaque page.                  */
/*****************************************************/

@font-face {
    font-family: 'GlacialIndifference Regular';
    src: url('fonts/glacial-indifference/GlacialIndifference-Regular.otf') format('truetype');
}
@font-face {
    font-family: 'GlacialIndifference Italic';
    src: url('fonts/glacial-indifference/GlacialIndifference-Italic.otf') format('truetype');
}

:root {
    --font-primary: 'GlacialIndifference Regular', sans-serif;
    --color-bg: #111;
    --color-text: #fff;
    --color-panel-bg: rgba(53, 53, 53, 0.5);
    --color-accent: #ff6b00;
    --navbar-height: 42px;

    --cpu-load-perc: 0;
    --mem-usage-perc: 0;
    --disk-usage-perc: 0;
}


/**************/
/* BACKGROUND */
/**************/

body {
    background-color: var(--color-bg);
    margin: 0;
}

.layer_wrapper {
    z-index: -1;
    overflow: hidden;
    position: fixed;
    right: 0px;
    top: 0px;
    width: 100vw;
    height: 100vh;
}

.background-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.75;
    object-fit: cover;
}


/************/
/* SECTIONS */
/************/

header {
    z-index: 2;
    position: relative;
}

main {
    position: relative;
    z-index: 3;
    padding: 40px 0px;
}

footer {
    display: block;
    position: relative;
}


/*****************/
/*** ECRITURES ***/
/*****************/

h1 {
    display: block;
    margin: 20px;
    font-family: var(--font-primary);
    font-size: 60px;
    font-weight: 100;
    color: var(--color-text);
    text-align: center;
}

h2 {
    position: relative;
    text-align: center;
    color: var(--color-text);
    font-weight: 300;
    font-family: var(--font-primary);
    font-size: 25px;
    display: block;
}

label {
    margin: 20px 0px;
    font-family: var(--font-primary);
    font-weight: 300;
    font-size: 20px;
    color: var(--color-text);
    display: block;
    padding-top: 5px;
}

p {
    font-family: var(--font-primary);
    text-align: center;
    color: var(--color-text);
    opacity: 0.5;
    font-weight: 100;
    font-size: 20px;
}

.hidden {
    display: none;
}

/* Reserve le contenu aux lecteurs d'ecran (labels de champs, etc.) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/**********/
/* NAVBAR */
/**********/
/* Barre fine et discrete, commune a toutes les pages (voir components/navbar.js) */

.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
    background-color: rgba(17, 17, 17, 0.7);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1000;
}

.nav-brand {
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 300;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--color-accent);
    text-decoration: none;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
}

.nav-toggle {
    display: none;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.06);
    cursor: pointer;
}

.nav-toggle span {
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background-color: #fff;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-link {
    font-family: var(--font-primary);
    font-size: 13px;
    letter-spacing: 0.3px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 10px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
    color: var(--color-accent);
    background-color: rgba(255, 107, 0, 0.12);
}

@media (max-width: 700px) {
    :root {
        --navbar-height: 44px;
    }

    .site-nav {
        padding: 0 12px;
        gap: 8px;
    }

    .nav-brand {
        font-size: 11px;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .nav-links {
        position: absolute;
        top: calc(100% + 8px);
        right: 12px;
        left: 12px;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        overflow-x: visible;
        padding: 8px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 14px;
        background-color: rgba(17, 17, 17, 0.92);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
        backdrop-filter: blur(10px);
    }

    .site-nav.is-open .nav-links {
        display: flex;
    }

    .site-nav.is-open .nav-toggle span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }

    .site-nav.is-open .nav-toggle span:nth-child(2) {
        opacity: 0;
    }

    .site-nav.is-open .nav-toggle span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    .nav-link {
        font-size: 11px;
        padding: 9px 10px;
        border-radius: 8px;
    }
}


/******************/
/* LIST TOOLBAR   */
/******************/
/* Barre d'outils de liste (tri, filtres...), reutilisable sur toute page a cartes/lignes */

.list-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 auto 20px;
}

.sort-select {
    font-family: var(--font-primary);
    font-size: 14px;
    color: var(--color-text);
    background-color: rgba(53, 53, 53, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 8px 16px;
    backdrop-filter: blur(5px);
    cursor: pointer;
    outline: none;
}

.sort-select:focus {
    border-color: var(--color-accent);
}

.sort-select option {
    background-color: #222;
    color: #fff;
}


/************************/
/* ETATS CHARGEMENT/ERREUR */
/************************/
/* Bannière ou message inline uniforme, injecté par utils/ui_state.js */

.state-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: var(--font-primary);
    font-size: 16px;
    padding: 14px 20px;
    margin: 10px auto;
    max-width: 600px;
    border-radius: 14px;
    text-align: center;
}

.state-message-loading {
    color: rgba(255, 255, 255, 0.8);
    background-color: rgba(53, 53, 53, 0.5);
}

.state-message-error {
    color: #ffb3b3;
    background-color: rgba(255, 71, 87, 0.15);
    border: 1px solid rgba(255, 71, 87, 0.4);
}

.state-message .spinner {
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    flex-shrink: 0;
    animation: state-spin 0.8s linear infinite;
}

@keyframes state-spin {
    to { transform: rotate(360deg); }
}


/**********/
/* POP-UP */
/**********/
/* Shared modal overlay: dashboard uses .pop-up/.modal-content, services uses .logs-pop-up/#apache-logs */

.pop-up,
.logs-pop-up {
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content,
#apache-logs {
    background-color: #171717;
    margin: 20vh auto;
    padding: 20px;
    max-width: 1000px;
    border-radius: 20px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}


/*******************/
/*** SPEEDOMETER ***/
/*******************/
/* Shared by the CPU/RAM/disk gauges on dashboard.html and services.html */

.meter {
    height: 200px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    color: #fff;
    transition: transform 0.3s ease;
    z-index: 5;
}

.meter:hover {
    transform: scale(1.1);
    cursor: pointer;
}

@keyframes rotate-cpu {
    from { transform: rotate(-140deg); }
    to { transform: rotate(var(--cpu-load-perc)); }
}
.aiguille-svg-cpu {
    animation: rotate-cpu 5s linear forwards;
    transform-origin: 50% 57%;
}

@keyframes rotate-mem {
    from { transform: rotate(-140deg); }
    to { transform: rotate(var(--mem-usage-perc)); }
}
.aiguille-svg-mem {
    animation: rotate-mem 5s linear forwards;
    transform-origin: 50% 57%;
}

@keyframes rotate-disk {
    from { transform: rotate(-140deg); }
    to { transform: rotate(var(--disk-usage-perc)); }
}
.aiguille-svg-disk {
    animation: rotate-disk 5s linear forwards;
    transform-origin: 50% 57%;
}


/**************/
/*** LEGEND ***/
/**************/

.custom-legend {
    display: flex;
    align-items: center;
}

.legend-item {
    margin-right: 20px;
    display: flex;
    align-items: center;
    font-size: 15px;
    text-align: end;
}

.legend-color {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.blue {
    background-color: #3e95cd;
}

.green {
    background-color: rgba(164, 128, 207, 1);
}


/**********/
/* ALERTS */
/**********/

.alerts {
    display: block;
    background-color: rgba(159, 159, 159, 0.5);
    border-radius: 20px;
    position: relative;
    margin: 10px;
    padding-left: 15px;
    padding-right: 15px;
}

.alerts label,
.alerts p {
    display: inline-block;
    font-size: 20px;
    color: var(--color-text);
    opacity: 1;
    font-weight: 100;
    padding-top: 0px;
}


/***************/
/*** TRAFFIC ***/
/***************/

.traffic-title {
    margin-bottom: 0px;
}

.traffic-panel {
    display: grid;
    grid-template-rows: auto 1fr;
    grid-gap: 10px;
}

#line-chart {
    width: 100%;
    height: 100%;
}
