/* t-infra Video — Design System */

:root {
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --bg: #0f172a;
  --card: #1e293b;
  --card-border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 20px;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
}

/* Navigation */
.nav {
  display: flex;
  gap: 8px;
  max-width: 640px;
  margin: 0 auto 16px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.8);
  transition: all 0.2s;
}

.nav a:hover { color: var(--text); background: var(--card); }
.nav a.active { color: #fff; background: var(--accent); }

.user-bar {
  max-width: 640px;
  margin: -8px auto 12px;
  text-align: right;
}

.logout-link {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

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

/* Cards */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
h2 { margin: 0 0 20px; font-size: 14px; font-weight: 400; color: var(--muted); line-height: 1.5; }

/* Forms */
input, select {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  margin-bottom: 14px;
  transition: border-color 0.2s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

button {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

button:hover { background: var(--accent-hover); }

/* Messages */
.msg {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.5;
}

.msg a { color: inherit; font-weight: 600; }

.msg.error { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.25); }
.msg.success { background: rgba(34, 197, 94, 0.12); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.25); }
.msg.info { background: rgba(37, 99, 235, 0.12); color: #93c5fd; border: 1px solid rgba(37, 99, 235, 0.25); }

/* Tables */
table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
  font-size: 13px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.done { background: rgba(34, 197, 94, 0.15); color: var(--green); }
.badge.failed { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.badge.active { background: rgba(245, 158, 11, 0.15); color: var(--orange); }
.badge.deleted { background: rgba(148, 163, 184, 0.15); color: var(--muted); }

/* Progress */
.progress-bar {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  height: 6px;
  width: 90px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-bar-lg {
  background: var(--card-border);
  border-radius: 8px;
  height: 14px;
  max-width: 100%;
  overflow: hidden;
  margin: 12px 0;
}

.progress-fill {
  background: var(--accent);
  height: 100%;
  transition: width 0.5s ease;
  border-radius: inherit;
}

.progress-text {
  color: var(--muted);
  font-size: 10px;
}

/* Links */
.dl-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.dl-link:hover { text-decoration: underline; }

.muted-link {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.muted-link:hover { color: var(--text); }
.muted { color: var(--muted); font-size: 13px; }

.url-cell {
  max-width: 230px;
  word-break: break-all;
}

/* Stats */
.stats-card { padding: 20px 28px; }

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stat-item {
  flex: 1;
  min-width: 90px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

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

.stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* Recent block */
.recent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

/* Buttons */
.btn-retry {
  padding: 4px 10px;
  font-size: 12px;
  width: auto;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.3);
}

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

.btn-danger {
  padding: 8px 14px;
  font-size: 13px;
  width: auto;
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.3); }

/* Pagination */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  font-size: 13px;
}

.pager-link {
  color: var(--muted);
  text-decoration: none;
  padding: 4px 10px;
  margin: 0 2px;
}

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

.pager-current {
  background: var(--accent);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  margin: 0 2px;
}

/* Spinner */
.spinner {
  display: none;
  margin-top: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Responsive */
@media (max-width: 640px) {
  body { padding: 12px; }
  .card { padding: 20px; border-radius: 12px; }
  .stat-item { min-width: 70px; padding: 8px; }
  .stat-value { font-size: 16px; }
}
