body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
}

header, footer {
    background-color: #f4f4f4;
    padding: 1em;
    text-align: center;
}

main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.scrollable {
  overflow: auto;        /* Enables scrollbars when needed */
  max-width: 100%;       /* Prevents overflow outside parent (optional) */
  max-height: 100%;      /* Optional: Set a fixed height or use 100% */
}

/* Ensure shadow DOM content is scrollable */
.box-content > * {
    overflow: auto;
    height: 100%;
    width: 100%;
}

.default, .default * {
  all: initial;          /* Reset all inherited styles */
  display: revert;       /* Revert layout so elements still appear */
  font-family: sans-serif; /* Reapply needed styles */
}

.grid-nav-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1700px;
    margin: 0 auto;
}

.grid-nav-btn {
    background: #696969;
    color: white;
    border: none;
    font-size: 2em;
    width: 50px;
    height: 100%;
    cursor: pointer;
    border-radius: 8px;
    margin: 0 10px;
    transition: background 0.2s;
}
.grid-nav-btn:disabled {
    background: #ccc;
    color: #888;
    cursor: not-allowed;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(300px, 1fr));
    grid-template-rows: repeat(2, minmax(200px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1600px;
    max-height: 840px;
    margin: 0 auto;
    box-sizing: border-box;
    min-height: 820px;
}

/* Responsive stacking for small screens */
@media (max-width: 900px) {
    .grid-container {
        grid-template-columns: 1fr;
        grid-template-rows: none; /* Let rows auto-size */
        width: 100%;
        height: auto;
        max-width: 100%;
    }
    .box {
        min-width: 0;
        min-height: 410px;
        max-height: 410px; /* Add this line to constrain height when stacked */
        height: auto; /* Let box grow naturally */
    }
}

.row {
    display: flex;
    align-items: center;
    gap: 15px; /* Space between elements */
    width: 100%; /* Ensure everything stays on one line */
}

.log-select, .log-input {
    max-width: 150px;
    width: 100%;
}

/* Group the search input and buttons */
.logs-search-group {
    display: flex;
    align-items: center;
    gap: 0; /* Make the search input and buttons touch */
}

/* Stacking up/down buttons */
.button-stack {
    display: flex;
    flex-direction: column;
    margin-left: 5px; /* Small space between search and buttons */
}

.small-box {
    width: 60px;
    height: 30px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid grey;
    background: white;
    color: black;
}

.small-btn {
    width: 30px;
    height: 30px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.stack-btn {
    width: 15px;
    height: 15px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.box {
    background-color: #D3D3D3;
    color: white;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    width: 100%;
    height: 100%;
    min-height: 410px;
    box-sizing: border-box;
    overflow: hidden;
}

.box-header {
    background-color: #696969;
    padding: 15px;
    text-align: center;
    font-size: 1.5em;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.box-options {
    background-color: #A9A9A9;
    padding: 15px;
    text-align: center;
    font-size: 1em;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 10px;
}

.box-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 0;
    box-sizing: border-box;
    overflow: auto;
    height: 100%;
}

.text-box {
    flex-grow: 1; 
    overflow-y: auto;
    overflow-x: auto;
    font-size: 12px;
    color: black;
    text-align: left;
    overflow-wrap: break-word;
    max-height: 100%;
    box-sizing: border-box;
}

.column-4 {
    flex: 1;
    min-width: 100px;
}

button {
    padding: 5px 10px;
}

/* When only one box is visible, it should span all four areas */
.box.full {
    grid-area: 1 / 1 / 3 / 3; /* Span all grid areas */
    max-height: 100vh; /* Prevent box from exceeding viewport height */
}

.box.full .box-content {
    max-height: calc(100vh - 120px); /* Account for header and padding */
    overflow: auto;
}

#searchCount{
    display: inline-block;  /* Ensures the count stays on one line */
    white-space: nowrap;    /* Prevents text from wrapping */
    margin-left: 10px;      /* Optional, adds space between elements */
}

.highlight {
    background-color: rgba(167, 167, 67, 0.767);
    color: black;
}

.currentHighlight {
    background-color: yellow;
    color: black;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 1rem;
  background-color: #f9f9f9;
}

.statusContainer {
  overflow-y: auto;
  padding-right: 10px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 20px solid;
  padding: 1rem;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.status-item.online {
  border-color: #2ecc71;
}

.status-item.stopped {
  border-color: #e74c3c;
}

.status-item.stopping {
  border-color: #e74c3c;
}

.left-section {
  display: flex;
  flex-direction: column;
}

.serviceName {
  font-weight: bold;
  font-size: 1.1em;
  color: #000;
}

.instance {
  font-size: 0.9em;
  color: #777;
}

.right-section {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.9em;
}

.serviceMetric {
  color: #333;
}
