/* === THEME / BASE === */
:root {
  --bg:#0f172a;
  --panel:#111827;
  --card:#1f2937;
  --hover:#374151;
  --text:#e5e7eb;
  --radius:10px;
  --shadow:0 12px 28px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  padding: 24px;
  font-family: system-ui, -apple-system, "Segoe UI", Inter, Roboto, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 10% -10%, #1e293b 0%, #0b1020 40%, var(--bg) 100%);
}

/* Wrapper so the content doesn#ai-wrap {
  max-width: 1800px;
  margin: 0 auto;
}

/* === PRE (raw Apache listing, before JS turns it into tiles) === */
pre {
  margin: 10px 0 0;
  padding: 16px;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  white-space: pre-line;
  line-height: 1.4;
}

/* ===== HEADER AREA (your GCC logo, title, etc.) ===== */
.header {
  background: #0f172a;
  color: #e5e7eb;
  width: 100%;
  box-sizing: border-box;
}

.header-top,
.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-top {
  justify-content: space-between;
  padding: 0.75rem 1rem 0 1rem;
  flex-wrap: wrap;   /* iPad fix */
}

.header-left {
  min-width: 0;
}

.header-logo {
  height: 50px;
  width: auto;
  max-width: 100%;
}

.header-title,
.header h1 {
  font-size: 1.6rem;
  margin: 0;
  white-space: nowrap;
}

/* section with your MRTG .pre-tiles {
  width: 100%;
  padding: 0 1rem 0.5rem 1rem;
  box-sizing: border-box;
}

.ai-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.ai-table img {
  max-width: 100%;
  height: auto;
}

/* responsive header tweaks */
@media (max-width: 900px) {
  .header-title,
  .header h1 {
    white-space: normal; /* allow wrap on iPad/phones */
  }
}

@media (max-width: 768px) {
  .header-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .ai-table {
    min-width: 650px; /* keep your 3-col graph layout but scrollable */
  }
}

/* =========================================================
   1) JS-GENERATED TILES (your <pre> ? .ai-pre-grid ? .ai-pre-tile)
   ========================================================= */
.ai-pre-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 10px 0 0;
}

/* compact, consistent tile style */
.ai-pre-tile {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 0.5rem;
  box-shadow: 0 8px 18px rgba(0,0,0,.25);
  min-width: 0;
  transition: 0.15s;
}

.ai-pre-tile:hover {
  background: var(--hover);
  border-color: rgba(255,255,255,.18);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0,0,0,.35);
}

/* link inside the tile: make it same height everywhere */
.ai-pre-tile > a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;           /* <-- makes them all same height */
  padding: 0.4rem 0.5rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  inline-size: 100%;
}

/* =========================================================
   2) TABLE MODE (when Apache outputs <table> and you tile it)
   Make it match the JS tiles above.
   ========================================================= */
table:not(.ai-table) thead,
table:not(.ai-table) th {
  display: none !important; /* hide headers like Name, Last Modified... */
}

table:not(.ai-table) td:nth-child(n+2) {
  display: none !important; /* show only first column (the name) */
}

table:not(.ai-table) img {
  display: none !important;
}

table:not(.ai-table) {
  width: 100%;
  border: 0;
  background: transparent;
  margin: 0;
  padding: 0;
  border-collapse: separate;
  border-spacing: 0;
}

table:not(.ai-table) > tbody {
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 0.6rem;
  margin-top: 10px;
}

table:not(.ai-table) > tbody > tr {
  display: block;
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 0.5rem;
  box-shadow: 0 8px 18px rgba(0,0,0,.25);
  transition: 0.15s;
  min-width: 0;
}

table:not(.ai-table) > tbody > tr:hover {
  background: var(--hover);
  border-color: rgba(255,255,255,.18);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0,0,0,.35);
}

table:not(.ai-table) > tbody > tr > td {
  display: block;
  padding: 0; /* we  text-align: center;
  min-width: 0;
}

table:not(.ai-table) > tbody > tr > td a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;           /* match JS tiles */
  padding: 0.4rem 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  inline-size: 100%;
}

/* =========================================================
   Hide helper files / folders from listing
   ========================================================= */
pre a[href="HEADER.html"],
pre a[href="./HEADER.html"],
pre a[href$="/HEADER.html"],
pre a[href="FOOTER.html"],
pre a[href="./FOOTER.html"],
pre a[href$="/FOOTER.html"],
pre a[href="README.html"],
pre a[href="./README.html"],
pre a[href$="/README.html"],
pre a[href="assets/"],
pre a[href="./assets/"],
pre a[href$="/assets/"] {
  display: none !important;
}

hr { display: none !important; }

/* =========================================================
   RESPONSIVE: fewer columns as screen narrows
   ========================================================= */
@media (max-width: 1200px) {
  .ai-pre-grid,
  table:not(.ai-table) > tbody {
    grid-template-columns: repeat(3, minmax(0,1fr));
  }
}

@media (max-width: 800px) {
  .ai-pre-grid,
  table:not(.ai-table) > tbody {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
}

@media (max-width: 500px) {
  .ai-pre-grid,
  table:not(.ai-table) > tbody {
    grid-template-columns: repeat(1, minmax(0,1fr));
  }
}

