/* media-manager/public/style.css
   Theme sombre, sobre et responsive. */

:root {
  --bg: #0e1117;
  --bg-soft: #161b25;
  --bg-card: #1a2029;
  --border: #2a323f;
  --text: #e6e9ef;
  --text-muted: #8b95a7;
  --accent: #6d5efc;
  --accent-hover: #8577ff;
  --success: #3ecf8e;
  --danger: #ff5f6d;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2 { margin: 0; font-weight: 600; }
h1 { font-size: 1.15rem; }
h2 { font-size: 1rem; }

.muted { color: var(--text-muted); }
.small { font-size: 0.8rem; }
.center { text-align: center; }

/* ---------- Barre superieure ---------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 12px; }

.logo {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--accent);
  font-size: 1.2rem;
}

.subtitle { margin: 0; font-size: 0.8rem; color: var(--text-muted); }

.token-box { display: flex; align-items: center; gap: 8px; }
.token-box label { font-size: 0.8rem; color: var(--text-muted); }

input[type="password"],
input[type="text"],
input[type="search"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.85rem;
  outline: none;
}

input:focus { border-color: var(--accent); }

/* ---------- Layout ---------- */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header-actions { display: flex; gap: 8px; }

/* ---------- Onglets ---------- */

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }

.tab {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  padding: 9px 18px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}

.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Boutons ---------- */

.btn {
  display: inline-block;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 16px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.ghost { background: transparent; }

.ghost {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 7px 10px;
  cursor: pointer;
}

.actions { display: flex; gap: 10px; margin-top: 14px; }

/* ---------- Zone de depot ---------- */

.dropzone {
  margin-top: 14px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 16px;
  text-align: center;
  transition: all 0.15s ease;
}

.dropzone.dragover { border-color: var(--accent); background: rgba(109, 94, 252, 0.08); }
.dropzone p { margin: 6px 0; }

.selected-files { list-style: none; margin: 14px 0 0; padding: 0; }

.selected-files li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  font-size: 0.85rem;
}

/* ---------- Barre de progression ---------- */

.progress {
  margin-top: 14px;
  height: 6px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease;
}

/* ---------- Resultats d'upload ---------- */

.results { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

.result-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.result-row input {
  flex: 1 1 260px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8rem;
}

/* ---------- Galerie ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

/* En mode liste (sons / videos), une seule colonne */
.gallery.list { grid-template-columns: 1fr; }

.media-item {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.media-item .thumb {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: #0a0d12;
}

.media-item .meta { padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }

.media-item .name {
  font-size: 0.78rem;
  word-break: break-all;
  color: var(--text);
  text-decoration: none;
}

.media-item .name:hover { color: var(--accent-hover); }
.media-item .size { font-size: 0.72rem; color: var(--text-muted); }

.media-item.row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  flex-wrap: wrap;
}

.media-item.row .meta { padding: 0; flex: 1 1 240px; }
.media-item.row audio,
.media-item.row video { max-width: 320px; width: 100%; }

.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 4px 8px;
  cursor: pointer;
}

.copy-btn:hover { color: var(--text); border-color: var(--accent); }

/* ---------- Notifications ---------- */

.toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 0.85rem;
  animation: slide-in 0.2s ease;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

@keyframes slide-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .token-box { width: 100%; }
  .token-box input { flex: 1; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
