/* =====================================================================
   AXION CLOUD — Système de design
   Association Axion © 2024
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Palette Axion */
  --primary:        #0D1B4E;   /* Navy profond  */
  --primary-mid:    #1D4ED8;   /* Bleu royal    */
  --primary-light:  #3B82F6;   /* Bleu vif      */
  --accent:         #22D3EE;   /* Cyan          */
  --accent-dark:    #0891B2;

  /* Sémantique */
  --success:  #10B981;
  --danger:   #EF4444;
  --warning:  #F59E0B;

  /* Surfaces */
  --bg:           #F3F6FF;
  --surface:      #FFFFFF;
  --surface-alt:  #EEF2FF;
  --surface-hover:#E5EDFF;

  /* Texte */
  --text:         #0F172A;
  --text-muted:   #64748B;
  --text-light:   #94A3B8;

  /* Bordures */
  --border:       #CBD5F0;
  --border-light: #E0E7FF;

  /* Ombres */
  --shadow-sm: 0 1px 3px rgba(13,27,78,.08);
  --shadow:    0 4px 12px rgba(13,27,78,.08);
  --shadow-md: 0 10px 28px rgba(13,27,78,.12);
  --shadow-lg: 0 24px 56px rgba(13,27,78,.18);

  /* Dimensions */
  --radius-sm:   6px;
  --radius:     12px;
  --radius-lg:  20px;
  --radius-full:9999px;

  --transition: 180ms cubic-bezier(.4,0,.2,1);
}

/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-mid); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* ── Boutons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap; text-decoration: none;
  line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary-mid), var(--accent-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(29,78,216,.28);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(29,78,216,.38); }

.btn-secondary {
  background: var(--surface-alt);
  color: var(--primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }

.btn-ghost { background: transparent; color: var(--text-muted); padding: 8px 12px; }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }

.btn-sm  { padding: 6px 14px; font-size: 13px; }
.btn-lg  { padding: 14px 28px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Formulaires ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit;
  background: var(--surface); color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(29,78,216,.14);
}
.form-control::placeholder { color: var(--text-light); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.input-row { display: flex; gap: 12px; }
.input-row .form-group { flex: 1; min-width: 0; }

/* ── Cards ──────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.card-title { font-size: 16px; font-weight: 700; }

/* ── Toasts ─────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--primary-mid);
  font-size: 14px; font-weight: 500;
  min-width: 260px; max-width: 380px;
  animation: slideInToast .3s ease;
  pointer-events: all;
}
.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger);  }
.toast.warning { border-color: var(--warning); }

@keyframes slideInToast  { from { transform: translateX(110%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideOutToast { from { transform: none; opacity: 1; } to { transform: translateX(110%); opacity: 0; } }

/* ── Modales ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(13,27,78,.55);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  animation: fadeModal .2s ease;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px;
  animation: scaleModal .22s ease;
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px 0;
}
.modal-title { font-size: 18px; font-weight: 800; }
.modal-close {
  width: 30px; height: 30px;
  border: none; background: var(--surface-alt);
  border-radius: var(--radius-sm);
  cursor: pointer; font-size: 16px;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--surface-hover); color: var(--text); }
.modal-body { padding: 20px 28px 28px; }

@keyframes fadeModal  { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleModal { from { transform: scale(.95); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Badges ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600;
}
.badge-blue   { background: #DBEAFE; color: #1D4ED8; }
.badge-green  { background: #D1FAE5; color: #059669; }
.badge-red    { background: #FEE2E2; color: #DC2626; }
.badge-yellow { background: #FEF3C7; color: #D97706; }
.badge-purple { background: #EDE9FE; color: #7C3AED; }
.badge-gray   { background: var(--surface-alt); color: var(--text-muted); }

/* ── Barre de stockage ──────────────────────────────────────────────── */
.storage-bar {
  width: 100%; height: 6px;
  background: var(--border-light);
  border-radius: var(--radius-full); overflow: hidden;
}
.storage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-mid), var(--accent));
  border-radius: var(--radius-full);
  transition: width .5s ease;
}
.storage-bar-fill.warning { background: linear-gradient(90deg, var(--warning), #F97316); }
.storage-bar-fill.danger  { background: linear-gradient(90deg, var(--danger), #DC2626);  }

/* ── Navbar ─────────────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0;
  background: var(--primary);
  border-bottom: 1px solid rgba(255,255,255,.07);
  padding: 0 24px; height: 62px;
  display: flex; align-items: center; justify-content: space-between;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(13,27,78,.35);
}
.navbar-brand {
  display: flex; align-items: center; gap: 11px;
  text-decoration: none;
}
.navbar-logo {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 14px; color: white;
  letter-spacing: -.5px;
}
.navbar-name { color: white; font-size: 16px; font-weight: 800; letter-spacing: -.3px; }
.navbar-name span { color: var(--accent); }
.navbar-actions { display: flex; align-items: center; gap: 8px; }
.navbar-user { display: flex; align-items: center; gap: 9px; color: rgba(255,255,255,.8); font-size: 14px; font-weight: 500; }
.navbar-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: white;
  flex-shrink: 0;
}

/* ── Layout ─────────────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: calc(100vh - 62px); }

/* ── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  width: 252px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border-light);
  padding: 20px 0;
  position: sticky; top: 62px;
  height: calc(100vh - 62px); overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar-section { padding: 0 14px; margin-bottom: 20px; }
.sidebar-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-light);
  padding: 0 10px; margin-bottom: 6px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 14px; font-weight: 500;
  cursor: pointer; border: none; background: none;
  width: 100%; text-align: left;
  transition: all var(--transition); text-decoration: none;
}
.sidebar-item:hover  { background: var(--surface-hover); color: var(--text); }
.sidebar-item.active { background: var(--surface-alt); color: var(--primary-mid); font-weight: 600; }

/* ── Contenu principal ──────────────────────────────────────────────── */
.main-content { flex: 1; padding: 28px; overflow-x: hidden; }
.page-header {
  margin-bottom: 22px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.page-title    { font-size: 22px; font-weight: 900; letter-spacing: -.5px; }
.page-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* ── Grille fichiers ────────────────────────────────────────────────── */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.file-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 18px 14px 14px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative; text-align: center;
}
.file-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.file-card-actions {
  position: absolute; top: 8px; right: 8px;
  display: none; gap: 3px;
}
.file-card:hover .file-card-actions { display: flex; }
.file-card-icon {
  width: 52px; height: 52px;
  margin: 0 auto 12px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.file-card-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  word-break: break-all;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.4; margin-bottom: 5px;
}
.file-card-meta { font-size: 11px; color: var(--text-light); }

/* Icônes par type */
.fi-img  { background: #DBEAFE; }
.fi-vid  { background: #FEE2E2; }
.fi-aud  { background: #D1FAE5; }
.fi-doc  { background: #EDE9FE; }
.fi-pdf  { background: #FECACA; }
.fi-zip  { background: #FEF3C7; }
.fi-code { background: #DCFCE7; }
.fi-def  { background: var(--surface-alt); }

/* ── Table ──────────────────────────────────────────────────────────── */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-muted);
  border-bottom: 2px solid var(--border-light); white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text); vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFBFF; }

/* ── Stats cards ────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 18px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 46px; height: 46px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.blue   { background: #DBEAFE; }
.stat-icon.green  { background: #D1FAE5; }
.stat-icon.purple { background: #EDE9FE; }
.stat-icon.orange { background: #FEF3C7; }
.stat-value { font-size: 22px; font-weight: 900; letter-spacing: -.5px; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* ── Empty state ────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-state-icon  { font-size: 52px; margin-bottom: 14px; }
.empty-state-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state-text  { font-size: 14px; }

/* ── Spinner ────────────────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(29,78,216,.2);
  border-top-color: var(--primary-mid);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Zone de dépôt ──────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px; text-align: center;
  cursor: pointer; background: var(--surface-alt);
  transition: all var(--transition);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary-mid);
  background: #EEF2FF;
}
.upload-zone-icon { font-size: 38px; margin-bottom: 10px; }
.upload-zone-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.upload-zone-sub   { font-size: 13px; color: var(--text-muted); }

/* ── Barre de progression ───────────────────────────────────────────── */
.progress { width: 100%; height: 5px; background: var(--border-light); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary-mid), var(--accent)); transition: width .3s; }

/* ── Pages d'auth ───────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary);
  position: relative; overflow: hidden; padding: 20px;
}
/* Grille de points — signature visuelle Axion */
.auth-page::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 30px 30px;
}
.auth-page::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 60% at 20% 50%, rgba(34,211,238,.10) 0%, transparent 70%),
    radial-gradient(ellipse 50% 50% at 80% 20%, rgba(59,130,246,.10) 0%, transparent 70%);
}
.auth-card {
  position: relative; z-index: 10;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: 38px 36px;
  width: 100%; max-width: 428px;
  box-shadow: 0 28px 64px rgba(0,0,0,.32), 0 0 0 1px rgba(255,255,255,.08);
}
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; justify-content: center; }
.auth-logo-mark {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, var(--primary-mid), var(--accent-dark));
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 900; color: white; letter-spacing: -1px;
  box-shadow: 0 8px 20px rgba(29,78,216,.32);
}
.auth-brand-name { font-size: 18px; font-weight: 900; color: var(--primary); letter-spacing: -.5px; }
.auth-brand-sub  { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.auth-title    { font-size: 22px; font-weight: 900; letter-spacing: -.5px; margin-bottom: 4px; }
.auth-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.auth-error {
  background: #FEE2E2; color: #DC2626;
  padding: 10px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  margin-bottom: 16px; display: none;
}

/* ── Lien copier ────────────────────────────────────────────────────── */
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row .form-control { font-size: 12px; color: var(--text-muted); font-family: monospace; }

/* ── Toggle (switch) ────────────────────────────────────────────────── */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 22px; transition: .3s;
}
.switch-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px;
  left: 3px; bottom: 3px;
  background: white; border-radius: 50%; transition: .3s;
}
input:checked + .switch-slider { background: var(--primary-mid); }
input:checked + .switch-slider::before { transform: translateX(18px); }

/* ── Tag input (emails) ─────────────────────────────────────────────── */
.tag-input-wrap {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface); min-height: 46px;
  align-items: center; cursor: text;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.tag-input-wrap:focus-within {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(29,78,216,.14);
}
.email-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: #DBEAFE; color: var(--primary-mid);
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 500;
}
.email-tag button { cursor: pointer; background: none; border: none; color: var(--primary-mid); font-size: 14px; line-height: 1; padding: 0; }
.tag-field { border: none; outline: none; font-size: 14px; font-family: inherit; background: transparent; flex: 1; min-width: 120px; color: var(--text); }

/* ── Dropdown ───────────────────────────────────────────────────────── */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 170px; z-index: 200; overflow: hidden;
}
.dropdown-menu.hidden { display: none; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; font-size: 14px;
  color: var(--text); cursor: pointer;
  border: none; background: none;
  width: 100%; text-align: left;
  transition: background var(--transition);
}
.dropdown-item:hover { background: var(--surface-alt); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: #FEE2E2; }
.dropdown-divider { height: 1px; background: var(--border-light); }

/* ── Sidebar admin ──────────────────────────────────────────────────── */
.admin-sidebar {
  width: 252px; flex-shrink: 0;
  background: var(--primary);
  padding: 0; display: flex; flex-direction: column;
  min-height: 100vh;
}
.admin-sidebar-header {
  padding: 22px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 12px;
}
.admin-sidebar-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: rgba(255,255,255,.3);
  padding: 10px 20px 6px;
}
.admin-sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.6); font-size: 14px; font-weight: 500;
  cursor: pointer; border: none; background: none;
  width: 100%; text-align: left;
  transition: all var(--transition);
}
.admin-sidebar-item:hover  { background: rgba(255,255,255,.07); color: rgba(255,255,255,.95); }
.admin-sidebar-item.active { background: rgba(29,78,216,.45); color: white; font-weight: 700; }
.admin-sidebar-footer { margin-top: auto; padding: 20px; border-top: 1px solid rgba(255,255,255,.08); }

/* ── Onglets share ──────────────────────────────────────────────────── */
.share-tabs { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 18px; }
.share-tab {
  flex: 1; padding: 10px;
  border: none; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all var(--transition);
}
.share-tab.active { background: var(--primary-mid); color: white; }
.share-tab:not(.active) { background: var(--surface-alt); color: var(--text-muted); }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 16px; }
  .files-grid { grid-template-columns: repeat(auto-fill, minmax(145px,1fr)); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 26px 18px; }
  .admin-sidebar { width: 220px; }
}
