/* ==========================================================================
   This template is used by alours.wtf directory listings
   ========================================================================== */

:root {
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-light: #ede9fe;
  --primary-subtle: #f7f5fd;
  --bg: #faf9fe;
  --card-bg: #ffffff;
  --border: #ede9fe;
  --border-light: #f3f0fa;
  --text-main: #1e1b4b;
  --text-muted: #6b7280;
  --text-link: #6d28d9;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  --mono-font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --shadow: 0 4px 20px -2px rgba(124, 58, 237, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #a78bfa;
    --primary-hover: #c4b5fd;
    --primary-light: #2e264f;
    --primary-subtle: #1c182d;
    --bg: #0f0d19;
    --card-bg: #171426;
    --border: #2c2647;
    --border-light: #221c38;
    --text-main: #f5f3ff;
    --text-muted: #9ca3af;
    --text-link: #c4b5fd;
    --shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.5);
  }

  .btn-redirect {
    color: #60a5fa;
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.12);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }

  .btn-redirect:hover {
    background-color: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.45);
  }
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  padding: 36px 16px;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.wrapper {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Header */
.header {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.header-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Blue Outline Redirect Button */
.btn-redirect {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #2563eb;
  background-color: rgba(59, 130, 246, 0.06);
  border: 1.5px solid #3b82f6;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(59, 130, 246, 0.08);
  transition: all 0.15s ease;
  cursor: pointer;
}

.btn-redirect:hover {
  background-color: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-redirect:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(59, 130, 246, 0.2);
}

.btn-redirect:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 3px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.folder-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: var(--primary-light);
  color: var(--primary);
  flex-shrink: 0;
}

.header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--mono-font);
}

.breadcrumb a {
  color: var(--text-link);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb .active {
  color: var(--text-main);
  font-weight: 600;
}

/* Table Wrapper */
.table-container {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

/* Apache generated table */
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

/* Hide Apache's default <hr> divider rows */
hr,
tr.indexbreakrow {
  display: none !important;
}

/* Header row */
tr.indexhead,
table tr:first-child:not([class]) {
  background-color: var(--primary-subtle);
  border-bottom: 1px solid var(--border);
}

th {
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  white-space: nowrap;
}

th a {
  color: var(--primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

th a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Table data rows */
td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  white-space: nowrap;
}

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

tbody tr:hover,
tr:not(.indexhead):not(.indexbreakrow):hover {
  background-color: var(--primary-subtle);
}

/* Icon column */
th.indexcolicon,
td.indexcolicon {
  width: 32px;
  padding-right: 4px;
  text-align: center;
}

td img {
  vertical-align: middle;
  border-radius: 4px;
  opacity: 0.85;
}

/* Name column */
th.indexcolname,
td.indexcolname {
  width: 50%;
}

td.indexcolname a,
td a {
  color: var(--text-link);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

td.indexcolname a:hover,
td a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Date and size columns */
th.indexcollastmod,
td.indexcollastmod,
th.indexcolsize,
td.indexcolsize {
  font-family: var(--mono-font);
  font-size: 0.8rem;
  color: var(--text-muted);
}

th.indexcolsize,
td.indexcolsize {
  text-align: right;
}

th.indexcoldesc,
td.indexcoldesc {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Parent Directory link */
tr:has(a[href^="/"]):not(.indexhead) td.indexcolname a,
tr td.indexcolname a[href="../"] {
  font-weight: 600;
}

/* Footer */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.file-count {
  font-family: var(--mono-font);
  font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  body {
    padding: 16px 10px;
  }

  .header {
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .btn-redirect {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  th, td {
    padding: 10px 12px;
  }

  .indexcollastmod {
    display: none;
  }
}
