/* mirror.css — linux mirror directory listing theme */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&display=swap');

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

:root {
  --bg:        #0e0f11;
  --bg2:       #151619;
  --bg3:       #1c1d21;
  --border:    #2a2b2f;
  --border2:   #3a3b40;
  --text:      #d4d5d9;
  --text-mute: #6b6d75;
  --text-dim:  #4a4c54;
  --accent:    #4d9fff;
  --green:     #3fb950;
  --green-dim: #1a3d20;
  --amber:     #d4a017;
  --red:       #f85149;
  --red-dim:   #3d1a1a;
  --mono: 'IBM Plex Mono', 'Courier New', monospace;
}

html { font-size: 14px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: #74b3ff; }

/* ── Header ─────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
}
.logo:hover { text-decoration: none; color: #fff; }
.logo-icon { width: 16px; height: 16px; stroke: var(--accent); flex-shrink: 0; }
.header-nav { display: flex; align-items: center; gap: 1.25rem; }

.sync-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--green-dim);
  border: 1px solid #2a5c2e;
  border-radius: 2px;
  padding: 2px 8px;
  font-size: 0.75rem;
  color: var(--green);
  letter-spacing: 0.04em;
}
.sync-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.3; } }

.sync-badge--stale {
  background: #2a2000;
  border-color: #5c4500;
  color: var(--amber);
}
.sync-badge--stale .sync-dot { background: var(--amber); }

.sync-badge--error {
  background: var(--red-dim);
  border-color: #5c2020;
  color: var(--red);
}
.sync-badge--error .sync-dot { background: var(--red); animation: none; }

/* ── Main layout ─────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ── Breadcrumb ──────────────────────────── */
.breadcrumb {
  font-size: 0.75rem;
  color: var(--text-mute);
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
.breadcrumb a { color: var(--text-mute); }
.breadcrumb a:hover { color: var(--text); }
.bc-sep { margin: 0 0.2rem; color: var(--text-dim); }

/* ── Listing header ──────────────────────── */
.listing-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.dir-title { font-size: 1.1rem; font-weight: 500; color: var(--text); }
.dir-path  { color: var(--accent); }

.listing-meta { display: flex; gap: 0.4rem; }
.meta-tag {
  font-size: 0.7rem;
  padding: 1px 7px;
  border: 1px solid var(--border2);
  border-radius: 2px;
  color: var(--text-mute);
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.meta-tag:hover { border-color: var(--accent); color: var(--accent); }

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

/* ── Fancyindex native table ─────────────── */
/* Fancyindex outputs: <table> with id="list", thead, tbody */
table#list,
.table-wrap > table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  font-family: var(--mono);
}

table#list thead,
.table-wrap > table thead {
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

table#list th,
.table-wrap > table th {
  padding: 0.55rem 0.85rem;
  text-align: left;
  font-weight: 500;
  color: var(--text-mute);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
table#list th a,
.table-wrap > table th a { color: var(--text-mute); }
table#list th a:hover,
.table-wrap > table th a:hover { color: var(--text); text-decoration: none; }

table#list tbody tr,
.table-wrap > table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
table#list tbody tr:last-child,
.table-wrap > table tbody tr:last-child { border-bottom: none; }
table#list tbody tr:hover,
.table-wrap > table tbody tr:hover { background: var(--bg2); }

table#list td,
.table-wrap > table td {
  padding: 0.5rem 0.85rem;
  white-space: nowrap;
}

/* Column widths — fancyindex outputs: name, size, date */
table#list td:nth-child(1) a,
.table-wrap > table td:nth-child(1) a { color: var(--text); }

table#list td:nth-child(2),
.table-wrap > table td:nth-child(2) {
  color: var(--text-mute);
  text-align: right;
  font-variant-numeric: tabular-nums;
  width: 90px;
}

table#list td:nth-child(3),
.table-wrap > table td:nth-child(3) {
  color: var(--text-mute);
  width: 170px;
}

/* Directory links in amber */
table#list td a[href$="/"],
.table-wrap > table td a[href$="/"] { color: var(--amber); }

/* Parent dir */
table#list tr.back td a,
.table-wrap > table tr.back td a { color: var(--text-mute); opacity: 0.6; }

/* ── Footer ──────────────────────────────── */
.page-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.footer-link { color: var(--text-dim); }
.footer-link:hover { color: var(--text-mute); }

/* ── Responsive ──────────────────────────── */
@media (max-width: 640px) {
  table#list td:nth-child(3),
  .table-wrap > table td:nth-child(3) { display: none; }
}

/* ── Header nav link ─────────────────────────── */
.nav-link {
  font-size: 0.75rem;
  color: var(--text-mute);
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 2px;
  transition: color 0.15s, border-color 0.15s;
}
.nav-link:hover { color: var(--text); text-decoration: none; }
.nav-link--active {
  color: var(--accent);
  border-color: var(--border2);
}

/* ── Stats page ──────────────────────────────── */
.tab-group {
  display: flex;
  gap: 0.25rem;
}
.tab-btn {
  background: none;
  border: 1px solid var(--border2);
  border-radius: 2px;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 2px 10px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.tab-btn:hover { color: var(--text); border-color: var(--accent); }
.tab-btn--active {
  color: var(--accent);
  border-color: var(--accent);
  background: #1a2a3a;
}

.stats-section { margin-bottom: 2.5rem; }
.stats-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}
.stats-section-title {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.stats-subsection-title {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-mute);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.stats-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.stats-grid { display: grid; gap: 0.75rem; margin-bottom: 1.25rem; }
.stats-grid--2 { grid-template-columns: repeat(2, 1fr); }
.stats-grid--3 { grid-template-columns: repeat(3, 1fr); }
.stats-grid--4 { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

.stats-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem 1rem;
}
.stats-card-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}
.stats-card-value {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
}
.chart-wrap--tall { min-height: 200px; }

.stats-error {
  background: var(--red-dim);
  border: 1px solid #5c2020;
  border-radius: 4px;
  color: var(--red);
  font-size: 0.82rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .stats-grid--2,
  .stats-grid--3 { grid-template-columns: 1fr; }
  .stats-grid--4 { grid-template-columns: repeat(2, 1fr); }
}
