/* ───────────────────────────────
   Reset
──────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html, body {
  height: 100%;
}
img {
  max-width: 100%;
  display: block;
}
button {
  font: inherit;
}

/* ───────────────────────────────
   Theme variables
──────────────────────────────── */
:root {
  --bg: #f9f9fb;
  --text: #333;
  --accent: #1a73e8;
  --border: #ddd;
  --hover: #eef2f7;
  --table-bg: #fff;
  --table-bg-alt: #f4f6f8;
  --button-bg: #1a73e8;
  --button-text: #fff;
  --button-hover: #155ab6;
  --text-muted: #888;
}
:root.dark-mode {
  --bg: #1e1e1e;
  --text: #ddd;
  --accent: #4ea1ff;
  --border: #444;
  --hover: #2a2a2a;
  --table-bg: #2a2a2a;
  --table-bg-alt: #242424;
  --button-bg: #4ea1ff;
  --button-text: #000;
  --button-hover: #1e90ff;
  --text-muted: #aaa;
}

/* ───────────────────────────────
   Base layout
──────────────────────────────── */
body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
}
.container {
  width: 100%;
  padding: 10px 60px;
  box-sizing: border-box;
}
.top-header {
  position: relative;
}
.top-banner {
  margin: 10px 60px;
  padding-left: 20px;
}
.top-banner img {
  max-width: 300px;
  height: auto;
}

/* ───────────────────────────────
   Toolbar
──────────────────────────────── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}
.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toolbar .btn {
  padding: 8px 14px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background-color: var(--button-bg);
  color: var(--button-text);
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.toolbar .btn:hover {
  background-color: var(--button-hover);
}
.toolbar input[type="text"],
.toolbar select {
  padding: 6px 10px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background-color: var(--table-bg);
  color: var(--text);
}
@media (max-width: 600px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-left,
  .toolbar-right {
    width: 100%;
    justify-content: space-between;
  }
}

/* Toolbar link as modern box */
.toolbar a,
.toolbar a:link,
.toolbar a:visited {
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: var(--table-bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.toolbar a:hover,
.toolbar a:active {
  background-color: var(--accent);
  color: var(--button-text);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
  text-decoration: none; /* override global underline */
}

/* ───────────────────────────────
   Navigation & breadcrumbs
──────────────────────────────── */
.breadcrumb-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}
.breadcrumb a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.breadcrumb a:hover,
.go-up a:hover {
  text-decoration: underline;
}
.breadcrumb i {
  font-size: 14px;
  color: var(--accent);
}
.go-up {
  margin-bottom: 20px;
}
.go-up a {
  color: var(--accent);
  text-decoration: none;
}

/* ───────────────────────────────
   Search
──────────────────────────────── */
.search-input {
  width: 100%;
  max-width: 400px;
  padding: 10px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: var(--table-bg);
  color: var(--text);
}

/* ───────────────────────────────
   File table (fixed and compact)
──────────────────────────────── */
.file-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--table-bg);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.05);
}
.file-table th,
.file-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.file-table thead th {
  font-weight: 600;
}
.file-table th a {
  color: var(--text);
  text-decoration: none;
}
.file-table th a:hover {
  color: var(--accent);
}
.file-table tbody tr:hover {
  background-color: var(--hover);
}
.file-table td i.fas {
  margin-right: 6px;
  font-size: 16px;
  vertical-align: middle;
  color: var(--accent);
}
.file-table td i.fa-folder { color: #f4b400; }
.file-table td i.fa-file-zipper,
.file-table td i.fa-file-archive { color: #34a853; }

/* Checkbox column */
.file-table th.checkbox-column {
  width: 20px;
  text-align: center;
  padding: 0 0 0 10px;
}

.file-table td:first-child {
  width: 20px;
  text-align: center;
  padding: 0 0 0 10px;
}

/* Filename column */
.file-table th:nth-child(2),
.file-table td:nth-child(2) {
  max-width: 280px;
}
.file-table td:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Size column */
.file-table th:nth-child(3),
.file-table td:nth-child(3) {
  width: 65px;
  text-align: right;
}
.file-table td:nth-child(3) {
  font-size: 12px;
  white-space: nowrap;
}

/* Date / modified column */
.file-table th:nth-child(4),
.file-table td:nth-child(4) {
  width: 100px;
  text-align: right;
}
.file-table td:nth-child(4) {
  font-size: 11px;
}
.file-table td:nth-child(4) .date,
.file-table td:nth-child(4) .time {
  display: inline-block;   /* inline-block instead of block */
  margin: 0;
  padding: 0;
  line-height: 1;          /* collapse line height */
}
.file-table td:nth-child(4) .time {
  margin-left: 4px;        /* small horizontal gap */
  font-size: 8px;          /* smaller than date */
  color: var(--text-muted);
}

/* Download column */
.file-table th:nth-child(5),
.file-table td:nth-child(5) {
  width: 35px;
  text-align: center;
}

/* Footer row */
.file-table tfoot td {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background-color: var(--table-bg-alt);
  font-size: 12px;
  text-align: center;
}

/* ───────────────────────────────
   Buttons & summary
──────────────────────────────── */
.button-row {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
}
.zip-button {
  padding: 10px 20px;
  background-color: #0078d7;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}
.zip-button:hover {
  background-color: #005fa3;
}
.summary-bar {
  margin-top: 20px;
  font-size: 14px;
  color: var(--text);
  background-color: var(--table-bg);
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  text-align: right;
}

/* ───────────────────────────────
   Toggles (theme & view)
──────────────────────────────── */
.toggle-container {
  position: absolute;
  top: 10px;
  right: 60px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}
.toggle-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-label,
.view-label {
  font-size: 14px;
  color: var(--text);
  width: 80px;
  flex-shrink: 0;
}
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: background-color 0.4s;
  border-radius: 26px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: transform 0.4s, background-color 0.4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--accent);
}
input:checked + .slider:before {
  transform: translateX(24px);
  background-color: #fff;
}
:root.dark-mode .slider {
  background-color: #444;
}
:root.dark-mode input:checked + .slider {
  background-color: var(--accent);
}
:root.dark-mode .slider:before {
  background-color: #fff;
}

/* ───────────────────────────────
   Grid view (optional)
──────────────────────────────── */
.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.grid-item {
  background-color: var(--table-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
}
.grid-item .name {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grid-item .meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ───────────────────────────────
   Notifications / alerts
──────────────────────────────── */
.notice {
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background-color: var(--table-bg);
  color: var(--text);
}
.notice.success { border-color: #3fb267; background-color: #e9f7ef; }
.notice.warn { border-color: #e6a700; background-color: #fff8e1; }
.notice.error { border-color: #d93025; background-color: #fdecea; }

/* ───────────────────────────────
   Footer
──────────────────────────────── */
.footer {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 40px;
  padding: 10px 0;
}

/* ───────────────────────────────
   Torrent regeneration status (no box, no italics)
──────────────────────────────── */
#torrent-status {
  margin: 20px 0;
  padding: 0;
  background: none;
  border: none;
}

#torrent-status p {
  font-size: 14px;
  line-height: 1.4;
  margin: 10px 0 15px;
}

#torrent-filename-row {
  margin: 10px 0;
  font-size: 14px;
}

#torrent-filename-row .torrent-label {
  font-weight: 600;
  margin-right: 6px;
}

/* Ensure filename is not italic */
#current-file {
  font-style: normal;
  color: var(--text);
}

/* Progress bar */
#progress-container {
  width: 100%;
  background: #444;
  border-radius: 6px;
  overflow: hidden;
  margin: 12px 0;
  height: 18px;
}

#progress-bar {
  height: 100%;
  background: #3fb267;     /* green fill */
  color: #fff;
  font-size: 12px;
  text-align: center;
  line-height: 18px;
  transition: width 0.3s ease;
}

#torrent-status #status {
  font-size: 13px;
  color: var(--text-muted, #666);
  margin-top: 8px;
}

/* ───────────────────────────────
   Global links
──────────────────────────────── */
a:link,
a:visited,
a:hover,
a:active {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ───────────────────────────────
   Loading overlay
──────────────────────────────── */
#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
#loadingOverlay img {
  max-width: 120px;
  height: auto;
}

/* ───────────────────────────────
   Responsive tweaks
──────────────────────────────── */
@media (max-width: 900px) {
  .container {
    padding: 10px 24px;
  }
  .toggle-container {
    right: 24px;
  }
}
@media (max-width: 600px) {
  .search-input {
    max-width: 100%;
  }
  .breadcrumb-bar {
    gap: 10px;
  }
  .button-row {
    flex-wrap: wrap;
    gap: 10px;
  }
}


/* Dropdown container */
.dropdown {
  display: inline-block;
  position: relative;
}

/* Style the summary so it looks like your zip-button */
.dropdown > summary.zip-button {
  list-style: none;       /* remove default marker */
  cursor: pointer;
  user-select: none;
}

.dropdown > summary::-webkit-details-marker {
  display: none;          /* hide default arrow in WebKit browsers */
}

/* Hide menu by default */
.dropdown .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  margin-top: 4px;
  background: var(--table-bg);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  padding: 6px 0;
  z-index: 10;
}

/* Show menu only when <details> is open */
.dropdown[open] .dropdown-menu {
  display: block;
}

/* Links inside the dropdown */
.dropdown-menu a {
  display: block;
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
}

.dropdown-menu a:hover {
  background: var(--hover);
  color: var(--accent);
}

