/* âš™ï¸ Advanced Command Center - Modern Dark Theme */
:root {
  --background: #131417;
  --primary: #1E1F22;
  --secondary: #25262A;
  --highlight: #00ccff;
  --text-color: #ffffff;
  --shadow-color: rgba(0, 0, 0, 0.4);
  --hover-color: #00aaff;
  --danger-color: #ff3366;
}

body {
  font-family: "Poppins", sans-serif;
  background: var(--background);
  color: var(--text-color);
  margin: 0;
  padding: 0;
}

/* Navigation Bar */
.navbar {
  display: flex;
  justify-content: space-between;
  padding: 15px;
  background: var(--primary);
  box-shadow: 0 4px 10px var(--shadow-color);
  align-items: center;
}

.navbar .logo {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--highlight);
}

.navbar .logout {
  background: var(--highlight);
  color: black;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: 0.3s;
}

.navbar .logout:hover {
  background: var(--danger-color);
}

/* Sidebar */
.sidebar {
  width: 250px;
  height: 100vh;
  position: fixed;
  background: var(--primary);
  padding-top: 20px;
  box-shadow: 2px 0 10px var(--shadow-color);
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar ul li {
  padding: 15px;
  color: var(--text-color);
  font-size: 1.2rem;
  cursor: pointer;
  transition: 0.3s;
}

.sidebar ul li:hover {
  background: var(--highlight);
  color: black;
}

/* Main Content */
.container {
  margin-left: 270px;
  padding: 20px;
}

.hidden {
  display: none;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

/* Cards */
.card {
  background: var(--secondary);
  padding: 15px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 4px 10px var(--shadow-color);
}

.card h3 {
  color: var(--highlight);
  margin-bottom: 10px;
}

.card p {
  font-size: 1.5rem;
  font-weight: bold;
}

/* Dashboard Recent Panels (stacked vertically) */
.dashboard-recent {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 30px;
}

.recent-section {
  width: 100%;
}

.recent-section table {
  width: 100%;
  border-collapse: collapse;
}

.recent-section th,
.recent-section td {
  padding: 10px;
  border: 1px solid #444;
  text-align: left;
}

.recent-section th {
  background: var(--primary);
}

/* Recent Logs Section (in Logs view) */
.recent-logs {
  margin-top: 20px;
}

.recent-logs h2 {
  color: var(--highlight);
  margin-bottom: 10px;
}

.recent-logs table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.recent-logs table th,
.recent-logs table td {
  padding: 10px;
  border: 1px solid #444;
  text-align: left;
}

/* Logs Controls */
.logs-controls {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 10px;
}

.logs-controls input {
  width: 300px;
  padding: 10px;
  border: 1px solid var(--shadow-color);
  border-radius: 5px;
  background: var(--secondary);
  color: var(--text-color);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

table, th, td {
  border: 1px solid #444;
}

th, td {
  padding: 10px;
  text-align: left;
}

th {
  background: var(--primary);
}

tr:nth-child(even) {
  background: var(--secondary);
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

/* Buttons */
button {
  background: var(--highlight);
  color: black;
  border: none;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: 0.3s;
}

button:hover {
  background: var(--danger-color);
}

input, select {
  padding: 10px;
  width: 100%;
  border: none;
  background: var(--primary);
  color: var(--text-color);
  border-radius: 5px;
  margin-top: 5px;
}

.pagination {
  display: flex;
  align-items: center;     /* Vertically center items */
  justify-content: center; /* Center the whole group horizontally */
  gap: 10px;               /* Spacing between elements */
  margin-top: 10px;
}

.pagination button {
  background: var(--highlight);
  color: black;
  border: none;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: 0.3s;
}

.pagination button:hover {
  background: var(--danger-color);
}

/* Style the page number so it doesn't look squeezed between buttons */
.pagination #current-page {
  background: var(--secondary);
  padding: 8px 12px;
  border-radius: 5px;
  color: var(--text-color);
  font-weight: bold;
  min-width: 40px;     /* Ensures some minimum width */
  text-align: center;
}


/* Logs Controls */
.logs-controls {
  display: flex;
  flex-wrap: wrap;      /* Allows items to wrap to the next line if needed */
  align-items: center;
  gap: 10px;            /* Creates a 10px gap between all child elements (labels, inputs, buttons) */
  margin-bottom: 10px;
}

.logs-controls label {
  margin-right: 5px;    /* Extra spacing between label and input */
}

/* Ensure buttons match the theme and have consistent spacing */
.logs-controls button {
  background: var(--highlight);
  color: black;
  border: none;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: 0.3s;
}

/* Hover effect on the buttons */
.logs-controls button:hover {
  background: var(--danger-color);
}

/* Optional: if you have multiple .logs-controls blocks back to back,
   this adds extra spacing between them */
.logs-controls + .logs-controls {
  margin-top: 10px;
}

/* Truncate large multi-line outputs */
.truncate-output {
  position: relative;
  max-height: 4em;                 /* Limit to about 4 lines */
  overflow: hidden;
  display: -webkit-box;            /* Multiline truncation (WebKit browsers) */
  -webkit-line-clamp: 4;           /* Number of lines to show */
  -webkit-box-orient: vertical;    
  white-space: normal;
  word-wrap: break-word;
  margin-bottom: 5px;
}

.see-more {
  color: var(--highlight);
  cursor: pointer;
  text-decoration: underline;
  display: inline-block;
  margin-top: 5px;
}

/* Modal Overlay */
.modal {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 9999; /* On top */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto; /* Allow scrolling if content is tall */
  background-color: rgba(0, 0, 0, 0.7);
}

/* Show the modal when .hidden is removed */
.modal:not(.hidden) {
  display: block;
}

/* Modal Content Box */
.modal-content {
  background: var(--secondary);
  margin: 5% auto;
  padding: 20px;
  border-radius: 8px;
  width: 80%;
  max-width: 800px;   /* Keep it from being too wide */
  max-height: 80vh;   /* Limits height to viewport */
  overflow-y: auto;    /* Scroll inside if needed */
}

/* Close Button (X) */
.close {
  float: right;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  margin-top: -10px;
  margin-right: -10px;
  margin-bottom: 10px;
}

/* The <pre> that displays the full output */
#log-modal-text {
  color: var(--text-color);
  font-family: monospace;
  white-space: pre-wrap; /* Wrap lines */
  word-break: break-word;/* Break long words so they don't overflow */
  margin-top: 10px;
}

.view-full {
  margin-left: 10px;
  background: var(--highlight);
  color: black;
  border: none;
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: 0.3s;
}

.view-full:hover {
  background: var(--danger-color);
}

/* Add spacing above the mass command button */
.mass-command {
    margin-top: 20px; /* Adjust the value as needed */
    display: block; /* Makes sure the button takes up its own line */
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Make sidebar full width and positioned relative */
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 10px;
        box-shadow: none;
    }
        /* Display sidebar menu items in a row (wrap if needed) */
        .sidebar ul {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-around;
            padding: 0;
        }

            .sidebar ul li {
                flex: 1 1 auto;
                text-align: center;
                padding: 10px 5px;
                font-size: 1rem;
            }
    /* Remove left margin for main content and reduce padding */
    .container {
        margin-left: 0;
        padding: 10px;
    }
    /* Reduce font-size for tables on smaller screens */
    table, th, td {
        font-size: 0.8rem;
        padding: 8px;
    }
    /* Adjust navbar for vertical stacking */
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px;
    }

        .navbar .logo {
            margin-bottom: 10px;
            font-size: 1.5rem;
        }
    /* Adjust button styles if necessary */
    button {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
    /* Ensure mass command button has proper spacing */
    .mass-command {
        margin-top: 20px;
        display: block;
    }
}

/* Extra adjustments for very small screens */
@media (max-width: 480px) {
    .navbar .logo {
        font-size: 1.3rem;
    }

    button, input, select {
        padding: 6px;
        font-size: 0.85rem;
    }
    /* If needed, stack table cells vertically or add horizontal scrolling */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
