/* ==========================================================================
   Reset
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #000;
  color: #b3b3b3;
  font-family: 'Montserrat', 'Poppins', sans-serif;
  min-height: 100vh;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }

/* ==========================================================================
   Canvas (particle mesh)
   ========================================================================== */

#mesh-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

#navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(22, 22, 22, 0.9);
  border-bottom: 1px solid rgba(0, 204, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.75rem 1.5rem;
}

.nav-left, .nav-center, .nav-right {
  display: flex;
  align-items: center;
}

.nav-logo img {
  max-height: 32px;
}

.nav-center {
  gap: 0.25rem;
}

.nav-link {
  color: #b3b3b3;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
  color: #01f7f6;
  background: rgba(1, 247, 246, 0.08);
}

.nav-link.active {
  color: #00ccff;
  background: rgba(0, 204, 255, 0.12);
}

.nav-right {
  gap: 0.75rem;
}

#user-name {
  color: #666;
  font-size: 0.8rem;
}

#logout-btn {
  background: transparent;
  border: 1px solid rgba(0, 204, 255, 0.3);
  color: #b3b3b3;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  transition: border-color 0.2s, color 0.2s;
}

#logout-btn:hover {
  border-color: #DB1FF8;
  color: #DB1FF8;
}

/* ==========================================================================
   Main app area
   ========================================================================== */

#app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: rgba(22, 22, 22, 0.85);
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-radius: 8px;
  padding: 1rem;
}

/* ==========================================================================
   Key Numbers
   ========================================================================== */

.key-numbers {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.key-number {
  background: rgba(22, 22, 22, 0.85);
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  text-align: center;
}

.key-number .label {
  font-size: 0.7rem;
  color: #00ccff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.key-number .value {
  font-size: 1.8rem;
  font-weight: 600;
  color: #b3b3b3;
}

/* ==========================================================================
   Status Boxes
   ========================================================================== */

.status-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(100% / 6 - 10px), 1fr));
  gap: 10px;
}

.status-box {
  background: rgba(22, 22, 22, 0.85);
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 140px;
}

.status-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.box-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #b3b3b3;
}

.box-detail {
  font-size: 0.7rem;
  color: #666;
}

/* ==========================================================================
   Pie Charts
   ========================================================================== */

.charts-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.chart-card {
  background: rgba(22, 22, 22, 0.85);
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-radius: 8px;
  padding: 1rem;
}

.chart-card canvas {
  max-width: 200px;
  margin: 0 auto;
  display: block;
}

.chart-header {
  font-size: 0.85rem;
  color: #b3b3b3;
  font-weight: 500;
  text-align: center;
  margin-bottom: 0.5rem;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  color: #b3b3b3;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ==========================================================================
   Docker Stacks
   ========================================================================== */

.stacks-section {
  margin-top: 1rem;
}

.stack-card {
  background: rgba(22, 22, 22, 0.85);
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 10px;
}

.stack-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.stack-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #b3b3b3;
}

.stack-badges {
  display: flex;
  gap: 0.4rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-running {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}

.badge-exited {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.stack-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: monospace;
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.container-list {
  margin-top: 0.5rem;
}

.container-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.4rem;
  font-size: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.container-name {
  color: #01f7f6;
  font-weight: 500;
  text-decoration: none;
}

.container-name:hover {
  color: #DB1FF8;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.container-status {
  font-size: 0.75rem;
  color: #b3b3b3;
}

.container-disk {
  color: #b3b3b3;
  font-family: monospace;
  font-size: 0.75rem;
}

.container-restarts {
  color: #DB1FF8;
  font-size: 0.75rem;
}

/* ==========================================================================
   Container Table (Containers page)
   ========================================================================== */

.table-scroll {
  overflow-x: auto;
}

.table-card {
  background: rgba(22, 22, 22, 0.85);
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-radius: 8px;
  overflow: hidden;
}

.container-table {
  font-size: 0.8rem;
  border-collapse: collapse;
  width: 100%;
}

.container-table th {
  font-size: 0.7rem;
  font-weight: 600;
  color: #00ccff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(22, 22, 22, 0.95);
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid rgba(0, 204, 255, 0.15);
  cursor: pointer;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.container-table th:hover {
  color: #01f7f6;
}

.container-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.container-table tr:hover {
  background: rgba(0, 204, 255, 0.04);
}

.container-link {
  color: #01f7f6;
  font-weight: 600;
  text-decoration: none;
}

.container-link:hover {
  color: #DB1FF8;
}

.image-cell {
  color: #666;
  font-family: monospace;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Progress Bars
   ========================================================================== */

.progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* ==========================================================================
   Filter Bar
   ========================================================================== */

.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-input {
  background: rgba(22, 22, 22, 0.85);
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-radius: 8px;
  color: #b3b3b3;
  font-family: 'Montserrat', 'Poppins', sans-serif;
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color 0.2s;
}

.filter-input::placeholder {
  color: #444;
}

.filter-input:focus {
  border-color: #01f7f6;
}

.filter-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  background: transparent;
  border: 1px solid rgba(0, 204, 255, 0.2);
  color: #666;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.filter-btn:hover {
  border-color: #01f7f6;
  color: #01f7f6;
}

.filter-btn.active {
  background: rgba(0, 204, 255, 0.12);
  border-color: #00ccff;
  color: #00ccff;
}

/* ==========================================================================
   Restart Button
   ========================================================================== */

.restart-btn {
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-radius: 4px;
  color: #666;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}

.restart-btn:hover {
  border-color: #e67e22;
  color: #e67e22;
}

/* ==========================================================================
   Confirmation Dialog
   ========================================================================== */

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dialog-box {
  background: rgba(22, 22, 22, 0.95);
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
}

.dialog-title {
  font-size: 1rem;
  font-weight: 600;
  color: #b3b3b3;
  margin-bottom: 0.75rem;
}

.dialog-message {
  font-size: 0.85rem;
  color: #b3b3b3;
  margin-bottom: 1rem;
}

.dialog-error {
  color: #e74c3c;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.dialog-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.dialog-cancel {
  background: transparent;
  border: 1px solid rgba(0, 204, 255, 0.2);
  color: #b3b3b3;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: border-color 0.2s;
}

.dialog-cancel:hover {
  border-color: #01f7f6;
}

.dialog-confirm {
  background: #e67e22;
  border: none;
  color: #fff;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s;
}

.dialog-confirm:hover {
  background: #d35400;
}

/* ==========================================================================
   Container Detail Page
   ========================================================================== */

.back-link {
  color: #01f7f6;
  font-size: 0.85rem;
  display: inline-block;
  margin-bottom: 1rem;
}

.back-link:hover {
  color: #DB1FF8;
}

.detail-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #b3b3b3;
}

.detail-image {
  color: #666;
  font-size: 0.85rem;
  font-family: monospace;
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 1rem 0;
}

.info-card {
  background: rgba(22, 22, 22, 0.85);
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
}

.info-card .label {
  font-size: 0.7rem;
  color: #00ccff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}

.info-card .value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #b3b3b3;
}

/* ==========================================================================
   Detail Sections (labels, ports, mounts, env)
   ========================================================================== */

.detail-section {
  background: rgba(22, 22, 22, 0.85);
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 10px;
}

.detail-section h3 {
  color: #00ccff;
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.label-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
}

.label-key {
  color: #01f7f6;
  font-family: monospace;
  flex-shrink: 0;
}

.label-val {
  color: #b3b3b3;
  word-break: break-all;
}

.port-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
  font-family: monospace;
  color: #b3b3b3;
}

.mount-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
  font-family: monospace;
  color: #b3b3b3;
  word-break: break-all;
}

.env-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
  align-items: center;
}

.env-key {
  color: #01f7f6;
  font-family: monospace;
  flex-shrink: 0;
}

.env-val {
  color: #b3b3b3;
  word-break: break-all;
  font-family: monospace;
}

.env-masked {
  color: #666;
  font-family: monospace;
}

.reveal-btn {
  background: transparent;
  border: 1px solid rgba(0, 204, 255, 0.2);
  color: #666;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.4rem;
  transition: color 0.2s, border-color 0.2s;
}

.reveal-btn:hover {
  color: #01f7f6;
  border-color: #01f7f6;
}

/* ==========================================================================
   Log Box
   ========================================================================== */

.log-box {
  background: rgba(22, 22, 22, 0.95);
  border: 1px solid rgba(0, 204, 255, 0.1);
  border-radius: 8px;
  padding: 1rem;
  max-height: 500px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #b3b3b3;
  white-space: pre-wrap;
  word-break: break-all;
}

.logs-container {
  margin-top: 0.5rem;
}

.logs-pill {
  position: sticky;
  top: 0;
  display: inline-block;
  background: rgba(0, 204, 255, 0.2);
  color: #00ccff;
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   Config Page
   ========================================================================== */

.config-header {
  margin-bottom: 1rem;
}

.config-subtitle {
  color: #666;
  font-size: 0.85rem;
}

.config-section h3 {
  color: #00ccff;
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.config-list {
  background: rgba(22, 22, 22, 0.85);
  border: 1px solid rgba(0, 204, 255, 0.2);
  border-radius: 8px;
  min-height: 60px;
  padding: 0.75rem;
}

.config-list-title {
  font-size: 0.85rem;
  color: #00ccff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.config-item {
  background: rgba(30, 30, 30, 0.9);
  border: 1px solid rgba(0, 204, 255, 0.15);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: grab;
  padding: 0.5rem 0.75rem;
  margin-bottom: 6px;
  transition: opacity 0.2s;
}

.config-item.dragging {
  opacity: 0.5;
  border-style: dashed;
}

.config-item-name {
  font-size: 0.85rem;
  color: #b3b3b3;
  font-weight: 500;
}

.config-item-detail {
  font-size: 0.75rem;
  color: #666;
}

.drag-handle {
  color: #666;
  font-size: 1rem;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}

.drop-indicator {
  height: 2px;
  background: #00ccff;
  border-radius: 1px;
}

.config-empty {
  font-size: 0.8rem;
  color: #444;
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

/* ==========================================================================
   Backups Page
   ========================================================================== */

.backups-header {
  margin-bottom: 1rem;
}

.backups-status {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.backup-status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ==========================================================================
   Skeleton Loading
   ========================================================================== */

.skeleton {
  background: rgba(22, 22, 22, 0.85);
  border-radius: 8px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

/* ==========================================================================
   Spinner
   ========================================================================== */

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #00ccff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

/* ==========================================================================
   Footer
   ========================================================================== */

#footer {
  text-align: center;
  font-size: 0.7rem;
  color: #444;
  padding: 1rem;
}

/* ==========================================================================
   Color Utilities
   ========================================================================== */

.text-green  { color: #2ecc71; }
.text-yellow { color: #f1c40f; }
.text-red    { color: #e74c3c; }
.text-cyan   { color: #01f7f6; }

/* ==========================================================================
   Volume Chips
   ========================================================================== */

.volume-chip {
  display: inline-block;
  font-size: 0.7rem;
  font-family: monospace;
  padding: 0.2rem 0.5rem;
  border: 1px solid rgba(0, 204, 255, 0.15);
  border-radius: 10px;
  color: #666;
}

.volume-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ==========================================================================
   Responsive — Tablet (max-width: 1024px)
   ========================================================================== */

@media (max-width: 1024px) {
  .key-numbers {
    grid-template-columns: repeat(3, 1fr);
  }

  .charts-row {
    grid-template-columns: 1fr 1fr;
  }

  .status-boxes {
    grid-template-columns: repeat(auto-fill, minmax(calc(100% / 3 - 10px), 1fr));
  }
}

/* ==========================================================================
   Responsive — Mobile (max-width: 768px)
   ========================================================================== */

@media (max-width: 768px) {
  .key-numbers {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-row {
    grid-template-columns: 1fr;
  }

  .status-boxes {
    grid-template-columns: repeat(auto-fill, minmax(calc(100% / 2 - 10px), 1fr));
  }

  #user-name {
    display: none;
  }

  #navbar {
    padding: 0.5rem 1rem;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
  }

  .key-number .value {
    font-size: 1.3rem;
  }

  #app {
    padding: 1rem;
  }

  .container-table {
    font-size: 0.75rem;
  }
}
