/* ============================================================
   Médiathèque — Feuille de style commune
   Thème : sombre / artistique / accent jaune
   ============================================================ */

/* Variables */
:root {
  --bg-body:        #1a1a1e;
  --bg-container:   #23232b;
  --bg-card:        #2a2a34;
  --bg-input:       #1e1e26;
  --border:         #38384a;
  --text-main:      #e8e8e8;
  --text-secondary: #999;
  --text-muted:     #666;
  --accent:         #f0c040;
  --accent-hover:   #d4a820;
  --accent-text:    #1a1a1e;
  --success:        #4caf7d;
  --danger:         #e05555;
  --shadow:         0 4px 32px rgba(0,0,0,0.5);
  --radius:         16px;
  --radius-sm:      10px;
  --radius-xs:      7px;
}

/* Reset */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: 'Segoe UI', Arial, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1;
  background: url("fond.jpg") no-repeat center center;
  background-size: cover;
  opacity: 0.12;
}

/* Container principal */
.container {
  max-width: 950px;
  width: 98vw;
  margin: 30px auto;
  background: var(--bg-container);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 2vw 2vw 32px 2vw;
}

/* Titres */
h1 {
  text-align: center;
  color: var(--accent);
  font-size: 1.8em;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

h2 {
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  font-size: 1.15em;
  margin-top: 28px;
}

/* Liens */
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95em;
}
.back-link:hover { color: var(--accent); }

/* Menu boutons */
.menu {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
  margin: 24px 0;
}

.menu form { margin: 0; }

.menu-btn,
.menu-btn:link,
.menu-btn:visited,
.menu-btn:active,
.menu-btn:focus,
form .menu-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: #2e2e3a;
  color: var(--text-main);
  font-weight: bold;
  font-size: 0.92em;
  border-radius: var(--radius-sm);
  padding: 12px 10px 10px 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  min-width: 75px;
  min-height: 90px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  border: 1px solid var(--border);
  appearance: none;
  -webkit-appearance: none;
  line-height: 1.2;
}

.menu-btn:hover,
form .menu-btn:hover {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.menu-btn svg { width: 28px; height: 28px; margin-bottom: 6px; display: block; }

.menu-btn.accent {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
.menu-btn.accent:hover { background: var(--accent-hover); }

.menu-btn.success {
  background: #1e3a2a;
  color: var(--success);
  border-color: var(--success);
}
.menu-btn.success:hover { background: var(--success); color: #111; }

.menu-btn.danger {
  background: #3a1e1e;
  color: var(--danger);
  border-color: var(--danger);
}
.menu-btn.danger:hover { background: var(--danger); color: #fff; }

/* Boutons généraux */
.btn {
  padding: 9px 22px;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 0.95em;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.18s, color 0.18s;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-text); }

.btn-secondary {
  background: #2e2e3a;
  color: var(--text-main);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #3a3a48; }

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

.btn-success {
  background: var(--success);
  color: #111;
}
.btn-success:hover { background: #3a9a66; }

/* Formulaires */
label {
  display: block;
  font-weight: bold;
  color: var(--text-secondary);
  margin-bottom: 5px;
  font-size: 0.93em;
}
label small { font-weight: normal; color: var(--text-muted); }

input[type=text],
input[type=email],
input[type=password],
input[type=file],
textarea,
select {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-main);
  font-size: 1em;
  font-family: inherit;
  transition: border-color 0.15s;
}

input[type=text]:focus,
input[type=email]:focus,
input[type=password]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  outline: none;
}

textarea { resize: vertical; min-height: 80px; }

.form-group { margin-bottom: 18px; }

/* Messages d'alerte */
.msg, .msg-alert {
  padding: 12px 18px;
  border-radius: var(--radius-xs);
  margin-bottom: 20px;
  text-align: center;
  font-size: 1em;
}
.msg.success, .msg-alert.success {
  background: #1a3a28;
  color: #6ddb9a;
  border: 1px solid #2a6a44;
}
.msg.error, .msg-alert.error {
  background: #3a1a1a;
  color: #ff8080;
  border: 1px solid #6a2a2a;
}

/* Section titles */
.section-title {
  font-size: 1em;
  color: var(--accent);
  font-weight: bold;
  border-bottom: 1px solid var(--border);
  margin: 24px 0 14px 0;
  padding-bottom: 5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Cards génériques */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 12px;
  transition: border-color 0.18s;
}
.card:hover { border-color: var(--accent); }

/* Humeur / info block */
.mood-block {
  background: #1e1e28;
  padding: 14px 22px;
  margin-bottom: 24px;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-xs);
  font-size: 1.05em;
  color: var(--text-secondary);
}
.mood-block strong { color: var(--accent); }

/* Grille responsive */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 25px;
}
@media (max-width: 700px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* Liste reset */
.list-reset { list-style: none; padding: 0; margin: 0; }

.row-link {
  display: block;
  color: var(--text-main);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  transition: background 0.15s;
}
.row-link:hover { background: #2e2e3a; color: var(--accent); }

/* Réponses / commentaires */
.replies {
  margin: 8px 0 0 16px;
  border-left: 2px solid var(--border);
  padding-left: 12px;
}
.reply {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  margin-top: 6px;
}
.reply .meta { color: var(--text-muted); font-size: 0.88em; margin-bottom: 4px; }

/* Badge */
.badge {
  display: inline-block;
  font-size: 0.78em;
  padding: 2px 10px;
  border-radius: 20px;
  margin-left: 6px;
}
.badge-accent  { background: #3a3010; color: var(--accent); }
.badge-success { background: #1a3a28; color: var(--success); }
.badge-muted   { background: #2a2a3a; color: var(--text-muted); }

/* Empty state */
.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  font-size: 1em;
}

/* Scrollbar (webkit) */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================================
   RESPONSIVE — Tablette (max 768px) et Mobile (max 480px)
   ============================================================ */

/* ── Tablette : 480px – 768px ─────────────────────────────── */
@media (max-width: 768px) {

  /* Conteneur pleine largeur avec padding adapté */
  .container {
    width: 100%;
    margin: 12px auto;
    padding: 16px 14px 24px 14px;
    border-radius: 12px;
  }

  /* Titres légèrement réduits */
  h1 { font-size: 1.5em; }
  h2 { font-size: 1.1em; }

  /* Menu boutons — 2 colonnes sur tablette */
  .menu {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
  }

  .menu-btn,
  .menu-btn:link, .menu-btn:visited,
  form .menu-btn {
    min-width: unset;
    min-height: 80px;
    padding: 10px 6px;
    font-size: 0.88em;
  }

  /* Grilles 2 colonnes */
  .grid-2 {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Nav buttons (home/profile) en rangées */
  .nav-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav-btn {
    flex: 1 1 140px;
    font-size: 0.9em;
    padding: 10px 12px;
  }

  /* Inputs et selects plus grands pour le toucher */
  input[type=text],
  input[type=email],
  input[type=password],
  input[type=file],
  textarea,
  select {
    font-size: 16px; /* évite le zoom automatique iOS */
    padding: 10px 12px;
  }

  /* Boutons plus faciles à toucher */
  .btn {
    padding: 11px 20px;
    font-size: 1em;
  }

  /* Formulaires : actions empilées */
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; text-align: center; }
}

/* ── Mobile : max 480px ───────────────────────────────────── */
@media (max-width: 480px) {

  body { font-size: 16px; }

  .container {
    margin: 0;
    border-radius: 0;
    padding: 14px 12px 24px 12px;
    min-height: 100vh;
  }

  h1 { font-size: 1.35em; margin-bottom: 12px; }
  h2 { font-size: 1.05em; }

  /* Menu boutons — 3 par ligne sur mobile */
  .menu {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .menu-btn,
  .menu-btn:link, .menu-btn:visited,
  form .menu-btn {
    min-height: 72px;
    font-size: 0.78em;
    padding: 8px 4px;
  }

  .menu-btn svg { width: 22px; height: 22px; margin-bottom: 4px; }

  /* Nav buttons pleine largeur */
  .nav-btn {
    flex: 1 1 100%;
    font-size: 0.95em;
    padding: 12px 14px;
    gap: 14px;
  }

  /* Coin haut droite : réduire avatar */
  .user-corner-wrap {
    top: 10px;
    right: 10px;
  }

  .user-corner-avatar,
  .user-corner-placeholder {
    width: 38px;
    height: 38px;
    font-size: 1em;
  }

  .user-corner-name { font-size: 0.82em; }

  .logout-btn { font-size: 0.75em; padding: 3px 8px; }

  /* Profil box portrait */
  .profile-box { min-height: 180px; }

  /* Grilles médias */
  .playlists-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* Section titre compacte */
  .section-title { font-size: 0.9em; margin: 16px 0 10px 0; }

  /* Chips plus petits */
  .badge { font-size: 0.72em; padding: 1px 7px; }

  /* Cards membres */
  .person-chip { padding: 6px 10px; font-size: 0.85em; }

  /* Grille relation (amis/famille) */
  .relation-grid { grid-template-columns: 1fr; }

  /* Boutons full width sur mobile */
  .btn { padding: 12px 16px; font-size: 1em; }

  /* Formulaire de connexion centré */
  .container[style*="max-width: 420px"],
  .container[style*="max-width:420px"] {
    margin: 0 !important;
    border-radius: 0 !important;
    padding: 24px 16px !important;
    min-height: 100vh;
  }

  /* Back link plus grand */
  .back-link { font-size: 1em; padding: 4px 0; display: inline-block; }

  /* Mood block compact */
  .mood-block { padding: 10px 14px; font-size: 0.95em; }

  /* Chroniques : texte plus petit */
  .chroniques h3 { font-size: 0.88em; }
  .row-link { font-size: 0.9em; }

  /* Main row (profil box + nav) empilé */
  .main-row { flex-direction: column; }
}

/* ── Viewport meta helper ─────────────────────────────────── */
/* S'assurer que les inputs ne zooment pas sur iOS */
@supports (-webkit-touch-callout: none) {
  input, select, textarea {
    font-size: 16px !important;
  }
}