/* ═══ VaultShare — UI moderne ═══ */
:root {
  --bg: #0b0e1a;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.1);
  --text: #eef0f8;
  --muted: #8b91a7;
  --accent: #7c6cff;
  --accent-2: #38d9f5;
  --success: #3ddc97;
  --danger: #ff5d73;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Fond animé ── */
.bg-orbs {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(124, 108, 255, 0.16), transparent 60%),
    radial-gradient(900px 600px at -10% 90%, rgba(56, 217, 245, 0.12), transparent 60%),
    var(--bg);
}
.orb {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5;
  animation: drift 22s ease-in-out infinite alternate;
}
.orb:nth-child(1) { width: 420px; height: 420px; top: -120px; left: 8%; background: #5b46f0; }
.orb:nth-child(2) { width: 340px; height: 340px; bottom: -80px; right: 10%; background: #0ea5c9; animation-delay: -7s; }
.orb:nth-child(3) { width: 260px; height: 260px; top: 45%; left: 55%; background: #a34bd8; animation-delay: -14s; opacity: 0.3; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(60px, -50px) scale(1.15); }
}

/* ── Infobulles personnalisées ── */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 11px); left: 50%;
  translate: -50% 5px;
  scale: 0.92;
  background: #1d2340;
  border: 1px solid rgba(124, 108, 255, 0.4);
  color: var(--text);
  font-size: 0.76rem; font-weight: 500; letter-spacing: 0.01em;
  padding: 7px 12px; border-radius: 9px;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, translate 0.25s cubic-bezier(0.2, 1.2, 0.4, 1), scale 0.25s cubic-bezier(0.2, 1.2, 0.4, 1);
  z-index: 70;
}
[data-tip]::before {
  content: '';
  position: absolute; bottom: calc(100% + 5px); left: 50%;
  translate: -50% 5px;
  border: 6px solid transparent;
  border-top-color: #1d2340;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, translate 0.25s cubic-bezier(0.2, 1.2, 0.4, 1);
  z-index: 70;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after,
[data-tip]:hover::before, [data-tip]:focus-visible::before {
  opacity: 1; translate: -50% 0; scale: 1;
  transition-delay: 0.25s;
}
/* Variante alignée à droite (évite le débordement près du bord) */
.file-actions [data-tip]::after { left: auto; right: -6px; translate: 0 5px; }
.file-actions [data-tip]:hover::after, .file-actions [data-tip]:focus-visible::after { translate: 0 0; }

/* ── Icônes SVG ── */
.sprite-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 18px; height: 18px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -3px;
}
.badge-icon { width: 12px; height: 12px; vertical-align: -2px; }
.logo-icon { width: 34px; height: 34px; color: #fff; }

/* ── Structure ── */
.container { max-width: 1060px; margin: 0 auto; padding: 24px; }

header.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; animation: fadeDown 0.6s ease both;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.25rem; }
.brand .logo {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 12px; color: #fff;
  box-shadow: 0 6px 20px rgba(124, 108, 255, 0.45);
}
.brand .logo .icon { width: 20px; height: 20px; }
.userbox { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.9rem; }

/* ── Cartes ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  padding: 28px;
  animation: fadeUp 0.6s ease both;
}

/* ── Dropzone ── */
.dropzone {
  border: 2px dashed rgba(124, 108, 255, 0.45);
  border-radius: var(--radius);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.25s;
  position: relative;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-2);
  background: rgba(124, 108, 255, 0.08);
  transform: scale(1.01);
}
.dropzone .dz-icon {
  width: 52px; height: 52px; display: block; margin: 0 auto 14px;
  fill: none; stroke: var(--accent-2); stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
  animation: floaty 3s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.dropzone h2 { font-size: 1.15rem; margin-bottom: 6px; }
.dropzone p { color: var(--muted); font-size: 0.9rem; }

/* ── Options d'upload ── */
.upload-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px; margin-top: 20px;
}
@media (max-width: 780px) { .upload-options { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 440px) { .upload-options { grid-template-columns: 1fr; } }
.upload-options label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 0.78rem; color: var(--muted);
}
/* Les contrôles restent alignés même si le libellé passe sur deux lignes */
.upload-options input,
.upload-options .switch { margin-top: auto; }
.upload-options input[type="number"],
.upload-options input[type="password"] {
  padding: 10px 12px; border-radius: 10px; font: inherit;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  transition: border-color 0.2s;
}
.upload-options input:focus { outline: none; border-color: var(--accent); }

/* ── Interrupteur (toggle) ── */
.switch {
  position: relative; display: inline-block;
  width: 46px; height: 26px; margin-bottom: 7px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; top: 3px;
  background: var(--muted); border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.2, 1.2, 0.4, 1), background 0.25s;
}
.switch input:checked + .slider {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(124, 108, 255, 0.45);
}
.switch input:checked + .slider::before { transform: translateX(20px); background: #fff; }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ── Barre de progression ── */
.progress-wrap { margin-top: 20px; display: none; }
.progress-wrap.active { display: block; animation: fadeUp 0.3s ease both; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }
.progress {
  height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden;
}
.progress .bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 99px;
  transition: width 0.2s ease;
  box-shadow: 0 0 14px rgba(56, 217, 245, 0.6);
}

/* ── Section « Mes fichiers » intégrée ── */
.section-files { margin-top: 28px; padding: 0; overflow: hidden; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
}
.section-head h2 { font-size: 1.15rem; margin-bottom: 3px; }
.count-pill {
  min-width: 34px; padding: 5px 12px; text-align: center;
  border-radius: 99px; font-weight: 700; font-size: 0.9rem;
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.25), rgba(56, 217, 245, 0.2));
  border: 1px solid rgba(124, 108, 255, 0.35);
}

.file-list { display: block; }
.empty-list { color: var(--muted); padding: 26px 28px; font-size: 0.9rem; }
.file-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 16px; align-items: center;
  padding: 15px 28px;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
  animation: fadeUp 0.45s ease both;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: rgba(255, 255, 255, 0.04); }
.file-icon {
  width: 44px; height: 44px; display: grid; place-items: center;
  color: var(--accent-2);
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.22), rgba(56, 217, 245, 0.16));
  border-radius: 12px;
}
.file-icon .icon { width: 20px; height: 20px; }
.file-info .name { font-weight: 600; word-break: break-all; }
.file-info .meta {
  color: var(--muted); font-size: 0.82rem; margin-top: 4px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.file-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.75rem; padding: 3px 10px; border-radius: 99px;
  background: rgba(61, 220, 151, 0.15); color: var(--success);
}
.badge.zero { background: rgba(124, 108, 255, 0.18); color: #b3a8ff; }
.badge.warn { background: rgba(255, 93, 115, 0.15); color: var(--danger); }

/* ── Boutons ── */
.btn {
  border: none; cursor: pointer; font: inherit;
  padding: 10px 18px; border-radius: 12px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.14); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #5a8dee);
  border: none;
  box-shadow: 0 8px 24px rgba(124, 108, 255, 0.4);
}
.btn.primary:hover { box-shadow: 0 12px 32px rgba(124, 108, 255, 0.55); }
.btn.danger { color: var(--danger); border-color: rgba(255, 93, 115, 0.3); }
.btn.small { padding: 7px 13px; font-size: 0.82rem; border-radius: 10px; }
.btn.big { padding: 15px 34px; font-size: 1.05rem; border-radius: 14px; }
.btn.icon-btn { width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: 11px; }
.btn.icon-btn:hover { color: var(--accent-2); }
.btn.icon-btn.danger:hover { color: var(--danger); background: rgba(255, 93, 115, 0.12); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5, 7, 15, 0.7);
  backdrop-filter: blur(6px);
  display: none; place-items: center; z-index: 50; padding: 20px;
}
.modal-backdrop.open { display: grid; animation: fadeIn 0.25s ease both; }
.modal {
  width: min(680px, 100%);
  max-height: 82vh; overflow: auto;
  background: #131728;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  animation: pop 0.3s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@keyframes pop {
  from { transform: scale(0.92) translateY(14px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.modal h3 { margin-bottom: 16px; }
.modal .close-row { display: flex; justify-content: flex-end; margin-top: 20px; }

/* ── Tableau stats ── */
table.stats { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.stats th, table.stats td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.stats th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; text-align: center;
}
.stat-card .num { font-size: 1.7rem; font-weight: 700; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-card .lbl { color: var(--muted); font-size: 0.78rem; margin-top: 4px; }

/* ── Lien de partage ── */
.share-link-row {
  display: flex; gap: 10px; margin-top: 14px;
}
.share-link-row input {
  flex: 1; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--accent-2); font-family: monospace; font-size: 0.82rem;
}
.notice {
  margin-top: 14px; padding: 12px 16px; border-radius: 12px;
  background: rgba(56, 217, 245, 0.08); border: 1px solid rgba(56, 217, 245, 0.25);
  color: #9adef0; font-size: 0.84rem; line-height: 1.5;
}

/* ── Toast ── */
#toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #1b2138; border: 1px solid var(--border);
  padding: 13px 22px; border-radius: 14px;
  box-shadow: var(--shadow); z-index: 100; opacity: 0;
  transition: transform 0.35s cubic-bezier(0.2, 1.2, 0.4, 1), opacity 0.35s;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ── Page login / download ── */
.hero {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.hero .card { max-width: 460px; width: 100%; text-align: center; padding: 48px 40px; }
.hero .logo-big {
  width: 76px; height: 76px; margin: 0 auto 22px; display: grid; place-items: center;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 40px rgba(124, 108, 255, 0.5);
  animation: floaty 3.5s ease-in-out infinite;
}
.hero h1 { font-size: 1.7rem; margin-bottom: 10px; }
.hero p.sub { color: var(--muted); margin-bottom: 30px; line-height: 1.6; }
.features { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }

/* ── Cercle de progression (download) ── */
.ring { position: relative; width: 130px; height: 130px; margin: 20px auto; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: var(--surface-2); }
.ring .fill {
  stroke: url(#grad); stroke-linecap: round;
  stroke-dasharray: 339.3; stroke-dashoffset: 339.3;
  transition: stroke-dashoffset 0.25s ease;
}
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 1.2rem; }

.hidden { display: none !important; }

/* ── Spinner ── */
.spinner {
  width: 30px; height: 30px; margin: 6px auto 16px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* ── Formulaire mot de passe (lien protégé) ── */
.pw-row { display: flex; gap: 10px; margin-top: 6px; }
.pw-row input {
  flex: 1; padding: 12px 14px; border-radius: 12px; font: inherit;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.pw-row input:focus { outline: none; border-color: var(--accent); }
.pw-error { margin-top: 12px; font-size: 0.85rem; }

/* Utilitaires (CSP stricte : pas de style inline) */
.muted-sub { color: var(--muted); font-size: 0.85rem; font-weight: 400; }
.muted-text { color: var(--muted); }
.danger-text { color: var(--danger); }
.strong-name { color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeUp   { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 640px) {
  .file-row { grid-template-columns: 1fr; }
  .file-actions { justify-content: flex-start; }
}
