/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --bg: #14161a;
  --surface: #1c1f26;
  --surface-2: #23262f;
  --border: #2e323c;
  --text: #e8eaee;
  --muted: #98a0ae;
  --accent: #ff4b4b;
  --success: #3ecf8e;
  --danger: #ff6b6b;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--text); }

.site-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand { font-weight: 600; text-decoration: none; }
.header-user { margin-left: auto; color: var(--muted); font-size: 13px; }

.container { max-width: 820px; margin: 0 auto; padding: 28px 20px 64px; }

h1 { font-size: 22px; margin: 0 0 20px; }
h2 { font-size: 16px; margin: 28px 0 12px; color: var(--muted); font-weight: 600; }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 18px; }
.flash-alert { background: rgba(255, 107, 107, 0.12); color: var(--danger); }
.flash-notice { background: rgba(62, 207, 142, 0.12); color: var(--success); }

/* Forms */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.new-download { display: grid; gap: 12px; }

.field-row { display: flex; gap: 10px; flex-wrap: wrap; }

input[type="text"], input[type="email"], input[type="password"], select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
}

input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

select { width: auto; }

.btn, input[type="submit"] {
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
}

.btn:hover, input[type="submit"]:hover { filter: brightness(1.1); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
  padding: 6px 12px;
}

.btn-row { display: flex; gap: 8px; align-items: center; }
.btn-row form { margin: 0; }

.errors { color: var(--danger); font-size: 13px; margin: 0; padding-left: 18px; }

/* Download list */

.downloads { display: grid; gap: 12px; margin-top: 12px; }

.download {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.download-thumb {
  width: 120px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-2);
}

.download-body { min-width: 0; display: grid; gap: 8px; align-content: start; }

.download-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-meta { color: var(--muted); font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; }

.badge {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  text-transform: uppercase;
}

.badge-pending, .badge-fetching_info { background: var(--surface-2); color: var(--muted); }
.badge-downloading { background: rgba(255, 75, 75, 0.16); color: var(--accent); }
.badge-completed { background: rgba(62, 207, 142, 0.16); color: var(--success); }
.badge-failed { background: rgba(255, 107, 107, 0.16); color: var(--danger); }

progress {
  appearance: none;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
}

progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }

.error-text { color: var(--danger); font-size: 13px; margin: 0; word-break: break-word; }

.empty { color: var(--muted); text-align: center; padding: 32px; }

/* Admin */

.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.admin-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.admin-table tbody tr:last-child td { border-bottom: 0; }

/* Auth screens */

.auth { max-width: 360px; margin: 60px auto; display: grid; gap: 12px; }
.auth input { margin-bottom: 8px; }
.auth input[type="submit"] { width: 100%; }
.auth a { font-size: 13px; color: var(--muted); }

