/* -------------------------------------------------
   1. Global settings & color palette
   ------------------------------------------------- */
:root {
    /* Dark theme - body & card backgrounds */
    --bg-body:     #2c3e50;   /* main page background */
    --bg-card:     #34495e;   /* card / panel background */
    --bg-sidebar:  #3d566e;   /* sidebar background (slightly lighter) */
    /* Accent / link colour */
    --clr-accent:  #3498db;   /* blue accent for links */
    /* Text colour */
    --clr-text:    #ecf0f1;   /* light whiteish text */
    /* Borders / accents */
    --clr-border:  #1f2b38;   /* dark border colour */
}

* { box-sizing: border-box; }

/* Body */
body {
    margin: 0;
    padding: 0;
    background: var(--bg-body);
    color: var(--clr-text);
    font-family: Arial, Helvetica, sans-serif;
}

/* Links */
a { color: var(--clr-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* -------------------------------------------------
   2. Layout - wrapper, sidebar, main
   ------------------------------------------------- */
.wrapper { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed;          /* keep sidebar visible during scroll */
    top: 0;                   /* stick to the top of the viewport */
    left: 0;                  /* align to the left edge */
    height: 100vh;            /* full viewport height */
    /* ---- size & spacing ------------------------------------------- */
    width: 200px;             /* same as before */
    padding: 1rem;
    overflow-y: auto;         /* allow sidebar content to scroll if needed */
    /* ---- look ------------------------------------------------------- */
    background: var(--bg-sidebar);
    /* optional: keep it above other content */
    z-index: 1000;
}
.sidebar h3 { margin: 0 0 .4rem 0; font-size: 1.1rem; }
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar ol { list-style: none; padding: 0; margin: 0; }
.sidebar li { margin-bottom: .4rem; }
.sidebar a { color: var(--clr-accent); }
.sidebar a.active { font-weight: bold; }

.main{
    flex: 1;
    padding: 1rem;
    padding-left: 200px;   /* space for the fixed sidebar */
    /* optional: avoid accidental horizontal overflow */
    overflow-x: hidden;
}
/* -------------------------------------------------
   3. Card component
   ------------------------------------------------- */
.card {
    max-width: 950px;
    margin: 20px auto 1rem auto;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--clr-border);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,.3);
}

/* -------------------------------------------------
   4. Tables
   ------------------------------------------------- */
table, th, td {
    border: 2px solid var(--clr-border);
    border-collapse: collapse;
}
th, td { padding: 10px; }

/* Alternate row colour for metrics table */
#host_metrics_table tbody tr td:nth-of-type(even) {
    background: #3e5c78;   /* slight contrast */
}

/* -------------------------------------------------
   5. Lists & headings
   ------------------------------------------------- */
h1, h2, h3, h4 { color: var(--clr-text); margin: 0 0 .4rem 0; }
ul { list-style: none; padding: 0; }
ol { list-style: none; padding: 0; }
li { margin-bottom: 10px; color: var(--clr-text); }

/* System & component lists */
.system-list, .info-list {
    list-style: none; padding: 0; margin: 0;
}
.system-list li, .info-list li { margin-bottom: 5px; color: var(--clr-text); }

/* -------------------------------------------------
   6. Components grid
   ------------------------------------------------- */
.components {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.component {
    padding: 10px;
    border: 1px solid var(--clr-border);
    border-radius: 4px;
}
.component h3 { margin: 0 0 5px; }

/* -------------------------------------------------
   7. Panel toggles / modal
   ------------------------------------------------- */
.help-link {
    cursor: pointer;
    user-select: none;
    color: var(--clr-accent);
    text-align: right;
}
.help-link:hover { text-decoration: underline; }
#helpText { display: none; }

.componentDetail-link {
    cursor: pointer;
    user-select: none;
    color: var(--clr-accent);
    text-align: left;
}
.componentDetail-link:hover { text-decoration: underline; }
#componentDetailText { display: none; }


/* -------------------------------------------------
   8. Misc helpers
   ------------------------------------------------- */
/* Hide numeric markers in metric columns (if any) */
#host_metrics_column td { list-style: none; padding-left: 0; margin-left: 0; }

.host-status {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 6px;
    margin-right: 8px;
    vertical-align: middle;
    background: #808080;          /* default – unknown / no timestamp */
    transition: background-color 1s linear;   /* smooth fade */
}


/* -------------------------------------------------
   9. Mobile adjustments
   ------------------------------------------------- */
@media (max-width: 768px) {
  /* 1. Make the whole page a column */
  .wrapper {
    flex-direction: column;
  }

  /* 2. Hide the sidebar initially */
  .sidebar {
    position: relative;          /* take it out of the flow */
    width: 100%;
    max-height: 0;               /* collapsed */
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: var(--bg-sidebar);
    padding: 0;                  /* remove padding */
  }

  .sidebar.show {
    max-height: 500px;           /* enough for all items */
    padding: 1rem;
  }

  /* 3. Move the toggle button into the header */
  .mobile-toggle {
    display: block;
    font-size: 1.5rem;
    background: transparent;
    border: none;
    color: var(--clr-accent);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
  }

  /* 4. Main content no left padding */
  .main {
    padding-left: 0;
    padding-right: 1rem;
  }

  /* 5. Table scroll on small screens */
  .card table {
    width: 100%;
    table-layout: fixed;
  }

  .card table thead,
  .card table tbody,
  .card table tr,
  .card table td,
  .card table th {
    display: block;
  }

  .card table tbody {
    overflow-x: auto;
    white-space: nowrap;
  }

  .card table td,
  .card table th {
    display: inline-block;
    vertical-align: top;
    width: 30%;
  }

  /* 6. Adjust the host status dot positioning */
  .host-status {
    margin-left: 2px;
    margin-right: 12px;
  }
}

/* Optional: style the drawer indicator */
.sidebar.show::before {
  content: "✕ Close";
  display: block;
  padding: 0.5rem 1rem;
  background: var(--bg-sidebar);
  color: var(--clr-accent);
  font-weight: bold;
}

