/* Modern Color Scheme & Typography - Tirotech Brand Colors */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  background: #000000;
  min-height: 100vh;
  color: #ffffff;
  line-height: 1.6;
}

/* Topbar */
.topbar {
  background: #000000;
  color: white;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  border-bottom: 2px solid #00d4ff;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo {
  height: 42px;
  width: auto;
}

.topbar-title {
  color: #00ff88;
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: #ffffff;
}

.topbar-right button {
  background: rgba(0, 212, 255, 0.2);
  border: 1px solid #00d4ff;
  color: #00d4ff;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.topbar-right button:hover {
  background: rgba(0, 212, 255, 0.3);
  color: #ffffff;
}

/* Navigation */
.nav {
  background: #0a0a0a;
  padding: 12px 32px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid #00d4ff;
}

.nav a {
  color: #b0b0b0;
  margin-right: 24px;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s;
  display: inline-block;
}

.nav a:hover {
  background: rgba(0, 212, 255, 0.1);
  color: #00ff88;
  text-decoration: none;
}

/* Content Area */
.content {
  padding: 32px;
  max-width: 95%;
  margin: 0 auto;
  background: #111111;
  min-height: calc(100vh - 120px);
}

/* Headings */
h1 {
  color: #00ff88;
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 24px 0;
  text-align: center;
}

h2 {
  color: #00d4ff;
  font-size: 20px;
  font-weight: 600;
  margin: 24px 0 16px 0;
}

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.card {
  background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s, box-shadow 0.2s;
  text-align: center;
  border: 1px solid #00d4ff;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 12px rgba(0, 212, 255, 0.3);
  border-color: #00ff88;
}

.card h2 {
  color: #00d4ff;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card p {
  margin: 0;
  font-size: 36px;
  font-weight: 700;
  color: #00ff88;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  background: #1a1a1a;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  border: 1px solid #00d4ff;
}

.table thead {
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  color: #000000;
}

.table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table td {
  padding: 12px 16px;
  border-bottom: none;
  color: #ffffff;
}

.table tbody tr {
  transition: background 0.2s;
  border-bottom: 1px solid rgba(51, 51, 51, 0.3);
}

.table tbody tr:hover {
  background: rgba(0, 212, 255, 0.1);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table a {
  color: #00ff88;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.table a:hover {
  color: #00d4ff;
  text-decoration: underline;
}

.table th a,
.table th a:hover {
  color: #000000;
  font-weight: 600;
  text-decoration: none;
}

.table th a:hover {
  text-decoration: underline;
}

.sort-arrow {
  font-size: 0.85em;
}

.device-filter-panel {
  margin-bottom: 20px;
  padding: 12px 16px;
  background: rgba(0, 212, 255, 0.05);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 6px;
}

.device-filter-panel > summary {
  cursor: pointer;
  color: #00d4ff;
  font-weight: 600;
  font-size: 0.95em;
  list-style: none;
}

.device-filter-panel > summary::-webkit-details-marker {
  display: none;
}

.device-filter-panel > summary::before {
  content: "▸ ";
}

.device-filter-panel[open] > summary::before {
  content: "▾ ";
}

.device-filter-panel[open] > summary {
  margin-bottom: 12px;
}

form.device-filters {
  background: transparent;
  padding: 0;
  margin: 0;
  border: none;
  box-shadow: none;
}

form.device-filters label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 16px 4px 0;
  color: #ffffff;
  font-weight: 500;
  font-size: 0.95em;
  cursor: pointer;
  user-select: none;
}

form.device-filters input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

form.device-filters .filter-date {
  display: flex;
  gap: 8px;
}

form.device-filters input[type="date"] {
  width: auto;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid #333333;
  background: #1a1a1a;
  color: #ffffff;
}

.filter-hint {
  opacity: 0.7;
}

.filter-versions {
  margin-top: 8px;
}

.filter-versions-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: #ffffff;
  font-weight: 600;
  margin-bottom: 6px;
}

.version-filter-actions {
  display: inline-flex;
  gap: 8px;
}

form.device-filters .version-filter-actions button {
  margin: 0;
  padding: 4px 10px;
  border: 1px solid #333333;
  border-radius: 4px;
  background: #1a1a1a;
  color: #ffffff;
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
}

.version-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  max-height: 140px;
  overflow-y: auto;
  padding: 8px;
  background: #121212;
  border: 1px solid #333333;
  border-radius: 4px;
}

/* Forms */
form {
  background: #1a1a1a;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  margin-bottom: 24px;
  border: 1px solid #00d4ff;
}

label {
  display: block;
  margin-top: 16px;
  margin-bottom: 6px;
  font-weight: 500;
  color: #00d4ff;
  font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 2px solid #333333;
  background: #0a0a0a;
  color: #e5faff;
  font-size: 14px;
  transition: border-color 0.2s;
  font-family: inherit;
}

input:focus,
select:focus {
  outline: none;
  border-color: #00d4ff;
  background: #111111;
}

button[type="submit"],
button {
  margin-top: 20px;
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, #00ff88 0%, #00d4ff 100%);
  color: #000000;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 255, 136, 0.4);
}

button:active {
  transform: translateY(0);
}

/* Messages */
.error {
  background: rgba(220, 38, 38, 0.2);
  color: #ff6b6b;
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  border-left: 4px solid #ff6b6b;
  font-weight: 500;
}

.success {
  background: rgba(0, 255, 136, 0.2);
  color: #00ff88;
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  border-left: 4px solid #00ff88;
  font-weight: 500;
}

/* Sections */
section {
  background: #1a1a1a;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  margin-bottom: 24px;
  border: 1px solid #333333;
}

/* Log Viewer */
.log-viewer {
  background: #0a0a0a;
  color: #00ff88;
  padding: 16px;
  border-radius: 8px;
  max-height: 500px;
  overflow: auto;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid #00d4ff;
}

pre {
  background: #0a0a0a;
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  border: 1px solid #00d4ff;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #00ff88;
}

/* Login Page */
.login-body {
  min-height: 100vh;
  background: #000;
  display: flex;
  flex-direction: column;
}

.login-header {
  padding: 26px 42px 0;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px 64px;
}

.login-box {
  margin: 0 auto;
}

.login-box h1 {
  color: #00ff88;
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
  text-align: center;
}

.login-box h2 {
  color: #00d4ff;
  font-size: 18px;
  font-weight: 500;
  margin: 0 0 24px 0;
  text-align: center;
}

.login-box label {
  display: block;
  margin-top: 16px;
  margin-bottom: 6px;
  font-weight: 500;
  color: #00d4ff;
  font-size: 14px;
}

.login-box input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 2px solid #333333;
  background: #0a0a0a;
  color: #ffffff;
  font-size: 14px;
  transition: border-color 0.2s;
  font-family: inherit;
}

.login-box input:focus {
  outline: none;
  border-color: #00d4ff;
  background: #111111;
}

.login-box button {
  margin-top: 24px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #00ff88 0%, #00d4ff 100%);
  color: #000000;
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.login-box button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 255, 136, 0.4);
}

/* Flex Layout */
.flex {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.org-list,
.org-detail {
  background: #1a1a1a;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  border: 1px solid #00d4ff;
}

.org-detail h2 {
  margin-top: 0;
}

/* Help Text */
.help {
  margin-top: 20px;
  padding: 16px;
  background: rgba(0, 212, 255, 0.1);
  border-left: 4px solid #00d4ff;
  border-radius: 4px;
  color: #00d4ff;
  font-size: 14px;
  line-height: 1.6;
}

/* Health Tiles */
.health-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.health-tile {
  background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  border: 2px solid;
  transition: transform 0.2s, box-shadow 0.2s;
}

.health-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.health-tile.status-green {
  border-color: #00ff88;
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.1) 0%, #1a1a1a 100%);
}

.health-tile.status-orange {
  border-color: #ffa500;
  background: linear-gradient(135deg, rgba(255, 165, 0, 0.1) 0%, #1a1a1a 100%);
}

.health-tile.status-red {
  border-color: #ff4444;
  background: linear-gradient(135deg, rgba(255, 68, 68, 0.1) 0%, #1a1a1a 100%);
}

.health-tile-label {
  font-size: 12px;
  color: #b0b0b0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  font-weight: 500;
}

.health-tile-value {
  font-size: 28px;
  font-weight: 700;
  margin: 8px 0;
  color: #ffffff;
}

.health-tile.status-green .health-tile-value {
  color: #00ff88;
}

.health-tile.status-orange .health-tile-value {
  color: #ffa500;
}

.health-tile.status-red .health-tile-value {
  color: #ff4444;
}

.health-tile-status {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
}

.health-tile.status-green .health-tile-status {
  background: rgba(0, 255, 136, 0.2);
  color: #00ff88;
}

.health-tile.status-orange .health-tile-status {
  background: rgba(255, 165, 0, 0.2);
  color: #ffa500;
}

.health-tile.status-red .health-tile-status {
  background: rgba(255, 68, 68, 0.2);
  color: #ff4444;
}

/* Server Health Grid */
.server-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.health-item {
  background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
  text-align: center;
  border: 1px solid #00d4ff;
  transition: transform 0.2s, box-shadow 0.2s;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.health-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 12px rgba(0, 212, 255, 0.3);
  border-color: #00ff88;
}

/* Clickable health item (Devices box) */
a .health-item {
  border: 2px solid #00ff88;
  box-shadow: 0 4px 8px rgba(0, 255, 136, 0.2);
  position: relative;
}

a .health-item::after {
  content: "→";
  position: absolute;
  top: 8px;
  right: 12px;
  color: #00ff88;
  font-size: 18px;
  font-weight: bold;
  opacity: 0.7;
}

a .health-item:hover {
  border-color: #00ff88;
  box-shadow: 0 8px 16px rgba(0, 255, 136, 0.4);
  transform: translateY(-4px);
}

a .health-item:hover::after {
  opacity: 1;
  transform: translateX(2px);
}

.health-item-title {
  color: #00d4ff;
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.health-item-value {
  font-size: 32px;
  font-weight: 700;
  margin: 8px 0;
  color: #00ff88; /* Default green */
  display: block !important; /* Ensure it's always visible */
}

.health-item-value.GREEN {
  color: #00ff88 !important;
  display: block !important;
}

.health-item-value.ORANGE {
  color: #ffa500 !important;
  display: block !important;
}

.health-item-value.RED {
  color: #ff4444 !important;
  display: block !important;
}

/* Color classes for inline spans (used in Devices box) */
.health-item-value .GREEN {
  color: #00ff88 !important;
}

.health-item-value .ORANGE {
  color: #ffa500 !important;
}

.health-item-value .RED {
  color: #ff4444 !important;
}

/* Only hide status text that is NOT a health-item-value */
.health-item > .GREEN:not(.health-item-value),
.health-item > .ORANGE:not(.health-item-value),
.health-item > .RED:not(.health-item-value) {
  display: none; /* Hide the old status text if it still exists */
}

/* Responsive */
@media (max-width: 768px) {
  .content {
    padding: 16px;
  }
  
  .cards {
    grid-template-columns: 1fr;
  }
  
  .flex {
    grid-template-columns: 1fr;
  }
  
  h1 {
    font-size: 24px;
  }
  
  .logo {
    height: 30px;
  }

  .server-health-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
  }
  
  .health-item {
    min-height: 120px;
    padding: 16px;
  }
  
  .health-item-value {
    font-size: 28px;
  }
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
  color: #e5faff;
  background: #050505;
  border: 1px solid #00d4ff;
  caret-color: #00ff88;
}

input::placeholder {
  color: rgba(229, 250, 255, 0.6);
}

/* keep number inputs usable */
input[type="number"] {
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* tables with ASCII content */
.table td pre {
  margin: 0;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  white-space: pre-wrap;
  font-size: 13px;
  color: #d1e3ff;
  background: transparent;
}
  