/* ============================================
   STUDY TOOLS - Styles complets
   Signets, Notes, Recherche, Suivi de lecture
   ============================================ */

/* --- Bouton d'ouverture du panneau --- */
.study-tools-btn {
    padding: 4px 10px;
    border: 1px solid #ddd;
    background-color: #2ecc71;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    gap: 4px;
    white-space: nowrap;
    user-select: none;
}
.study-tools-btn:hover { background-color: #27ae60; }

/* --- Overlay sombre --- */
.study-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 899;
    transition: opacity 0.3s;
}
.study-overlay.active { display: block; }

/* --- Panneau latéral --- */
.study-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 900;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
}
.study-panel.open { right: 0; }

.study-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}
.study-panel-header h2 {
    margin: 0;
    font-size: 16px;
    color: #333;
}
.study-panel-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #666;
    padding: 0 4px;
    line-height: 1;
}
.study-panel-close:hover { color: #333; }

/* --- Onglets --- */
.study-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    flex-shrink: 0;
    background: #fafafa;
}
.study-tab {
    flex: 1;
    padding: 10px 4px;
    text-align: center;
    cursor: pointer;
    font-size: 12px;
    color: #888;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.study-tab:hover { color: #555; background: #f0f0f0; }
.study-tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
    font-weight: bold;
}
.study-tab-icon { font-size: 18px; }
.study-tab-label { font-size: 10px; }

/* --- Contenu des onglets --- */
.study-tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}
.study-tab-pane { display: none; }
.study-tab-pane.active { display: block; }

/* --- SIGNETS --- */
.bookmark-empty, .notes-empty {
    text-align: center;
    color: #aaa;
    padding: 40px 20px;
    font-size: 14px;
}
.bookmark-empty-icon, .notes-empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.bookmark-item {
    display: flex;
    align-items: flex-start;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.15s;
    gap: 10px;
}
.bookmark-item:hover { background: #f5f8ff; }

.bookmark-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}
.bookmark-info { flex: 1; min-width: 0; }
.bookmark-ref {
    font-weight: bold;
    font-size: 13px;
    color: #2c3e50;
}
.bookmark-label {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bookmark-version {
    font-size: 10px;
    color: #aaa;
    margin-top: 2px;
}
.bookmark-delete {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    flex-shrink: 0;
}
.bookmark-delete:hover { color: #e74c3c; }

/* --- NOTES --- */
.note-item {
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.note-item:hover { background: #fffef5; }

.note-ref {
    font-weight: bold;
    font-size: 13px;
    color: #2c3e50;
    margin-bottom: 4px;
}
.note-preview {
    font-size: 12px;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.note-date {
    font-size: 10px;
    color: #aaa;
    margin-top: 4px;
}

/* Modal de note */
.note-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 950;
    align-items: center;
    justify-content: center;
}
.note-modal-overlay.active { display: flex; }

.note-modal {
    background: white;
    border-radius: 10px;
    padding: 20px;
    width: 90%;
    max-width: 450px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.note-modal h3 {
    margin: 0 0 12px 0;
    font-size: 15px;
    color: #333;
}
.note-modal textarea {
    width: 100%;
    min-height: 150px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
    line-height: 1.5;
}
.note-modal textarea:focus {
    outline: none;
    border-color: #3498db;
}
.note-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}
.note-modal-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.note-btn-cancel { background: #f0f0f0; color: #666; }
.note-btn-delete { background: #e74c3c; color: white; }
.note-btn-save { background: #2ecc71; color: white; }
.note-btn-cancel:hover { background: #e0e0e0; }
.note-btn-delete:hover { background: #c0392b; }
.note-btn-save:hover { background: #27ae60; }

/* --- RECHERCHE --- */
.search-tools-input {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}
.search-tools-input input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
.search-tools-input input:focus {
    outline: none;
    border-color: #3498db;
}
.search-tools-input button {
    padding: 8px 14px;
    border: none;
    background: #3498db;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}
.search-tools-input button:hover { background: #2980b9; }
.search-tools-input button:disabled {
    background: #bbb;
    cursor: not-allowed;
}

.search-status {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
    min-height: 16px;
}
.search-progress-bar {
    height: 3px;
    background: #eee;
    border-radius: 2px;
    margin-bottom: 10px;
    overflow: hidden;
}
.search-progress-fill {
    height: 100%;
    background: #3498db;
    width: 0%;
    transition: width 0.3s;
    border-radius: 2px;
}

.search-result-item {
    padding: 8px 10px;
    border-left: 3px solid #3498db;
    background: #f8f9fa;
    border-radius: 0 6px 6px 0;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.search-result-item:hover { background: #eef3ff; }
.search-result-ref {
    font-weight: bold;
    font-size: 12px;
    color: #2c3e50;
}
.search-result-text {
    font-size: 12px;
    color: #555;
    margin-top: 3px;
    line-height: 1.4;
}
.search-result-text mark {
    background: rgba(255, 255, 0, 0.5);
    padding: 0 1px;
    border-radius: 2px;
}

/* --- SUIVI DE LECTURE --- */
.reading-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}
.reading-stat-card {
    flex: 1;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}
.reading-stat-number {
    font-size: 22px;
    font-weight: bold;
    color: #2ecc71;
}
.reading-stat-label {
    font-size: 10px;
    color: #888;
    margin-top: 2px;
}

.reading-progress-bar-container {
    background: #eee;
    border-radius: 10px;
    height: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}
.reading-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #27ae60);
    border-radius: 10px;
    transition: width 0.5s;
}

.reading-book-section {
    margin-bottom: 12px;
}
.reading-book-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    cursor: pointer;
    user-select: none;
}
.reading-book-name {
    font-weight: bold;
    font-size: 13px;
    color: #333;
}
.reading-book-count {
    font-size: 11px;
    color: #888;
}
.reading-chapters-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 0;
}
.reading-chapter-cell {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    background: #f0f0f0;
    color: #666;
    transition: all 0.15s;
    user-select: none;
}
.reading-chapter-cell:hover { background: #e0e0e0; }
.reading-chapter-cell.read {
    background: #2ecc71;
    color: white;
    font-weight: bold;
}

/* Section séparateur AT/NT */
.reading-testament-header {
    font-size: 12px;
    font-weight: bold;
    color: #3498db;
    padding: 8px 0 4px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 8px;
    margin-top: 8px;
}

/* --- Indicateurs sur les versets --- */
.verse-indicators {
    display: inline-flex;
    gap: 2px;
    margin-left: 4px;
    vertical-align: middle;
}
.verse-indicator-bookmark,
.verse-indicator-note {
    font-size: 12px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.verse-indicator-bookmark:hover,
.verse-indicator-note:hover { opacity: 1; }

/* --- Extension de la palette pour signets/notes --- */
.palette-study-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
    padding-left: 8px;
    border-left: 1px solid #ccc;
}
.palette-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: #f8f8f8;
    transition: all 0.15s;
    flex-shrink: 0;
}
.palette-action-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}
.palette-action-btn.bookmarked {
    background: #fff3cd;
    border-color: #ffc107;
}

/* --- Responsive mobile --- */
@media (max-width: 768px) {
    .study-panel {
        width: 100%;
        max-width: 100vw;
        right: -100%;
    }
    .study-tools-btn span.btn-text { display: none; }
    .study-tools-btn { padding: 4px 8px; }
    .palette-action-btn { width: 28px; height: 28px; font-size: 13px; }
}

@media (min-width: 769px) {
    .study-tab-label { font-size: 11px; }
    .study-tab { padding: 10px 8px; }
    .palette-action-btn { width: 28px; height: 28px; }
}

/* Scrollbar subtle pour le panneau */
.study-tab-content::-webkit-scrollbar { width: 4px; }
.study-tab-content::-webkit-scrollbar-track { background: transparent; }
.study-tab-content::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }
.study-tab-content::-webkit-scrollbar-thumb:hover { background: #bbb; }

/* Filter / Sort bar pour bookmarks/notes */
.study-filter-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}
.study-filter-bar select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background: white;
}

/* --- Indicateur de commentaire sur les versets --- */
.verse-comment-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background-color: #2ecc71; /* Vert assorti à votre bouton study-tools-btn */
    color: white;
    border-radius: 50%;
    font-size: 11px;
    margin-left: 6px;
    cursor: pointer;
    vertical-align: super;
    transition: transform 0.2s, background-color 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.verse-comment-icon:hover {
    background-color: #27ae60;
    transform: scale(1.1);
}

/* --- Panneau de commentaires (Configuration Verticale par défaut) --- */
.comment-panel {
    position: fixed;
    top: 0;
    right: -400px; /* Masqué hors de l'écran par défaut */
    width: 350px;
    max-width: 90vw;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: right 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
}
.comment-panel.active {
    right: 0;
}

/* * NOTE TECHNIQUE : Pour utiliser un panneau HORIZONTAL (en bas de l'écran), 
 * supprimez le bloc .comment-panel ci-dessus et utilisez celui-ci :
 *
 * .comment-panel {
 * position: fixed; bottom: -300px; left: 0; width: 100%; height: 250px;
 * background: #fff; box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
 * z-index: 1000; transition: bottom 0.3s ease-in-out;
 * display: flex; flex-direction: column;
 * }
 * .comment-panel.active { bottom: 0; }
 */

/* --- Éléments internes du panneau --- */
.comment-panel-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.comment-panel-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
    font-weight: bold;
}
#close-comment-panel {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}
.comment-panel-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    font-size: 15px;
    line-height: 1.6;
    color: #444;
}