/* ============================================================
   Apprendre à manger — Design system
   Mobile-first · Bleu ciel pâle · Inter
   ============================================================ */

/* --- Variables --- */
:root {
  --blue-50:  #f0f7ff;
  --blue-100: #daeeff;
  --blue-200: #b3dcff;
  --blue-400: #60aff5;
  --blue-500: #3d98ee;
  --blue-600: #2178c4;
  --beige-50: #fafaf8;
  --beige-100: #f5f4f0;
  --gray-200: #e8e8e8;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-900: #111827;

  --accent:       var(--blue-500);
  --accent-light: var(--blue-100);
  --accent-dark:  var(--blue-600);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 12px rgba(0,0,0,.08);

  --bottom-nav-h: 64px;
  --header-h:     56px;
}

/* --- Reset minimal --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--beige-50);
  color: var(--gray-900);
  line-height: 1.6;
  min-height: 100vh;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 1rem;
  max-width: 900px;
  margin: 0 auto;
}
.site-logo {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-dark);
  letter-spacing: -.01em;
}
.header-user {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.header-username {
  font-size: .875rem;
  color: var(--gray-600);
}
.btn-logout {
  font-size: .8rem;
  color: var(--gray-400);
  border: 1px solid var(--gray-200);
  padding: .2rem .6rem;
  border-radius: var(--radius-sm);
}
.btn-logout:hover { color: var(--gray-600); text-decoration: none; background: var(--beige-100); }

/* --- Bottom nav (client mobile) --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--bottom-nav-h);
  background: #fff;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: stretch;
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--gray-400);
  font-size: .65rem;
  font-weight: 500;
  text-decoration: none;
  padding: .25rem 0;
  transition: color .15s;
}
.bottom-nav a svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bottom-nav a.active,
.bottom-nav a:hover { color: var(--accent); }

/* --- Sidebar admin (desktop) --- */
.sidebar {
  display: none; /* masquée sur mobile */
}

/* --- Main content --- */
.main-content {
  padding: 1.25rem 1rem calc(var(--bottom-nav-h) + 1.5rem);
  max-width: 640px;
  margin: 0 auto;
}
.main-admin {
  padding-bottom: 1.5rem;
  max-width: 900px;
}

/* --- Cards --- */
.card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: .75rem;
}
.card-subtitle {
  font-size: .8rem;
  color: var(--gray-400);
  margin-bottom: .5rem;
}

/* --- Boutons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s, opacity .15s;
  line-height: 1.4;
}
.btn-primary   { background: var(--accent);   color: #fff; }
.btn-primary:hover { background: var(--accent-dark); text-decoration: none; }
.btn-secondary { background: var(--accent-light); color: var(--accent-dark); }
.btn-secondary:hover { background: var(--blue-200); text-decoration: none; }
.btn-danger    { background: #fee2e2; color: #b91c1c; }
.btn-danger:hover { background: #fecaca; text-decoration: none; }
.btn-ghost     { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-200); }
.btn-ghost:hover { background: var(--beige-100); text-decoration: none; }
.btn-sm        { padding: .3rem .7rem; font-size: .8rem; }
.btn-full      { width: 100%; justify-content: center; }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* --- Formulaires --- */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: .35rem;
}
.form-control {
  width: 100%;
  padding: .6rem .85rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .9rem;
  color: var(--gray-900);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61,152,238,.15);
}
textarea.form-control { resize: vertical; min-height: 100px; }

/* --- Alertes --- */
.alert {
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 1rem;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: var(--blue-50); color: var(--blue-600); border: 1px solid var(--blue-200); }
.alert-warning { background: #fff7ed; color: #92400e; border: 1px solid #fed7aa; }

/* --- Listes d'items --- */
.item-list { list-style: none; }
.item-list li {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--gray-200);
}
.item-list li:last-child { border-bottom: none; }

/* --- Badge --- */
.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 600;
}
.badge-green  { background: #dcfce7; color: #166534; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: var(--blue-100); color: var(--blue-600); }

/* --- Page title --- */
.page-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 1.25rem;
}
.page-desc {
  font-size: .875rem;
  color: var(--gray-600);
  margin-top: -.75rem;
  margin-bottom: 1.25rem;
}

/* --- Lecteur audio --- */
.audio-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: .85rem;
  box-shadow: var(--shadow-sm);
}
.audio-card-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: .3rem;
}
.audio-card-desc {
  font-size: .8rem;
  color: var(--gray-400);
  margin-bottom: .75rem;
}
.audio-card audio {
  width: 100%;
  height: 40px;
}
/* Masque le bouton download du lecteur natif */
audio::-webkit-media-controls-download-button { display: none !important; }
audio::-webkit-media-controls-overflow-button  { display: none !important; }

/* --- Login page --- */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
  background: linear-gradient(160deg, var(--blue-50) 0%, var(--beige-50) 60%);
}
.login-box {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2rem 1.75rem;
  width: 100%;
  max-width: 380px;
}
.login-logo {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent-dark);
  margin-bottom: 1.75rem;
}
.login-logo small {
  display: block;
  font-size: .8rem;
  font-weight: 400;
  color: var(--gray-400);
  margin-top: .2rem;
}

/* --- Table admin --- */
.table-responsive { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.data-table th {
  text-align: left;
  padding: .6rem .75rem;
  background: var(--beige-100);
  color: var(--gray-600);
  font-weight: 500;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.data-table td {
  padding: .7rem .75rem;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--beige-50); }

/* --- Journal niveaux --- */
.niveau-facile  { color: #16a34a; font-weight: 600; }
.niveau-moyen   { color: #ca8a04; font-weight: 600; }
.niveau-difficile { color: #dc2626; font-weight: 600; }

/* --- Déblocage séances (admin) --- */
.seance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
  margin-top: .75rem;
}
.seance-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem .85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  background: #fff;
  font-size: .85rem;
}
.seance-item.unlocked { border-color: var(--blue-200); background: var(--blue-50); }

/* --- Upload progress --- */
.upload-progress-bar {
  height: 6px;
  border-radius: 99px;
  background: var(--gray-200);
  overflow: hidden;
  margin-top: .5rem;
  display: none;
}
.upload-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width .2s;
}

/* --- Admin sidebar visible sur desktop --- */
@media (min-width: 768px) {
  .sidebar {
    display: block;
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: 200px;
    background: #fff;
    border-right: 1px solid var(--gray-200);
    padding: 1.5rem 0;
    overflow-y: auto;
  }
  .sidebar ul { list-style: none; }
  .sidebar li a {
    display: block;
    padding: .6rem 1.25rem;
    font-size: .875rem;
    color: var(--gray-600);
    text-decoration: none;
    transition: background .1s, color .1s;
  }
  .sidebar li a:hover,
  .sidebar li a.active {
    background: var(--blue-50);
    color: var(--accent-dark);
  }
  .main-admin {
    margin-left: 200px;
    padding: 1.5rem 2rem;
  }
  .bottom-nav { display: none; }
}

/* --- Responsive utilitaires --- */
@media (min-width: 640px) {
  .main-content { padding-bottom: 1.5rem; }
  .bottom-nav   { display: none; }
}
