/* ══════════════════════════════════════════════════════
   BIBLIOTHEQUE.CSS — Page Ma Bibliothèque
   ══════════════════════════════════════════════════════ */

/* ── HERO ── */
.hero { padding: 5rem 2rem 3rem; text-align: center; background: var(--bg); }
.hero-inner { max-width: 640px; margin: 0 auto; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 0.5rem; color: var(--text); }
.hero-desc { font-size: 1rem; color: var(--text-mid); }
/* Hero quand on regarde la biblio d'un autre */
.hero.viewing-other { background: var(--green-pale); }
.hero.viewing-other h1 { color: var(--green); }
.btn-back-my-lib { display: inline-block; margin-top: 1rem; padding: 0.45rem 1.2rem; background: var(--green); color: #fff; border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.85rem; font-weight: 500; text-decoration: none; transition: background 0.2s; }
.btn-back-my-lib:hover { background: #3a5e43; }

/* ── AUTH GATE ── */
.auth-gate-inner { text-align: center; padding: 4rem 1rem; }
.auth-gate-text { font-size: 1.05rem; color: var(--text-mid); margin-bottom: 1.2rem; line-height: 1.6; }
.btn-login-gate { padding: 0.7rem 2rem; background: var(--green); color: #fff; border: none; border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.95rem; font-weight: 500; cursor: pointer; transition: background 0.2s; }
.btn-login-gate:hover { background: #3a5e43; }

/* ── SECTIONS ── */
section { padding: 3rem 2rem; }
.section-inner { max-width: 960px; margin: 0 auto; }
.section-subtitle { font-size: 0.92rem; color: var(--text-mid); margin-bottom: 1.5rem; }

/* ── TOOLBAR ── */
.bib-toolbar { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 0.5rem; flex-wrap: wrap; gap: 0.5rem; }
.bib-toolbar-left { display: flex; flex-direction: column; gap: 0.15rem; }
.bib-stats { font-size: 0.82rem; color: var(--text-light); }
.btn-add-book { padding: 0.5rem 1.2rem; background: var(--green); color: #fff; border: none; border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: background 0.2s, transform 0.15s; }
.btn-add-book:hover { background: #3a5e43; transform: translateY(-1px); }

/* ── CHAMP DE RECHERCHE ── */
.bib-search-bar { margin: 1rem 0; }
.bib-search-input { width: 100%; max-width: 400px; padding: 0.55rem 1rem; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-card); font-family: 'DM Sans', sans-serif; font-size: 0.88rem; color: var(--text); outline: none; transition: border-color 0.2s; }
.bib-search-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(74,115,84,0.1); }

/* ── FILTRES ── */
.bib-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; }
.bib-filter-group { display: flex; flex-direction: column; gap: 0.2rem; }
.bib-filter-label { font-size: 0.7rem; font-weight: 500; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; }
.bib-filter-select { padding: 0.4rem 0.8rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 0.82rem; cursor: pointer; }
.bib-filter-select:focus { outline: none; border-color: var(--green); }

/* ── TAGS DROPDOWN MULTI-SELECT ── */
.bib-tags-dropdown { position: relative; }
.bib-tags-dropdown-btn { padding: 0.4rem 0.8rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 0.82rem; cursor: pointer; min-width: 140px; text-align: left; }
.bib-tags-dropdown-btn:hover { border-color: var(--green); }
.bib-tags-dropdown-menu { position: absolute; top: calc(100% + 4px); left: 0; min-width: 200px; max-height: 240px; overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 50; padding: 0.4rem 0; }
.bib-tags-dropdown-menu label { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.8rem; font-size: 0.82rem; color: var(--text); cursor: pointer; transition: background 0.15s; }
.bib-tags-dropdown-menu label:hover { background: var(--green-pale); }
.bib-tags-dropdown-menu input[type="checkbox"] { accent-color: var(--green); }
.bib-tags-active-count { display: inline-block; margin-left: 0.3rem; background: var(--green); color: #fff; border-radius: 999px; font-size: 0.65rem; font-weight: 700; padding: 0.1rem 0.4rem; }
.bib-tags-search-input { width: calc(100% - 1rem); margin: 0.3rem 0.5rem; padding: 0.3rem 0.6rem; border: 1px solid var(--border); border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.8rem; color: var(--text); background: var(--bg); outline: none; }
.bib-tags-search-input:focus { border-color: var(--green); }
.tags-mode-toggle { display: flex; gap: 2px; padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--border); }
.tags-mode-btn { flex: 1; padding: 0.2rem 0; border: 1px solid var(--border); background: var(--bg); color: var(--text-light); font-family: 'DM Sans', sans-serif; font-size: 0.72rem; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.tags-mode-btn:first-child { border-radius: 6px 0 0 6px; }
.tags-mode-btn:last-child { border-radius: 0 6px 6px 0; }
.tags-mode-btn.active { background: var(--green); color: #fff; border-color: var(--green); }

/* ── BOUTON RÉINITIALISER FILTRES ── */
.btn-reset-filters { padding: 0.35rem 0.9rem; 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; align-self: flex-end; white-space: nowrap; }
.btn-reset-filters:hover { background: var(--terra); color: #fff; }

/* ── BANDEAU LECTURE SEULE ── */
.readonly-banner { background: var(--green-pale); border-bottom: 1px solid var(--border); text-align: center; padding: 0.5rem 1rem; font-size: 0.82rem; color: var(--green); font-weight: 500; }

/* ── STATUT BADGE ── */
.bib-status-badge { display: inline-block; padding: 0.12rem 0.5rem; border-radius: 999px; font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.bib-status-badge.status-lu { background: var(--green-pale); color: var(--green); }
.bib-status-badge.status-en-cours { background: #FFF3E0; color: #E65100; }
.bib-status-badge.status-a-lire { background: #E3F2FD; color: #1565C0; }
.bib-status-badge.status-a-se-procurer { background: var(--terra-pale); color: var(--terra); }

/* ── GRILLE DE LIVRES ── */
.bib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }

/* ── CARTE LIVRE ── */
.bib-card { position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s; cursor: pointer; }
.bib-card:hover { transform: translateY(-2px); box-shadow: 0 4px 24px rgba(42,32,22,0.12); }
.bib-card-inner { display: flex; gap: 1rem; align-items: flex-start; }
.bib-card-cover { width: 60px; height: 85px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: var(--border); }
.bib-card-cover-ph { width: 60px; height: 85px; border-radius: 6px; background: var(--green-pale); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.bib-card-info { flex: 1; min-width: 0; }
.bib-card-title { font-family: 'Playfair Display', serif; font-size: 0.95rem; font-weight: 600; color: var(--text); margin-bottom: 0.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bib-card-author { font-size: 0.8rem; color: var(--text-mid); font-style: italic; margin-bottom: 0.2rem; }
.bib-card-isbn { font-size: 0.68rem; color: var(--text-light); font-family: monospace; margin-bottom: 0.2rem; }
.bib-card-rating { color: var(--terra); font-size: 0.82rem; letter-spacing: 1px; margin-bottom: 0.2rem; }
.bib-card-tags { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.2rem; }
.bib-card-tag { padding: 0.12rem 0.5rem; background: var(--green-pale); color: var(--green); border-radius: 999px; font-size: 0.7rem; font-weight: 500; }
.bib-card-footer { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.3rem; }
.bib-card-date { font-size: 0.7rem; color: var(--text-light); }
.bib-card-lock { position: absolute; top: 0.7rem; right: 0.7rem; font-size: 0.8rem; opacity: 0.5; }

/* ── ÉTAT VIDE ── */
.bib-empty { color: var(--text-light); font-style: italic; text-align: center; padding: 3rem 1rem; grid-column: 1 / -1; }

/* ── MODALE AJOUT / DÉTAIL ── */
.bib-modal-content { background: var(--bg-card); border-radius: var(--radius); padding: 2rem; max-width: 520px; width: 100%; position: relative; box-shadow: 0 8px 40px rgba(42,32,22,0.2); max-height: 90vh; overflow-y: auto; }
#add-book-modal .book-search-dropdown { position: fixed; z-index: 1100; max-height: 260px; }
.bib-modal-content h2 { font-size: 1.3rem; margin-bottom: 0.25rem; }
.bib-modal-sub { font-size: 0.85rem; color: var(--text-mid); margin-bottom: 1.2rem; }
.bib-modal-detail { max-width: 600px; }

/* ── LIVRE SÉLECTIONNÉ (modal ajout) ── */
.bib-selected-book { display: flex; gap: 1rem; padding: 1rem; background: var(--green-pale); border-radius: var(--radius); margin: 1rem 0; }
.bib-selected-book img { width: 50px; height: 72px; object-fit: cover; border-radius: 4px; }
.bib-selected-book .sel-info { flex: 1; }
.bib-selected-book .sel-title { font-family: 'Playfair Display', serif; font-weight: 600; font-size: 0.95rem; }
.bib-selected-book .sel-author { font-size: 0.82rem; color: var(--text-mid); font-style: italic; }
.bib-selected-book .sel-meta { font-size: 0.75rem; color: var(--text-light); margin-top: 0.2rem; }
.btn-change-book { background: none; border: none; color: var(--terra); font-size: 0.8rem; cursor: pointer; padding: 0; margin-top: 0.3rem; font-family: 'DM Sans', sans-serif; }
.btn-change-book:hover { text-decoration: underline; }

/* ── NOTE ÉTOILES ── */
.bib-rating-input { display: flex; gap: 0.15rem; }
.bib-rating-input .star { font-size: 1.4rem; cursor: pointer; color: var(--border); transition: color 0.15s; user-select: none; }
.bib-rating-input .star.active { color: var(--terra); }
.bib-rating-input .star:hover { color: var(--terra); }

/* ── TOGGLE CADENAS ── */
.bib-hidden-toggle { display: flex; align-items: center; gap: 0.5rem; margin: 1rem 0; font-size: 0.85rem; color: var(--text-mid); cursor: pointer; }
.bib-hidden-toggle input[type="checkbox"] { accent-color: var(--green); width: 16px; height: 16px; }

/* ── DÉTAIL LIVRE ── */
.bib-detail-header { display: flex; gap: 1.5rem; margin-bottom: 1.5rem; }
.bib-detail-cover { width: 120px; border-radius: 8px; box-shadow: var(--shadow); flex-shrink: 0; }
.bib-detail-right { flex: 1; min-width: 0; }
.bib-detail-title { font-family: 'Playfair Display', serif; font-size: 1.25rem; font-weight: 600; margin-bottom: 0.2rem; }
.bib-detail-author { font-size: 0.9rem; color: var(--text-mid); font-style: italic; margin-bottom: 0.5rem; }
.bib-detail-meta { font-size: 0.8rem; color: var(--text-light); line-height: 1.6; }
.bib-detail-meta span { display: block; }
.bib-detail-isbn { font-family: monospace; font-size: 0.75rem; color: var(--text-light); margin-top: 0.3rem; }
.bib-detail-desc { font-size: 0.88rem; color: var(--text); line-height: 1.7; margin-bottom: 1.5rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.bib-detail-section { margin-bottom: 1.2rem; }
.bib-detail-section-title { font-size: 0.78rem; font-weight: 500; color: var(--text-mid); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.4rem; }

/* ── TAGS ÉDITABLES ── */
.bib-tags-edit { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.bib-tag-editable { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.2rem 0.6rem; background: var(--green-pale); color: var(--green); border-radius: 999px; font-size: 0.78rem; font-weight: 500; }
.bib-tag-remove { background: none; border: none; color: var(--green); font-size: 0.85rem; cursor: pointer; padding: 0; line-height: 1; opacity: 0.6; }
.bib-tag-remove:hover { opacity: 1; }
.bib-tag-add-input { padding: 0.2rem 0.5rem; border: 1px dashed var(--border); border-radius: 999px; font-size: 0.78rem; font-family: 'DM Sans', sans-serif; color: var(--text); width: 100px; background: none; }
.bib-tag-add-input:focus { outline: none; border-color: var(--green); }

/* ── NOTES PERSONNELLES ── */
.bib-notes-display { font-size: 0.88rem; color: var(--text); line-height: 1.6; white-space: pre-wrap; }
.bib-notes-empty { font-size: 0.85rem; color: var(--text-light); font-style: italic; }
.bib-notes-display-wrap { position: relative; }
.btn-edit-notes { display: inline-block; margin-top: 0.4rem; padding: 0.25rem 0.7rem; background: none; border: 1px solid var(--border); border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.75rem; color: var(--text-mid); cursor: pointer; transition: all 0.2s; }
.btn-edit-notes:hover { border-color: var(--green); color: var(--green); }
.bib-notes-textarea { width: 100%; padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 0.88rem; resize: vertical; min-height: 80px; }
.bib-notes-textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(74,115,84,0.1); }
.bib-notes-edit-actions { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.btn-save-notes, .btn-cancel-notes { padding: 0.3rem 0.8rem; border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.78rem; cursor: pointer; border: none; transition: all 0.2s; }
.btn-save-notes { background: var(--green); color: #fff; }
.btn-save-notes:hover { background: #3a5e43; }
.btn-cancel-notes { background: var(--bg); color: var(--text-mid); border: 1px solid var(--border); }
.btn-cancel-notes:hover { border-color: var(--text-mid); }

/* ── RATING HINT ── */
.bib-rating-hint { font-size: 0.65rem; font-weight: 400; color: var(--text-light); text-transform: none; letter-spacing: 0; }

/* ── ACTIONS DÉTAIL ── */
.bib-detail-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.btn-recommend { padding: 0.5rem 1rem; background: none; color: var(--green); border: 1px solid var(--green); border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.82rem; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.btn-recommend:hover { background: var(--green); color: #fff; }
.btn-delete-book { padding: 0.5rem 1rem; background: none; color: var(--terra); border: 1px solid var(--terra); border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.82rem; cursor: pointer; transition: all 0.2s; margin-left: auto; }
.btn-delete-book:hover { background: var(--terra); color: #fff; }
/* ── AJOUT RAPIDE (inline) ── */
.quick-add-zone { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.btn-quick-add { padding: 0.5rem 1.2rem; background: var(--green); color: #fff; border: none; border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: all 0.2s; width: 100%; }
.btn-quick-add:hover:not(:disabled) { background: #3a5e43; }
.quick-add-form { margin-top: 0.8rem; padding: 1rem; background: var(--green-pale); border-radius: var(--radius); animation: quick-add-slide 0.2s ease; }
@keyframes quick-add-slide { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.quick-add-row { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.7rem; }
.quick-add-label { font-size: 0.78rem; font-weight: 500; color: var(--text-mid); text-transform: uppercase; letter-spacing: 0.04em; min-width: 50px; }
.quick-add-select { padding: 0.35rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 0.82rem; flex: 1; }
.btn-quick-add-confirm { width: 100%; padding: 0.5rem; background: var(--green); color: #fff; border: none; border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: background 0.2s; }
.btn-quick-add-confirm:hover:not(:disabled) { background: #3a5e43; }
.btn-quick-add-confirm:disabled { opacity: 0.7; cursor: default; }
.quick-add-already { text-align: center; font-size: 0.85rem; color: var(--text-light); padding: 0.6rem; font-style: italic; }
.quick-add-success { color: var(--green); font-style: normal; font-weight: 500; }

/* ── GLOBAL BOOK DETAIL (owners list) ── */
.global-owners-list { margin-top: 0.5rem; }
.global-owner-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0; }
.global-owner-item img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.global-owner-item .owner-ph { width: 28px; height: 28px; border-radius: 50%; background: var(--green-pale); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; color: var(--green); }
.global-owner-item a { font-size: 0.85rem; color: var(--green); text-decoration: none; font-weight: 500; }
.global-owner-item a:hover { text-decoration: underline; }
.global-owner-rating { font-size: 0.78rem; color: var(--terra); margin-left: auto; }

/* ── AVIS D'UN OWNER (panneau dépliable) ── */
.owner-entry { border-bottom: 1px solid var(--border); }
.owner-entry:last-child { border-bottom: none; }
.btn-show-owner-notes { background: none; border: none; color: var(--green); font-family: 'DM Sans', sans-serif; font-size: 0.75rem; cursor: pointer; padding: 0; margin-left: 0.5rem; white-space: nowrap; }
.btn-show-owner-notes:hover { text-decoration: underline; }
.owner-notes-panel { padding: 0.5rem 0.8rem 0.7rem 2.8rem; }
.owner-notes-content { font-size: 0.84rem; color: var(--text); line-height: 1.6; white-space: pre-wrap; background: var(--bg); border-radius: 8px; padding: 0.6rem 0.8rem; border-left: 3px solid var(--green-pale); }

/* ── TOOLBAR ROW (toggle vue) ── */
.bib-toolbar-row { display: flex; justify-content: flex-end; align-items: center; margin-bottom: 0.5rem; }

/* ── TOGGLE VUE ── */
.btn-view-toggle { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); color: var(--text-mid); cursor: pointer; transition: all 0.15s; }
.btn-view-toggle:hover { border-color: var(--green); color: var(--green); }

/* ── VUE LISTE ── */
.bib-grid-list { grid-template-columns: 1fr; gap: 0; }
.bib-card-list { border-radius: 0; border-bottom: 1px solid var(--border); border-left: none; border-right: none; border-top: none; box-shadow: none; padding: 0.65rem 0.8rem; }
.bib-card-list:first-child { border-top: 1px solid var(--border); }
.bib-card-list:hover { transform: none; box-shadow: none; background: var(--green-pale); }
.bib-card-list .bib-card-inner { align-items: center; }
.bib-card-list .bib-card-cover { width: 36px; height: 52px; border-radius: 4px; }
.bib-card-list .bib-card-cover-ph { width: 36px; height: 52px; font-size: 1rem; border-radius: 4px; }
.bib-card-list .bib-card-info { display: flex; align-items: baseline; gap: 0.5rem; flex: 1; min-width: 0; }
.bib-card-list .bib-card-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.88rem; margin-bottom: 0; }
.bib-card-list .bib-card-author { font-size: 0.78rem; white-space: nowrap; margin-bottom: 0; }
.bib-card-list .bib-card-lock { top: 0.4rem; right: 0.4rem; font-size: 0.65rem; }
.bib-card-list-meta { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; margin-left: auto; }
.bib-card-list-meta .bib-card-rating { font-size: 0.78rem; letter-spacing: 0; }

/* ── CHARGEMENT ── */
.bib-loading { color: var(--text-light); text-align: center; padding: 3rem 1rem; grid-column: 1 / -1; font-size: 0.95rem; }
.bib-loading::before { content: ''; display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--green); border-radius: 50%; margin-right: 0.5rem; vertical-align: middle; animation: bib-spin 0.8s linear infinite; }
@keyframes bib-spin { to { transform: rotate(360deg); } }

/* ── VOIR PLUS ── */
.load-more-zone { text-align: center; padding: 1.5rem 0; }
.btn-load-more { padding: 0.55rem 1.8rem; background: none; color: var(--green); border: 1px solid var(--green); border-radius: 999px; font-family: 'DM Sans', sans-serif; font-size: 0.88rem; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.btn-load-more:hover { background: var(--green); color: #fff; }

/* ── RESPONSIVE ── */
@media (max-width: 680px) {
  .hero { padding: 4rem 1.5rem 2rem; }
  section { padding: 2rem 1rem; }
  .bib-grid { grid-template-columns: 1fr; }
  .bib-toolbar { flex-direction: column; align-items: stretch; }
  .btn-add-book { align-self: flex-start; }
  .bib-filters { flex-direction: column; align-items: flex-start; }
  .bib-detail-header { flex-direction: column; align-items: center; text-align: center; }
  .bib-detail-cover { width: 100px; }
  .bib-modal-content { padding: 1.5rem; }
}
