:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #2563eb;
  --border: #e5e7eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}

.nav {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
}

.nav .nav-right {
  margin-left: auto;
}

.nav a:hover {
  color: var(--accent);
}

.size-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  transition: all 0.2s;
  min-width: 36px;
}

.size-btn:hover {
  background: var(--bg);
  border-color: var(--accent);
  color: var(--accent);
}

.size-btn:active {
  transform: scale(0.95);
}

.network-selector {
  display: flex;
  align-items: center;
}

.network-selector select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.network-selector select:hover {
  border-color: var(--accent);
}

.network-selector select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.site-footer {
  margin: 40px 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.05);
}

.grid {
  display: grid;
  gap: 16px;
}

.stats {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stat .label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat .value {
  font-size: 20px;
  font-weight: 700;
}

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

.actions form {
  margin: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border: none;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  line-height: 1;
  min-height: 36px;
  appearance: none;
}

.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filters input,
.filters select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.subheader {
  color: var(--muted);
  margin-bottom: 12px;
}

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

.table th,
.table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: left;
}

.table th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
}

.meta {
  margin-bottom: 10px;
  color: var(--muted);
}

.pagination {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.screenshots {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.shot {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.shot img {
  width: 100%;
  display: block;
}

.caption {
  padding: 8px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

details {
  cursor: pointer;
}

details summary {
  color: var(--accent);
  font-weight: 500;
  padding: 4px;
  margin: -4px;
  border-radius: 4px;
}

details summary:hover {
  background: rgba(37, 99, 235, 0.1);
}

details pre {
  margin: 8px 0 !important;
  font-size: 11px !important;
  background: #f5f5f5 !important;
  padding: 8px !important;
  border-radius: 4px !important;
  max-width: 400px !important;
  overflow-x: auto !important;
  word-wrap: break-word !important;
  white-space: pre-wrap !important;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  position: relative;
  margin: 5% auto;
  max-width: 90vw;
  max-height: 85vh;
  background: var(--card);
  border-radius: 12px;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-content img {
  width: 100%;
  display: block;
  cursor: pointer;
  border-radius: 12px 12px 0 0;
}

.modal-close {
  position: absolute;
  right: 16px;
  top: 16px;
  color: var(--text);
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border-radius: 8px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--border);
  color: var(--accent);
  transform: scale(1.1);
}

.modal-url {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-family: monospace;
  word-break: break-all;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input[readonly] {
  background: var(--bg);
  cursor: not-allowed;
}

.form-group small {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.form-group input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* Button variants */
.button-small {
  padding: 4px 10px;
  font-size: 13px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border: none;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  min-height: 28px;
  font: inherit;
  appearance: none;
}

.button-small:hover {
  opacity: 0.9;
}

.button-secondary {
  background: var(--border);
  color: var(--text);
}

.button-secondary:hover {
  background: #d1d5db;
}

.button-danger {
  background: #dc2626;
  color: #fff;
}

.button-danger:hover {
  background: #b91c1c;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 500;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.error-detail {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.5;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-muted {
  background: var(--border);
  color: var(--muted);
}

/* Data table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 12px;
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  background: var(--bg);
}

.data-table tbody tr:hover {
  background: var(--bg);
}

.data-table code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

/* Hosts List */
.hosts-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.host-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: var(--bg);
}

.host-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.host-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
}

.host-header h3 a {
  color: var(--accent);
  text-decoration: none;
}

.host-header h3 a:hover {
  text-decoration: underline;
}

.host-times {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.time-label {
  font-weight: 600;
}

.time-value {
  font-family: 'Courier New', monospace;
}

.time-separator {
  color: var(--border);
}

.services-list {
  margin-top: 12px;
}

.services-list table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--card);
  border-radius: 6px;
  overflow: hidden;
}

.services-list th,
.services-list td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.services-list th {
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.services-list tbody tr:hover {
  background: var(--bg);
}

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

.services-list td:first-child {
  font-family: 'Courier New', monospace;
  color: var(--accent);
}

.services-list td:nth-child(4),
.services-list td:nth-child(5) {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--muted);
}

.no-services {
  color: var(--muted);
  font-style: italic;
  margin: 8px 0 0 0;
}
