/* =================================================================
   FEED.CSS - ARCHITECTURE ET POSTS DE LA PAGE PRINCIPALE (RELIO)
================================================================= */

/* --- 1. LAYOUT PRINCIPAL (La Grille à 3 Colonnes) --- */
.main-layout {
    display: grid;
    grid-template-columns: 250px 1fr 300px; 
    gap: 40px; 
    width: 100%;       
    max-width: 100%;   
    margin: 0;         
    padding: 20px 40px; 
    /* LA LIGNE MAGIQUE À RAJOUTER : */
    align-items: start; 
}

/* --- 3. COLONNE CENTRALE (Le Flux) --- */
.feed-center { display: flex; flex-direction: column; gap: 15px; max-width: 700px; width: 100%; margin: 0 auto; }
/* Boîte de création de post */
.create-post { background: var(--card-background); border-radius: 1rem; padding: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-bottom: 10px; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease; position: relative; z-index: 1; }
.create-post:hover { transform: scale(1.02); z-index: 10; box-shadow: 0 8px 20px rgba(0,0,0,0.15); }
.create-post .input-area { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 15px; }
.input-wrapper { background-color: #f0f2f5; border-radius: 25px; padding: 5px 15px; flex-grow: 1; display: flex; align-items: center; justify-content: space-between; border: 1px solid transparent; transition: border-color 0.3s, background-color 0.3s; min-height: 40px; }
.input-wrapper:focus-within { background-color: #ffffff; border-color: var(--primary-color); box-shadow: 0 0 0 4px rgba(209, 0, 0, 0.15), 0 10px 20px rgba(209, 0, 0, 0.05); transform: translateY(-2px); }
.create-post input[type="text"], textarea { background: transparent; border: none; padding: 0; margin: 0; width: 100%; font-size: 1em; color: #333; font-family: inherit; outline: none; resize: none; }
.input-extras { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: 15px; }
#char-count { font-size: 0.85em; color: #aaa; font-weight: 500; min-width: 50px; text-align: right; }
.post-actions { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #eee; padding-top: 15px; }
.publish-btn { background: #000; color: white; border: none; padding: 8px 20px; border-radius: 20px; cursor: pointer; font-weight: 600; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); display: inline-block; backface-visibility: hidden; }
.publish-btn:hover { transform: scale(1.1); }

/* Carte de Post */
.post-card { background: white; border-radius: 1rem; padding: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-bottom: 0; opacity: 1; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); display: block; position: relative; z-index: 1; }.post-card:hover { transform: translateY(-4px) scale(1.005); z-index: 10; box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08), 0 5px 15px rgba(209, 0, 0, 0.03); }
.post-card.entering { animation: postSmoothEnter 0.5s ease forwards; transform-origin: top center; }
.post-header { display: flex; justify-content: space-between; margin-bottom: 15px; }
.post-header .user-info { display: flex; align-items: center; gap: 10px; }
.user-info .profile-link { display: flex !important; align-items: center; gap: 12px; text-decoration: none; color: inherit; flex-direction: row !important; }
.user-info .profile-link > div { display: flex; flex-direction: column; justify-content: center; }
.user-info h4 { margin: 0; line-height: 1.2; font-size: 1rem; display: flex; align-items: center; gap: 5px; }
.user-info .time { display: block; font-size: 0.8rem; color: #888; margin-top: 2px; line-height: 1; font-weight: 400 !important; }
.post-content p { font-size: 0.9em; margin-bottom: 15px; line-height: 1.4; overflow-wrap: break-word; word-break: break-word; }

/* Contenu multimédia post */
.post-images { display: grid; gap: 2px; border-radius: 10px; overflow: hidden; margin-top: 10px; width: 100%; }
.img-box { width: 100%; background-size: cover; background-position: center; cursor: zoom-in; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); display: inline-block; backface-visibility: hidden; height: 250px; }
.img-box:hover { transform: scale(1.03); z-index: 2; box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
.grid-1 { grid-template-columns: 1fr; } .grid-1 .img-box { height: 350px; }
.grid-2 { grid-template-columns: 1fr 1fr; } .grid-2 .img-box { height: 250px; }
.grid-3 { display: grid !important; grid-template-columns: 50% 50% !important; grid-auto-flow: row !important; }
.grid-3 > *:nth-child(1) { grid-column: 1 / -1 !important; width: 100% !important; height: 300px !important; }
.grid-3 > *:nth-child(2), .grid-3 > *:nth-child(3) { grid-column: auto !important; width: 100% !important; height: 200px !important; }
.grid-4 { grid-template-columns: 1fr 1fr; } .grid-4 .img-box { height: 180px; }
/* --- LECTEUR VIDÉO PRO --- */
.video-wrapper { 
    position: relative; 
    width: 100%; 
    background: #050505; /* Un noir un peu plus riche */
    border-radius: 12px; /* Des bords plus modernes */
    overflow: hidden; 
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.post-video { 
    width: 100%; 
    max-height: 600px; /* Plus grand pour plus d'immersion */
    object-fit: contain; 
    display: block; 
    outline: none; 
    cursor: pointer;
}

/* Gros bouton Play au centre (Style Instagram/TikTok) */
.center-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.5);
    font-size: 4.5rem;
    color: rgba(255, 255, 255, 0.85);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
    z-index: 5;
}

.video-wrapper.is-paused .center-play-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Les contrôles du bas en superposition */
.custom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 15px 15px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0; /* Caché par défaut, on nettoie l'interface */
    transition: opacity 0.3s ease;
    z-index: 10;
}

/* Apparaît quand on met la souris sur la vidéo */
.video-wrapper:hover .custom-controls,
.video-wrapper.is-paused .custom-controls {
    opacity: 1;
}

.ctrl-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.4rem;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(5px);
}

.ctrl-btn:hover {
    background: var(--primary-color, #d10000);
    transform: scale(1.15);
}

.spacer { flex-grow: 1; }

.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Slider de volume qui s'étire au survol (la touche pro) */
.volume-slider {
    width: 0;
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
}

.volume-container:hover .volume-slider {
    width: 70px;
}

.volume-range {
    width: 100%;
    cursor: pointer;
    accent-color: var(--primary-color, #d10000);
}

/* Actions post */
.post-stats { display: flex; align-items: center; gap: 20px; color: var(--gray-text); font-size: 0.9em; margin-top: 15px; }
.post-stats .stat { display: flex; align-items: center; gap: 5px; cursor: pointer; transition: color 0.2s; }
.post-stats .stat i { font-size: 1.2rem; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); display: inline-block; backface-visibility: hidden; }
.post-stats .stat:hover { color: var(--primary-color); }
.post-stats .stat:hover i { transform: scale(1.3); }
.post-stats .stat.liked { color: var(--primary-color) !important; font-weight: 600; }
.post-stats .stat.liked i { animation: pop 0.3s ease; }
.bookmark { margin-left: auto; }
.menu-post { cursor: pointer; padding: 5px; border-radius: 50%; transition: all 0.3s; position: relative; }
.menu-post:hover { transform: rotate(90deg); background-color: #f0f0f0; }
.post-options-menu { display: none; position: absolute; top: 30px; right: 0; background: white; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.15); width: 180px; z-index: 100; flex-direction: column; animation: fadeInMenu 0.2s; outline: none !important; -webkit-tap-highlight-color: transparent !important; }
.post-options-menu.active { display: flex; }
.menu-item { padding: 10px 15px; cursor: pointer; display: flex; gap: 10px; color: #333; display: block; position: relative; z-index: 1; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); backface-visibility: hidden; }
.menu-item:hover { transform: translateX(5px) scale(1.02); background: #fff5f5; }
.post-options-menu .menu-item.delete { background-color: #f5f5f5 !important; color: #888 !important; font-weight: 600 !important; border-radius: 50px !important; margin: 8px 12px !important; padding: 10px 18px !important; border: 1px solid #eeeeee !important; box-shadow: none !important; display: flex !important; align-items: center !important; gap: 8px !important; transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease !important; transform-origin: center; }
.menu-item.delete:hover { background-color: #d10000 !important; color: #ffffff !important; transform: scale(1.05) !important; box-shadow: 0 5px 15px rgba(209, 0, 0, 0.25) !important; }
.menu-item.delete i { color: inherit !important; transition: none !important; }
.menu-item.delete:hover i { animation: trashJuicyShake 0.4s ease-in-out infinite alternate; }
.menu-item.delete:active { transform: scale(0.95) !important; background-color: #a80000 !important; box-shadow: none !important; }

/* Section Commentaires */
.comments-section { display: none; margin-top: 15px; padding-top: 15px; border-top: 1px solid #eee; animation: slideDown 0.3s ease; }
.comments-section.active { display: block; }
.comment-item { display: flex; gap: 10px; margin-bottom: 12px; align-items: flex-start; }
.comment-content { background-color: #f0f2f5; padding: 8px 12px; border-radius: 15px; width: 100%; display: flex; justify-content: space-between; align-items: center; position: relative; }
.comment-content strong { display: block; color: #333; margin-bottom: 2px; }
/* --- CORRECTION DE LA COHÉRENCE DU NOM DANS LES COMMENTAIRES --- */
.comment-author-link {
    text-decoration: none !important; /* On tue le soulignement immonde */
    color: #333 !important; /* Même gris sombre que le header du post */
    transition: color 0.2s ease;
    display: inline-block;
}

.comment-author-link:hover {
    color: var(--primary-color, #d10000) !important; /* Petit effet au survol, subtil et pro */
}

.comment-content strong {
    display: block; 
    color: inherit; /* Il hérite de la couleur du lien au lieu d'être forcé */
    margin-bottom: 2px;
    font-size: 0.95rem; /* On l'aligne avec la taille du nom dans le post */
}
.comment-text-group { display: flex; flex-direction: column; width: 90%; }
.comment-like-btn { cursor: pointer; font-size: 0.9em; color: #777; display: flex; align-items: center; gap: 3px; min-width: 30px; justify-content: flex-end; }
.comment-like-btn:hover { color: #d10000; }
.comment-like-btn.liked { color: #d10000; }
.write-comment { display: flex; gap: 10px; margin-top: 15px; position: relative !important; overflow: visible !important; z-index: 10; }
.write-comment input { width: 100%; padding: 8px 15px; border-radius: 20px; border: 1px solid #ddd; background-color: #f0f2f5; font-family: inherit; }
.write-comment textarea { height: 35px; padding-top: 8px; }
.send-comment-btn { background: none; border: none; color: var(--primary-color); font-size: 1.2em; cursor: pointer; }
.comment-sticker { width: 80px; height: 80px; background-size: contain; background-repeat: no-repeat; background-position: left; margin: 5px 0; cursor: pointer; position: relative; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); display: inline-block; backface-visibility: hidden; }
.comment-sticker:hover { opacity: 0.9; transform: scale(1.15) rotate(3deg); z-index: 5; }
.comment-actions { display: flex; gap: 10px; font-size: 0.8em; color: #888; margin-top: 2px; margin-left: 5px; }
.comment-action-link { cursor: pointer; }
.comment-action-link:hover { text-decoration: underline; color: #333; }
.btn-delete-comment { color: #ccc; cursor: pointer; font-size: 1.1rem; margin-left: 5px; transition: 0.2s; visibility: hidden; }
.comment-item:hover .btn-delete-comment { visibility: visible; }
.btn-delete-comment:hover { color: #d10000; }
.input-sticker-btn { font-size: 1.4rem; color: #555; cursor: pointer; padding: 5px; display: flex; align-items: center; }
.input-sticker-btn:hover { color: #d10000; }

/* Boutons icônes seules (Création) */
#upload-icon, #sticker-btn { width: 38px !important; height: 38px !important; padding: 0 !important; border-radius: 50% !important; font-size: 1.4rem !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); display: inline-block; backface-visibility: hidden; }
#upload-icon:hover, #sticker-btn:hover { background: #fff5f5 !important; color: #d10000 !important; transform: scale(1.15) rotate(-5deg) !important; }

/* --- SPÉCIFICITÉS ÉDITEURS & PREVIEWS (Feed) --- */
.edit-media-btn { position: absolute; bottom: 5px; left: 5px; background: rgba(0,0,0,0.6); color: white; width: 24px; height: 24px; font-size: 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; transition: 0.2s; }
.edit-media-btn:hover { background: #f5f5f5; color: #ff0000; }
#image-preview-container { display: flex; flex-wrap: nowrap; gap: 10px; margin-top: 10px; margin-bottom: 5px; overflow-x: auto; padding: 2px; }
.preview-item { position: relative; width: 80px; height: 80px; flex-shrink: 0; background-size: cover; background-position: center; border-radius: 10px; border: 1px solid #ddd; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.remove-media-btn { position: absolute; top: -5px; right: -5px; background: #333; color: white; width: 20px; height: 20px; font-size: 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; border: 2px solid white; transition: 0.2s; }
.remove-media-btn:hover { background: #d10000; transform: scale(1.1); }

/* --- SPÉCIFICITÉS PARTAGE (Feed) --- */
.share-search-input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 8px; margin-bottom: 10px; font-family: inherit; background: #f9f9f9; }
.share-search-input:focus { outline: none; border-color: #d10000; background: white; }
.contact-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid #f9f9f9; cursor: pointer; border-radius: 8px; border: 2px solid transparent; display: flex; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; z-index: 1; backface-visibility: hidden; }
.contact-item:hover { background: #f0f2f5; }
.contact-item.selected { background: #fff5f5; border-color: #d10000; }
.check-icon { font-size: 1.4rem; color: #ccc; margin-left: auto; }
.contact-item.selected .check-icon { color: #d10000; content: '\eb7b'; }
.contact-item.selected .check-icon:before { content: "\eb80"; }
.batch-send-btn { width: 100%; background: #d10000; color: white; border: none; padding: 12px; border-radius: 10px; font-weight: 600; cursor: pointer; margin-top: 10px; opacity: 0.5; pointer-events: none; transition: 0.2s; }
.batch-send-btn.active { opacity: 1; pointer-events: all; }
.share-contact-item { transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); border: 2px solid transparent; }
.share-contact-item:hover { transform: translateX(8px) scale(1.02); background: #fff5f5 !important; border-color: #ffe0e0; box-shadow: -4px 4px 12px rgba(209, 0, 0, 0.08); z-index: 2; position: relative; }
.btn-send-share { transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important; }
.btn-send-share:hover { transform: scale(1.1); box-shadow: 0 4px 10px rgba(209, 0, 0, 0.3); }
.btn-send-share:active { transform: scale(0.9) !important; opacity: 0.8; }
/* --- 4. COLONNE DROITE (Ta zone de pub) --- */
#sidebar-right-container {
    /* C'est ICI qu'on active le sticky */
    position: -webkit-sticky;
    position: sticky;
    top: 20px; /* La marge en haut quand ça défile */
    height: max-content; /* Obligatoire dans une grille pour que le sticky marche */
}
/* --- 2. COLONNE GAUCHE (Ton Menu Principal) --- */
#sidebar-container {
    /* La même putain de magie que pour la droite */
    position: -webkit-sticky;
    position: sticky;
    top: 20px; /* Aligné avec la marge de ta pub à droite */
    height: max-content; /* Laisse le menu prendre sa propre taille sans s'étirer */
    
    /* Optionnel mais recommandé : 
       Si ton menu est plus grand que l'écran un jour, ça permet de le scroller de l'intérieur
       sans casser la page. */
    max-height: calc(100vh - 40px);
    overflow-y: auto; 
}

/* Cache la barre de défilement laide si le menu devient scrollable */
#sidebar-container::-webkit-scrollbar {
    display: none;
}
#sidebar-container {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* =================================================================
   STYLES BARRE DE PROGRESSION D'UPLOAD (RELIO)
================================================================= */
.upload-progress-container {
    width: 100%;
    background-color: #f0f2f5;
    border-radius: 10px;
    margin-bottom: 15px;
    overflow: hidden;
    position: relative;
    height: 22px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.upload-progress-bar {
    height: 100%;
    background-color: var(--primary-color, #d10000);
    width: 0%;
    transition: width 0.2s linear, background-color 0.3s ease;
}

.upload-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    color: white;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    pointer-events: none;
    white-space: nowrap;
}