/**
 * Styles pour la page Feed (Fil d'actualités)
 * BookConnect - Fil d'actualités et publications
 */

/* ============================================
   RÉACTIONS ET INTERACTIONS
   ============================================ */

/* Styles pour les réactions actives */
.reaction-active {
    font-weight: 600;
    box-shadow: 0 0 0 2px currentColor;
}

/* Styles pour les boutons like/dislike des commentaires */
.comment-actions {
    margin-top: 8px;
}

.comment-like-btn,
.comment-dislike-btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 15px;
    transition: all 0.2s ease;
}

.comment-like-btn:hover {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
    transform: translateY(-1px);
}

.comment-dislike-btn:hover {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    transform: translateY(-1px);
}

.comment-like-btn:active,
.comment-dislike-btn:active {
    transform: scale(0.95);
}

/* ============================================
   INDICATEURS DE CHARGEMENT
   ============================================ */

/* Indicateur de chargement */
.upload-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,123,255,0.1);
    border: 2px dashed #007bff;
    border-radius: 8px;
    padding: 20px;
    color: #007bff;
    font-size: 14px;
    min-height: 100px;
    margin: 10px 0;
}

.spinner-border {
    width: 1rem;
    height: 1rem;
    margin-right: 8px;
}

/* ============================================
   ÉDITEUR AVANCÉ
   ============================================ */

/* Éditeur personnalisé */
.advanced-editor {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

.editor-toolbar {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.toolbar-group {
    display: flex;
    gap: 5px;
}

.editor-content {
    min-height: 200px;
    padding: 15px;
    outline: none;
}

.editor-content:focus {
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.editor-content img {
    max-width: 100%;
    height: auto;
    margin: 10px 0;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ============================================
   LIENS ET HASHTAGS
   ============================================ */

/* Styles pour les liens et hashtags dans l'éditeur */
.editor-content a {
    color: #0d6efd;
    text-decoration: underline;
    cursor: pointer;
}

.editor-content a:hover {
    color: #0a58ca;
    text-decoration: underline;
}

.editor-content .hashtag {
    color: #0d6efd;
    font-weight: 600;
    cursor: pointer;
}

.editor-content .hashtag:hover {
    color: #0a58ca;
    text-decoration: underline;
}

/* Styles pour les liens et hashtags dans les publications affichées */
.publication-body a {
    color: #0d6efd;
    text-decoration: underline;
}

.publication-body a:hover {
    color: #0a58ca;
}

.publication-body .hashtag {
    color: #0d6efd;
    font-weight: 600;
    cursor: pointer;
}

.publication-body .hashtag:hover {
    color: #0a58ca;
    text-decoration: underline;
}

/* ============================================
   CONTRÔLES DES IMAGES DANS L'ÉDITEUR
   ============================================ */

/* Contrôles des images dans l'éditeur */
.editor-image-container {
    position: relative;
    margin: 15px 0;
    display: block;
    max-width: 100%;
}

.editor-image {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    display: block;
}

.editor-image:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.image-controls {
    position: static;
    background: rgba(0,0,0,0.05);
    border-radius: 6px;
    padding: 8px;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease;
    display: flex;
    gap: 8px;
    flex-direction: column;
    margin-top: 10px;
    margin-bottom: 15px; /* Espacement fixe sous chaque contrôle */
    border: 1px solid #e0e0e0;
}

.size-controls, .align-controls {
    display: flex;
    gap: 4px;
}

.image-controls .btn {
    padding: 6px 12px;
    font-size: 12px;
    background: rgba(255,255,255,0.9);
    border: 1px solid #ddd;
    color: #333;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.image-controls .btn:hover {
    background: white;
    border-color: #007bff;
    color: #007bff;
    transform: none;
}

.image-controls .btn-outline-danger {
    background: rgba(220, 53, 69, 0.9);
    color: white;
}

.image-controls .btn-outline-danger:hover {
    background: #dc3545;
}

/* Alignements des images (sans floats pour éviter les problèmes de structure) */
.editor-image-container.align-left {
    text-align: left;
}

.editor-image-container.align-right {
    text-align: right;
}

.editor-image-container.align-center {
    text-align: center;
}

/* L'image elle-même reste block pour éviter les problèmes */
.editor-image-container .editor-image {
    display: inline-block;
    max-width: 100%;
    height: auto;
}

/* ============================================
   BOUTON CRÉER UNE PUBLICATION
   ============================================ */

/* Bouton principal pour créer une publication */
#toggleEditorBtn {
    font-size: 1.1rem;
    padding: 12px 30px;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
    font-weight: 600;
    letter-spacing: 0.5px;
}

#toggleEditorBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

#toggleEditorBtn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

#toggleEditorBtn i {
    margin-right: 8px;
    font-size: 1.2rem;
}

/* ============================================
   SECTION D'ÉDITION
   ============================================ */

/* Section d'édition */
.editor-section {
    border: 2px solid #007bff;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.editor-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #007bff 0%, #0056b3 100%);
}

.editor-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border-bottom: 2px solid #0056b3;
    color: white;
}

.editor-header h5 {
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ============================================
   STRUCTURE DES PUBLICATIONS
   ============================================ */

/* Structure des publications */
.publication-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.publication-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.publication-header {
    background: #f8f9fa;
    border-bottom: none;
    padding: 15px 20px;
}

/* Vignette photo utilisateur dans l'en-tête de publication */
.publication-header img.rounded-circle {
    width: 96px !important;
    height: 96px !important;
    min-width: 96px;
    min-height: 96px;
    max-width: 96px;
    max-height: 96px;
    object-fit: cover;
    border: 2px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.publication-header img.rounded-circle:hover {
    border-color: #007bff;
    box-shadow: 0 3px 8px rgba(0,123,255,0.3);
    transform: scale(1.05);
}

.publication-content {
    line-height: 1.6;
    margin-bottom: 15px;
}

.publication-content p {
    margin-bottom: 12px;
}

.publication-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 10px 0;
}

/* Troncature du contenu à 6 lignes */
.publication-content-preview {
    position: relative;
    max-height: calc(1.6em * 4); /* 4 lignes avec line-height de 1.6 */
    overflow: hidden;
    line-height: 1.6;
    margin-bottom: 0;
}

.publication-content-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4em;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.7) 50%, rgba(255,255,255,1) 100%);
    pointer-events: none;
    z-index: 1;
}

.publication-content-full {
    line-height: 1.6;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bouton Lire la suite */
.publication-content-wrapper .btn {
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.publication-content-wrapper .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.publication-content-wrapper .btn i {
    margin-right: 6px;
    transition: transform 0.3s ease;
}

.publication-content-wrapper .btn:hover i {
    transform: scale(1.2);
}

.publication-image {
    text-align: center;
}

.publication-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.publication-separator {
    margin: 0;
    border-color: #dee2e6;
    opacity: 0.6;
}

.publication-footer {
    background: #fff;
    border-top: none;
    padding: 15px 20px;
}

.reaction-buttons .btn {
    margin-right: 8px;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.875rem;
}

.reaction-buttons .btn:last-child {
    margin-right: 0;
}

.comment-count {
    font-size: 0.9rem;
    white-space: nowrap;
}

/* ============================================
   SÉPARATEUR ÉDITEUR / PUBLICATIONS
   ============================================ */

/* Séparateur entre l'éditeur et les publications */
.editor-publications-separator {
    margin: 40px 0 30px 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.separator-line {
    flex: 1;
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #007bff 20%, #007bff 80%, transparent 100%);
    margin: 0 20px;
}

.separator-content {
    background: white;
    padding: 0 20px;
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.separator-content i {
    color: #007bff;
    font-size: 1rem;
}

.separator-content span {
    white-space: nowrap;
}

/* Section des publications */
.publications-section {
    margin-top: 20px;
}

/* ============================================
   COMMENTAIRES
   ============================================ */

/* Commentaires */
.comments-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

/* Vignette photo utilisateur dans les commentaires */
.comment-item img.rounded-circle,
.comments-list img.rounded-circle,
.comments-section img.rounded-circle {
    width: 64px !important;
    height: 64px !important;
    min-width: 64px;
    min-height: 64px;
    max-width: 64px;
    max-height: 64px;
    object-fit: cover;
    border: 2px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.comment-item img.rounded-circle:hover,
.comments-list img.rounded-circle:hover,
.comments-section img.rounded-circle:hover {
    border-color: #007bff;
    box-shadow: 0 3px 8px rgba(0,123,255,0.3);
    transform: scale(1.05);
}

.comments-header {
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 10px;
}

.comments-form .input-group {
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.comments-form .form-control {
    border: none;
    padding: 12px 20px;
    font-size: 0.9rem;
}

.comments-form .form-control:focus {
    box-shadow: none;
    outline: none;
}

.comments-form .btn {
    border-radius: 0 25px 25px 0;
    padding: 12px 20px;
    border: none;
}

.comment-item {
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.comment-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comment-header strong {
    color: #495057;
    font-size: 0.9rem;
}

.comment-header small {
    font-size: 0.8rem;
}

.comment-content {
    color: #212529;
    line-height: 1.4;
    font-size: 0.9rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Responsive pour les commentaires */
@media (max-width: 768px) {
    .comments-section {
        padding: 12px;
    }

    .comment-item {
        padding: 10px;
    }

    .comments-form .input-group {
        flex-direction: column;
    }

    .comments-form .btn {
        border-radius: 0 0 25px 25px;
        margin-top: 8px;
    }
}
