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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #232733;
  --border: #2e3347;
  --text: #e4e7f0;
  --text2: #8b8fa3;
  --accent: #6c5ce7;
  --accent-hover: #7c6ef7;
  --success: #00b894;
  --warning: #fdcb6e;
  --error: #e17055;
  --radius: 10px;
  --radius-sm: 6px;

  /* platform colors */
  --yt: #ff0000;
  --ig: #e1306c;
  --tt: #00f2ea;
  --vm: #1ab7ea;
  --od: #f35a22;
  --rb: #85c742;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Nav ---- */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.3px;
}
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-link {
  color: var(--text2);
  text-decoration: none;
  font-size: 14px;
  padding: 4px 0;
  transition: color 0.15s;
}
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-user { color: var(--accent); font-size: 13px; font-weight: 600; }
.nav-logout { color: var(--error); }

/* ---- Container ---- */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 20px;
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.card h2 { font-size: 16px; margin-bottom: 16px; font-weight: 600; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-header h2 { margin-bottom: 0; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 6px;
}
.label-hint { font-weight: 400; color: var(--text2); opacity: 0.7; }

input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn:hover { background: var(--border); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-full { width: 100%; }
.btn-icon {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.btn-icon:hover { color: var(--error); }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Dropzone ---- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 20px;
  background: var(--surface);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.05);
}
.dropzone-icon { color: var(--text2); margin-bottom: 12px; }
.dropzone-text { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.dropzone-sub { color: var(--text2); font-size: 13px; }

.file-preview { margin-top: 16px; }
.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.file-name { font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--text2); font-size: 13px; white-space: nowrap; }

/* ---- Progress ---- */
.progress-wrap { margin-bottom: 20px; }
.progress-bar {
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.progress-info {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 13px;
  color: var(--text2);
}

/* ---- Platforms ---- */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.platform-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.platform-card:hover { border-color: var(--text2); }
.platform-card input { display: none; }
.platform-card input:checked ~ .platform-check {
  opacity: 1;
  transform: scale(1);
}
.platform-card:has(input:checked) {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.08);
}
.platform-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
}
.platform-icon-youtube { background: var(--yt); }
.platform-icon-instagram { background: var(--ig); }
.platform-icon-tiktok { background: var(--tt); color: #000; }
.platform-icon-vimeo { background: var(--vm); }
.platform-icon-odysee { background: var(--od); }
.platform-icon-rumble { background: var(--rb); color: #000; }
.platform-name { font-size: 13px; font-weight: 500; }
.platform-check {
  position: absolute;
  top: 6px;
  right: 8px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.15s;
}

/* ---- Platform Overrides ---- */
.platform-overrides { display: flex; flex-direction: column; gap: 4px; }
.platform-override {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.platform-override summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  user-select: none;
  list-style: none;
}
.platform-override summary::-webkit-details-marker { display: none; }
.platform-override summary::before {
  content: "\\25B6";
  font-size: 10px;
  color: var(--text2);
  transition: transform 0.15s;
}
.platform-override[open] summary::before { transform: rotate(90deg); }
.platform-icon-sm {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
}
.override-badge {
  margin-left: auto;
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.override-fields { padding: 12px 14px; border-top: 1px solid var(--border); }

/* ---- Submit ---- */
.submit-row { text-align: center; margin-top: 8px; margin-bottom: 40px; }

/* ---- Modal ---- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(4px);
}
.modal.active {
  display: flex;
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  max-width: 420px;
  width: 90%;
}
.modal-icon { font-size: 48px; margin-bottom: 16px; }
.success-icon { color: var(--success); }
.modal-card h2 { font-size: 20px; margin-bottom: 8px; }
.modal-card p { color: var(--text2); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ---- Alerts ---- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-error { background: rgba(225, 112, 85, 0.15); color: var(--error); border: 1px solid rgba(225,112,85,0.3); }

/* ---- Login ---- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 380px;
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-sub { color: var(--text2); font-size: 14px; margin-bottom: 24px; }

/* ---- History ---- */
h1 { font-size: 22px; margin-bottom: 24px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text2); }
.empty-state p { margin-bottom: 16px; }

.uploads-list { display: flex; flex-direction: column; gap: 8px; }
.upload-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.upload-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.upload-meta { font-size: 12px; color: var(--text2); display: flex; gap: 6px; flex-wrap: wrap; }
.upload-status { margin-top: 10px; }
.upload-platforms {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* ---- Status Badges ---- */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-pending { background: rgba(253,203,110,0.15); color: var(--warning); }
.status-uploading { background: rgba(108,92,231,0.15); color: var(--accent); }
.status-complete { background: rgba(0,184,148,0.15); color: var(--success); }
.status-partial { background: rgba(225,112,85,0.15); color: var(--error); }

.platform-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.platform-status a { color: inherit; }
.platform-status-queued { background: var(--surface2); color: var(--text2); }
.platform-status-uploading { background: rgba(108,92,231,0.15); color: var(--accent); }
.platform-status-success { background: rgba(0,184,148,0.15); color: var(--success); }
.platform-status-failed { background: rgba(225,112,85,0.15); color: var(--error); }

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .container { padding: 16px 12px; }
  .card { padding: 16px; }
  .platform-grid { grid-template-columns: repeat(3, 1fr); }
  .topnav { padding: 0 12px; }
  .nav-links { gap: 10px; }
}
