/*
 * Arts — Web Dashboard Styles
 * (c) Adrian Ranta. All rights reserved.
 */

:root {
  --bg: #0f1117;
  --surface: #181a20;
  --surface2: #1e2028;
  --border: #2a2d37;
  --text: #e0e0e6;
  --text-dim: #8b8d97;
  --accent: #4e8cff;
  --accent-hover: #6ba0ff;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --orange: #fb923c;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
}

.subtitle {
  color: var(--text-dim);
  font-size: 14px;
}

.header-status {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-dim);
}

.header-status .online { color: var(--green); }
.header-status .offline { color: var(--red); }

/* Main */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  flex: 1;
  width: 100%;
}

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  flex: 1;
  min-width: 140px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Toolbar */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
}

.toolbar input { flex: 1; min-width: 200px; }
.toolbar input:focus,
.toolbar select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.btn:hover { background: var(--accent-hover); }

.btn-sm { padding: 8px 14px; font-size: 13px; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

/* Table */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  background: var(--surface2);
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 12px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

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

tr:hover td { background: var(--surface2); }

.loading {
  text-align: center;
  color: var(--text-dim);
  padding: 40px;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-active { background: rgba(52,211,153,0.15); color: var(--green); }
.badge-inactive { background: rgba(248,113,113,0.15); color: var(--red); }
.badge-synced { background: rgba(52,211,153,0.15); color: var(--green); }
.badge-pending { background: rgba(251,191,36,0.15); color: var(--yellow); }
.badge-error { background: rgba(248,113,113,0.15); color: var(--red); }
.badge-linux { background: rgba(78,140,255,0.15); color: var(--accent); }
.badge-windows { background: rgba(251,146,60,0.15); color: var(--orange); }
.badge-android { background: rgba(52,211,153,0.15); color: var(--green); }
.badge-scan, .badge-network, .badge-router, .badge-media_player { background: rgba(139,92,246,0.15); color: #a78bfa; }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
}

.pagination button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
}

.pagination button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pagination button:hover:not(.active) {
  border-color: var(--accent);
  color: var(--text);
}

/* Download cards */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
}

.download-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.download-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.download-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.download-card p {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.download-info {
  font-size: 12px !important;
  color: var(--text-dim);
}

.download-actions {
  display: flex;
  gap: 12px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.install-instructions {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.install-instructions h4 {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.code-block {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  gap: 12px;
}

.code-block code {
  flex: 1;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  color: var(--green);
  word-break: break-all;
}

.btn-copy {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.btn-copy:hover { color: var(--text); border-color: var(--accent); }

.note {
  font-size: 12px !important;
  margin-top: 10px;
  font-style: italic;
}

/* Footer */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
}

.footer-right { text-align: right; }

/* Environment cards */
.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.env-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.env-card.active {
  border-left: 3px solid var(--green);
}

.env-card h3 { margin: 0 0 4px; }
.env-card .env-url { color: var(--text-dim); font-size: 13px; font-family: monospace; }
.env-card .env-detail { color: var(--text-dim); font-size: 12px; margin-top: 8px; }
.env-card .env-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%; max-width: 480px;
}

.modal-content h3 { margin: 0 0 20px; }

.modal-content label {
  display: block; margin-bottom: 12px; font-size: 13px; color: var(--text-dim);
}

.modal-content input[type="text"],
.modal-content input[type="password"] {
  display: block; width: 100%; margin-top: 4px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  padding: 8px 12px; font-size: 14px;
  box-sizing: border-box;
}

.modal-actions { display: flex; gap: 12px; margin-top: 20px; }

/* Sub-tabs (discovery tab) */
.sub-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}

.sub-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.sub-tab:hover { color: var(--text); border-color: var(--accent); }

.sub-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.sub-content { display: none; }
.sub-content.active { display: block; }

/* Scan form */
.scan-form {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.scan-form input,
.scan-form select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
}

.scan-form input { flex: 1; min-width: 200px; }
.scan-form input:focus,
.scan-form select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Scan status bar */
.scan-status-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.scan-status-bar .spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Discovery split layout */
.disc-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.disc-heading {
  font-size: 14px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* Credential list */
.cred-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cred-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cred-card .cred-info { font-size: 13px; }
.cred-card .cred-info strong { display: block; margin-bottom: 2px; }
.cred-card .cred-info span { color: var(--text-dim); font-size: 12px; }

/* Badge extensions */
.badge-running { background: rgba(78,140,255,0.15); color: var(--accent); }
.badge-completed { background: rgba(52,211,153,0.15); color: var(--green); }
.badge-failed { background: rgba(248,113,113,0.15); color: var(--red); }
.badge-cancelled { background: rgba(139,141,151,0.15); color: var(--text-dim); }
.badge-quick { background: rgba(52,211,153,0.15); color: var(--green); }
.badge-os_detect { background: rgba(78,140,255,0.15); color: var(--accent); }
.badge-full { background: rgba(251,146,60,0.15); color: var(--orange); }
.badge-snmp { background: rgba(251,191,36,0.15); color: var(--yellow); }
.badge-fingerprint { background: rgba(168,85,247,0.15); color: #a855f7; }

/* Discovery detail view */
.disc-detail {
  font-size: 13px;
}

.disc-detail .detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
}

.disc-detail .detail-grid div {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}

.disc-detail .detail-grid div span:first-child {
  color: var(--text-dim);
}

/* Responsive */
@media (max-width: 768px) {
  main { padding: 16px; }
  .stats-bar { gap: 8px; }
  .stat-card { padding: 12px 16px; min-width: 100px; }
  .stat-value { font-size: 22px; }
  .download-grid { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; }
  .disc-split { grid-template-columns: 1fr; }
  .sub-tabs { flex-wrap: wrap; }
}
