/* ══════════════════════════════════════════════════════
   COMMON.CSS — Styles partagés entre toutes les pages
   ══════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ── */
:root {
  --bg:         #F6F1E9;
  --bg-card:    #FDFAF5;
  --bg-dark:    #2A2016;
  --text:       #2A2016;
  --text-mid:   #6B6256;
  --text-light: #A89E93;
  --green:      #4A7354;
  --green-pale: #EDF3EE;
  --terra:      #C05A28;
  --terra-pale: #FAE9DF;
  --border:     #DDD6CB;
  --shadow:     0 2px 16px rgba(42,32,22,0.08);
  --radius:     12px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.7; }
h1,h2,h3,h4 { font-family: 'Playfair Display', Georgia, serif; line-height: 1.25; }
.hidden { display: none !important; }

/* ── NAV ── */
nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(246,241,233,0.93); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem; display: flex; align-items: center;
  justify-content: space-between; height: 60px; gap: 1rem;
}
.nav-brand { font-family: 'Playfair Display', serif; font-weight: 700; font-size: 1rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.nav-brand .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--terra); }
.nav-links { display: flex; gap: 1.25rem; list-style: none; }
.nav-links a { font-size: 0.84rem; font-weight: 500; color: var(--text-mid); text-decoration: none; transition: color 0.2s; }
.nav-links a:hover { color: var(--green); }
.nav-user { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.user-info { display: flex; align-items: center; gap: 0.5rem; }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.user-name { font-size: 0.82rem; color: var(--text-mid); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-login { padding: 0.4rem 0.9rem; background: var(--green); color: #fff; border: none; border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.8rem; font-weight: 500; cursor: pointer; transition: background 0.2s; display: flex; align-items: center; gap: 0.35rem; }
.btn-login:hover { background: #3a5e43; }
.btn-edit-pseudo { padding: 0.2rem 0.4rem; background: none; color: var(--text-light); border: none; font-size: 0.9rem; cursor: pointer; transition: color 0.2s; }
.btn-edit-pseudo:hover { color: var(--green); }
.btn-logout { padding: 0.3rem 0.7rem; background: none; color: var(--text-light); border: 1px solid var(--border); border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.76rem; cursor: pointer; transition: all 0.2s; }
.btn-logout:hover { color: var(--text); border-color: var(--text); }
.nav-user-mobile { position: relative; }
.avatar-btn { background: none; border: 2px solid transparent; border-radius: 50%; cursor: pointer; padding: 0; transition: border-color 0.2s; display: none; }
.avatar-btn:hover, .avatar-btn.open { border-color: var(--green); }
.avatar-btn img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; display: block; }
.avatar-dropdown { display: none; position: absolute; top: 42px; right: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.6rem 0; min-width: 160px; z-index: 200; }
.avatar-dropdown.open { display: block; }
.avatar-dropdown .dd-name { padding: 0.4rem 1rem; font-size: 0.82rem; color: var(--text-mid); border-bottom: 1px solid var(--border); margin-bottom: 0.3rem; }
.avatar-dropdown .dd-edit-pseudo { display: block; width: 100%; padding: 0.5rem 1rem; background: none; border: none; text-align: left; font-family: 'DM Sans', sans-serif; font-size: 0.84rem; color: var(--green); cursor: pointer; }
.avatar-dropdown .dd-edit-pseudo:hover { background: var(--bg-card); }
.avatar-dropdown .dd-logout { display: block; width: 100%; padding: 0.5rem 1rem; background: none; border: none; text-align: left; font-family: 'DM Sans', sans-serif; font-size: 0.84rem; color: var(--terra); cursor: pointer; }
.avatar-dropdown .dd-logout:hover { background: var(--terra-pale); }

/* ── HAMBURGER ── */
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 0.4rem; flex-shrink: 0; }
.hamburger span { display: block; width: 20px; height: 2px; background: var(--text); margin: 4px 0; border-radius: 2px; transition: transform 0.3s, opacity 0.3s; }
.hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── FAB STACK (bas-droite) ── */
.fab-stack { position: fixed; bottom: 1.75rem; right: 1.75rem; display: flex; flex-direction: column-reverse; align-items: center; gap: 0.6rem; z-index: 200; }
.fab-btn { width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer; box-shadow: 0 4px 20px rgba(0,0,0,0.18); display: flex; align-items: center; justify-content: center; transition: transform 0.2s, background 0.2s; }
.fab-btn:hover { transform: scale(1.1); }

/* ── NOTIF BELL (FAB) ── */
.notif-wrapper { position: relative; }
.notif-bell { background: var(--bg-card); color: var(--text-mid); border: 1px solid var(--border); }
.notif-bell:hover { background: var(--green-pale); color: var(--green); }
.notif-badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 4px; background: var(--terra); color: #fff; font-size: 0.62rem; font-weight: 700; border-radius: 999px; display: flex; align-items: center; justify-content: center; line-height: 1; pointer-events: none; }
.notif-badge.hidden { display: none; }
.notif-dropdown { display: none; position: absolute; bottom: calc(100% + 10px); right: 0; width: 340px; max-height: 420px; overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(42,32,22,0.14); z-index: 300; }
.notif-dropdown.open { display: block; }
.notif-header { padding: 0.75rem 1rem; font-family: 'Playfair Display', serif; font-size: 0.92rem; font-weight: 600; border-bottom: 1px solid var(--border); color: var(--text); }
.notif-empty { padding: 1.5rem 1rem; text-align: center; color: var(--text-light); font-size: 0.84rem; font-style: italic; }
.notif-item { display: flex; gap: 0.6rem; padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; text-decoration: none; color: inherit; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--green-pale); }
.notif-item.unread { background: rgba(74,115,84,0.05); }
.notif-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.1rem; }
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 0.82rem; color: var(--text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-meta { font-size: 0.7rem; color: var(--text-light); margin-top: 0.15rem; }

/* ── BUG REPORT ── */
.fab-bug { background: var(--bg-card); color: var(--text-light); border: 1px solid var(--border); }
.fab-bug:hover { background: var(--terra-pale); color: var(--terra); }
.modal-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(42,32,22,0.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.hidden { display: none; }
.modal-overlay .modal-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-light); transition: color 0.2s; }
.modal-overlay .modal-close:hover { color: var(--text); }
.propose-modal-content { background: var(--bg-card); border-radius: var(--radius); padding: 2rem; max-width: 500px; width: 100%; position: relative; box-shadow: 0 8px 40px rgba(42,32,22,0.2); max-height: 90vh; overflow-y: auto; }
.propose-modal-content h2 { font-size: 1.3rem; margin-bottom: 0.25rem; }
.bug-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(42,32,22,0.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.bug-modal.hidden { display: none; }
.bug-modal-content { background: var(--bg-card); border-radius: var(--radius); padding: 2rem; max-width: 440px; width: 100%; position: relative; box-shadow: 0 8px 40px rgba(42,32,22,0.2); }
.bug-modal-content h2 { font-size: 1.3rem; margin-bottom: 0.25rem; }
.bug-modal-sub { font-size: 0.85rem; color: var(--text-mid); margin-bottom: 1.25rem; }
.bug-modal-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-light); transition: color 0.2s; }
.bug-modal-close:hover { color: var(--text); }

/* ── LOGIN MODAL ── */
.login-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(42,32,22,0.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-modal.hidden { display: none; }
.login-modal-content { background: var(--bg-card); border-radius: var(--radius); padding: 2rem; max-width: 400px; width: 100%; position: relative; box-shadow: 0 8px 40px rgba(42,32,22,0.2); }
.login-modal-content h2 { font-size: 1.4rem; margin-bottom: 0.25rem; }
.login-modal-sub { font-size: 0.85rem; color: var(--text-mid); margin-bottom: 1.5rem; }
.login-modal-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-light); transition: color 0.2s; }
.login-modal-close:hover { color: var(--text); }
.btn-provider { display: flex; align-items: center; justify-content: center; gap: 0.6rem; width: 100%; padding: 0.7rem 1rem; border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all 0.2s; margin-bottom: 0.6rem; }
.btn-google { background: #fff; color: #333; border: 1px solid var(--border); }
.btn-google:hover { background: #f5f5f5; border-color: #bbb; }
.btn-yahoo { background: #720e9e; color: #fff; border: 1px solid #720e9e; }
.btn-yahoo:hover { background: #5a0b7d; }
.login-divider { display: flex; align-items: center; gap: 0.75rem; margin: 1.25rem 0; color: var(--text-light); font-size: 0.8rem; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-tabs { display: flex; gap: 0; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.login-tab { flex: 1; padding: 0.5rem; background: none; border: none; font-family: 'DM Sans', sans-serif; font-size: 0.82rem; font-weight: 500; color: var(--text-mid); cursor: pointer; transition: all 0.2s; }
.login-tab.active { background: var(--green); color: #fff; }
#login-email-form input { display: block; width: 100%; padding: 0.65rem 0.9rem; border: 1px solid var(--border); border-radius: 8px; font-family: 'DM Sans', sans-serif; font-size: 0.88rem; margin-bottom: 0.6rem; background: var(--bg); }
#login-email-form input:focus { outline: none; border-color: var(--green); }
.btn-submit-login { width: 100%; padding: 0.7rem; background: var(--green); color: #fff; border: none; border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: background 0.2s; margin-top: 0.3rem; }
.btn-submit-login:hover { background: #3a5e43; }
.login-error { background: var(--terra-pale); color: var(--terra); padding: 0.6rem 0.9rem; border-radius: 8px; font-size: 0.84rem; margin-bottom: 0.8rem; line-height: 1.5; }
.login-error.hidden { display: none; }
.link-resend { background: none; border: none; color: var(--green); font-family: 'DM Sans', sans-serif; font-size: 0.84rem; font-weight: 600; cursor: pointer; text-decoration: underline; padding: 0; }

/* ── PROFILE MODAL ── */
.profile-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(42,32,22,0.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.profile-modal.hidden { display: none; }
.profile-modal-content { background: var(--bg-card); border-radius: var(--radius); padding: 2rem; max-width: 400px; width: 100%; position: relative; box-shadow: 0 8px 40px rgba(42,32,22,0.2); }
.profile-modal-content h2 { font-size: 1.4rem; margin-bottom: 0.25rem; }
.profile-avatar-section { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1.5rem; }
.profile-avatar-preview { width: 72px; height: 72px; border-radius: 50%; background: var(--bg-section); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; font-size: 1.8rem; color: var(--text-light); }
.profile-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-actions { display: flex; flex-direction: column; gap: 0.4rem; }
.btn-upload-avatar { padding: 0.45rem 1rem; background: var(--green); color: #fff; border: none; border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.82rem; font-weight: 500; cursor: pointer; transition: background 0.2s; text-align: center; }
.btn-upload-avatar:hover { background: #3a5e43; }
.btn-remove-avatar { padding: 0.3rem 0.8rem; background: none; color: var(--terra); border: 1px solid var(--terra); border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.78rem; cursor: pointer; transition: all 0.2s; }
.btn-remove-avatar:hover { background: var(--terra-pale); }
.btn-remove-avatar.hidden { display: none; }
.profile-label { font-size: 0.85rem; font-weight: 500; color: var(--text-mid); margin-bottom: 0.35rem; display: block; }
.profile-input { display: block; width: 100%; padding: 0.65rem 0.9rem; border: 1px solid var(--border); border-radius: 8px; font-family: 'DM Sans', sans-serif; font-size: 0.9rem; background: var(--bg); margin-bottom: 1.2rem; box-sizing: border-box; }
.profile-input:focus { outline: none; border-color: var(--green); }
.profile-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }
.btn-cancel-profile { padding: 0.55rem 1.2rem; background: none; color: var(--text-mid); border: 1px solid var(--border); border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.88rem; cursor: pointer; transition: all 0.2s; }
.btn-cancel-profile:hover { border-color: var(--text); color: var(--text); }
.btn-save-profile { padding: 0.55rem 1.2rem; background: var(--green); color: #fff; border: none; border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.88rem; font-weight: 500; cursor: pointer; transition: background 0.2s; }
.btn-save-profile:hover { background: #3a5e43; }

/* ── FORMS ── */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: 0.78rem; font-weight: 500; color: var(--text-mid); letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 0.35rem; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 0.65rem 0.9rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 0.92rem; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(74,115,84,0.1); }
.form-group textarea { resize: vertical; min-height: 80px; }
.btn-submit { width: 100%; padding: 0.8rem; background: var(--green); color: #fff; border: none; border-radius: 8px; font-family: 'DM Sans', sans-serif; font-size: 0.92rem; font-weight: 500; cursor: pointer; margin-top: 0.4rem; transition: background 0.2s, transform 0.15s; }
.btn-submit:hover { background: #3a5e43; transform: translateY(-1px); }

/* ── BOOK SEARCH ── */
.book-search-wrapper { position: relative; }
.book-search-dropdown { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 30px rgba(42,32,22,0.12); z-index: 50; max-height: 280px; overflow-y: auto; display: none; }
.book-search-dropdown.open { display: block; }
.search-result-item { display: flex; gap: 0.7rem; align-items: center; padding: 0.7rem 0.9rem; cursor: pointer; transition: background 0.15s; border-bottom: 1px solid var(--border); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--green-pale); }
.search-result-item img { width: 34px; height: 48px; object-fit: cover; border-radius: 3px; flex-shrink: 0; }
.search-result-item .no-cover { width: 34px; height: 48px; background: var(--border); border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.result-title { font-size: 0.86rem; font-weight: 500; margin-bottom: 0.1rem; }
.result-author { font-size: 0.76rem; color: var(--text-mid); }
.search-loading { padding: 0.9rem; text-align: center; color: var(--text-light); font-size: 0.84rem; font-style: italic; }
.search-alt-link { padding: 0.6rem 0.9rem; text-align: center; font-size: 0.82rem; color: var(--green); cursor: pointer; border-top: 1px solid var(--border); transition: background 0.15s; }
.search-alt-link:hover { background: var(--green-pale); }

/* ── TOAST ── */
.toast { position: fixed; bottom: 4.5rem; left: 50%; transform: translateX(-50%) translateY(12px); background: var(--text); color: #fff; padding: 0.65rem 1.4rem; border-radius: 999px; font-size: 0.85rem; opacity: 0; transition: all 0.28s; z-index: 2000; pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── ADMIN FAB ── */
.admin-fab { background: var(--text); color: #fff; font-size: 1.2rem; width: 50px; height: 50px; }
.admin-fab:hover { background: var(--green); transform: scale(1.1) rotate(20deg); }

/* ── ADMIN OVERLAY + PANEL ── */
.admin-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 300; display: flex; justify-content: flex-end; }
.admin-panel { width: 460px; max-width: 100vw; height: 100%; background: var(--bg-card); overflow-y: auto; display: flex; flex-direction: column; animation: slideIn 0.22s ease; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.admin-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--bg-card); z-index: 1; }
.admin-header h2 { font-size: 1.1rem; font-family: 'DM Sans', sans-serif; font-weight: 600; }
.admin-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-mid); padding: 0.2rem; }
.admin-tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.admin-tab-btn { padding: 0.6rem 0.65rem; background: none; border: none; font-family: 'DM Sans', sans-serif; font-size: 0.78rem; font-weight: 500; color: var(--text-mid); cursor: pointer; border-bottom: 2px solid transparent; transition: color 0.2s, border-color 0.2s; white-space: nowrap; }
.admin-tab-btn.active { color: var(--green); border-bottom-color: var(--green); }
.admin-tab-content { padding: 1.1rem; flex: 1; }
.admin-sep { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.admin-sublabel { font-size: 0.75rem; font-weight: 500; color: var(--text-mid); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.65rem; }

/* ── FOOTER ── */
footer { background: var(--bg-dark); color: rgba(255,255,255,0.45); padding: 2rem 2rem; font-size: 0.83rem; }
.footer-inner { max-width: 960px; margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; }
.footer-brand { font-family: 'Playfair Display', serif; font-size: 0.95rem; color: rgba(255,255,255,0.8); }
footer a { color: rgba(255,255,255,0.65); text-decoration: none; }
footer a:hover { color: #fff; }

/* ── ANIMATIONS ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp 0.55s ease both; }
.d1 { animation-delay: 0.1s; } .d2 { animation-delay: 0.22s; } .d3 { animation-delay: 0.34s; } .d4 { animation-delay: 0.46s; }

/* ── SCROLL REVEAL ── */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ── RESPONSIVE ── */
@media (max-width: 680px) {
  .fab-stack { bottom: 1rem; right: 1rem; }
  .fab-btn { width: 42px; height: 42px; }
  .notif-dropdown { right: 0; width: calc(100vw - 2rem); max-width: 340px; }
  .hamburger { display: block; }
  .nav-links {
    display: none; position: absolute; top: 60px; left: 0; right: 0;
    background: rgba(246,241,233,0.97); backdrop-filter: blur(10px);
    flex-direction: column; padding: 1rem 2rem; gap: 0.5rem;
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-links a { font-size: 1rem; padding: 0.5rem 0; }
  .user-info, .btn-logout, .btn-edit-pseudo { display: none !important; }
  .avatar-btn { display: block; }
}
