/* --- Styles Généraux et Réinitialisations --- */
body {
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif; /* Plus moderne et lisible */
    margin: 0;
    padding: 0;
    background-color: #0A0A0A; /* Noir très profond pour le fond principal de l'app */
    color: #E0E0E0; /* Blanc cassé pour le texte par défaut sur fond sombre */
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

*, *::before, *::after {
    box-sizing: border-box;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    cursor: pointer;
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
}

input, textarea {
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    background-color: #1A1A1A; /* Fond sombre pour les inputs */
    color: #E0E0E0; /* Texte blanc cassé pour les inputs */
}
input::placeholder, textarea::placeholder {
    color: #909090; /* Couleur du placeholder */
}


/* --- Main Header (Barre de navigation supérieure) --- */
.main-header {
    background: linear-gradient(to right, #111111, #0A0A0A); /* Dégradé subtil */
    color: #fff;
    padding: 15px 25px; /* Padding ajusté */
    text-align: left; /* Alignement du texte à gauche */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4); /* Ombre plus prononcée */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1E1E1E; /* Ligne fine de séparation */
    z-index: 1000; /* Assure que le header est au-dessus */
    position: sticky; /* Reste en haut lors du défilement */
    top: 0;
}

.main-header h1 {
    margin: 0;
    font-size: 1.8em; /* Plus petit pour un look app */
    font-weight: 700;
    color: #FFFFFF; /* Blanc pur pour le titre */
    letter-spacing: -0.5px; /* Légèrement plus serré */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px; /* Espacement ajusté */
    font-size: 1em; /* Plus petit */
    font-weight: 500;
    color: #E0E0E0; /* Blanc cassé */
}

/* Bouton d'action générique (pour "Publier", "Envoyer", "Rechercher") */
.action-btn {
    background-color: #2E8B57; /* Vert Kinema+ */
    color: white;
    padding: 10px 20px; /* Padding ajusté */
    border: none;
    border-radius: 25px; /* Très arrondi pour un look moderne */
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.3s ease; /* Transition pour tous les changements */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); /* Ombre subtile */
}

.action-btn:hover {
    background-color: #246B44; /* Vert plus foncé au survol */
    transform: translateY(-2px); /* Léger soulèvement */
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.action-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4) inset; /* Ombre intérieure au clic */
    background-color: #1A5432;
}

.action-btn:disabled {
    background-color: #444444; /* Gris foncé pour désactivé */
    color: #999999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Main Content Area --- */
.main-content {
    max-width: 1000px;
    margin: 30px auto 100px auto; /* Marge en bas pour la navigation flottante */
    padding: 30px; /* Padding ajusté */
    background-color: #0A0A0A; /* Même fond que le body pour la cohérence */
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); /* Ombre profonde */
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.section-card {
    background: linear-gradient(135deg, #1C1C1E 0%, #111111 100%); /* Dégradé subtil */
    border: 1px solid #282828; /* Bordure douce */
    border-radius: 12px;
    padding: 30px; /* Padding ajusté */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); /* Ombre pour l'élévation */
    position: relative; /* Pour les pseudo-éléments */
    overflow: hidden; /* Pour contenir les effets */
}

.section-card::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 140%;
    background: radial-gradient(circle at 80% 20%, rgba(46, 139, 87, 0.05) 0%, transparent 50%); /* Lumière subtile */
    z-index: 0;
    pointer-events: none;
}

.section-card > * {
    position: relative;
    z-index: 1; /* Assure que le contenu est au-dessus du pseudo-élément */
}


.section-card h2 {
    color: #F8F8F8; /* Blanc très clair */
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 2em; /* Plus grand */
    border-bottom: 2px solid #2E8B57; /* Ligne d'accentuation verte */
    padding-bottom: 12px;
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.03em;
    position: relative;
}

.section-card h2::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -2px;
    width: 60px; /* Petite ligne verte au centre */
    height: 4px;
    background-color: #2E8B57;
    border-radius: 2px;
}

.no-content-message {
    text-align: center;
    color: #909090; /* Gris plus clair */
    font-style: italic;
    padding: 20px;
    font-size: 1.1em;
    background-color: #1A1A1A; /* Fond légèrement différent */
    border-radius: 8px;
    margin-top: 20px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.2);
}

/* --- Section Publication (Création de posts) --- */
.post-creation-section textarea {
    width: 100%; /* Largeur pleine */
    padding: 15px; /* Plus de padding */
    border: 1px solid #333333; /* Bordure sombre */
    border-radius: 10px; /* Bords plus arrondis */
    font-size: 1.05em;
    resize: vertical;
    min-height: 100px; /* Hauteur minimale */
    margin-bottom: 15px;
    background-color: #1A1A1A; /* Fond sombre */
    color: #E0E0E0; /* Texte blanc cassé */
    box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.2); /* Ombre intérieure subtile */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.post-creation-section textarea:focus {
    outline: none;
    border-color: #2E8B57; /* Bordure verte au focus */
    box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(46, 139, 87, 0.3); /* Lueur verte */
}

.publish-btn {
    /* Hérite de .action-btn, mais on peut surcharger si nécessaire */
    background-color: #2E8B57; /* Utilise le vert Kinema+ */
    width: 100%;
}
.publish-btn:hover {
    background-color: #246B44;
}

/* --- Fil d'actualité (Posts) --- */
.posts-container {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Plus d'espace entre les posts */
}

.post-card {
    background: linear-gradient(135deg, #1C1C1E 0%, #111111 100%); /* Dégradé pour les cartes de post */
    border: 1px solid #282828;
    border-radius: 12px;
    padding: 20px; /* Plus de padding */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); /* Ombre prononcée */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.post-card .post-header {
    display: flex;
    align-items: center;
    gap: 12px; /* Espacement ajusté */
    margin-bottom: 15px;
    border-bottom: 1px solid #282828; /* Ligne de séparation plus foncée */
    padding-bottom: 10px;
}

.post-card .post-header .avatar {
    width: 48px; /* Plus grand */
    height: 48px;
    background-color: #555555; /* Gris moyen */
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.4em; /* Plus grand */
    border: 2px solid #2E8B57; /* Petite bordure verte pour l'avatar */
}

.post-card .post-header .username {
    font-weight: bold;
    color: #FFFFFF; /* Blanc pur */
    font-size: 1.2em; /* Plus grand */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.post-card .post-header .timestamp {
    font-size: 0.9em; /* Plus grand */
    color: #909090; /* Gris clair */
    margin-left: auto;
}

.post-card .post-content {
    font-size: 1.05em; /* Texte plus grand */
    color: #E0E0E0; /* Blanc cassé pour le contenu */
    white-space: pre-wrap;
    line-height: 1.7;
}

/* --- Section Recherche --- */
.search-input-container {
    display: flex;
    gap: 15px; /* Espacement ajusté */
    margin-bottom: 20px;
}

.search-input-container input {
    flex-grow: 1;
    padding: 12px; /* Plus de padding */
    border: 1px solid #333333;
    border-radius: 25px; /* Très arrondi */
    font-size: 1.05em;
    background-color: #1A1A1A;
    color: #E0E0E0;
    box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.2);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-input-container input:focus {
    outline: none;
    border-color: #2E8B57;
    box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(46, 139, 87, 0.3);
}

.search-btn {
    /* Hérite de .action-btn */
    background-color: #2E8B57; /* Vert Kinema+ pour la recherche */
    border-radius: 25px; /* Très arrondi */
    padding: 10px 20px;
}
.search-btn:hover {
    background-color: #246B44;
}

.search-results {
    max-height: 300px; /* Hauteur ajustée */
    overflow-y: auto;
    background-color: #1A1A1A; /* Fond sombre */
    border: 1px solid #282828;
    border-radius: 10px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
    margin-top: 15px;
}
.search-results::-webkit-scrollbar {
    width: 8px;
}
.search-results::-webkit-scrollbar-track {
    background: #111111;
}
.search-results::-webkit-scrollbar-thumb {
    background: #444444;
    border-radius: 4px;
}
.search-results::-webkit-scrollbar-thumb:hover {
    background: #555555;
}

.search-result-item {
    padding: 15px 20px; /* Padding ajusté */
    border-bottom: 1px solid #282828; /* Ligne de séparation plus foncée */
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #E0E0E0; /* Texte blanc cassé */
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: #222222; /* Fond plus sombre au survol */
}

.search-result-item .avatar {
    width: 35px; /* Plus grand */
    height: 35px;
    background-color: #666666;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1em;
}


/* --- Section Inbox (Messagerie) --- */
.inbox-container {
    display: flex;
    gap: 0; /* Pas de gap ici, les bordures gèrent la séparation */
    min-height: 500px; /* Hauteur minimale plus grande */
    border: 1px solid #282828;
    border-radius: 12px;
    overflow: hidden;
    background-color: #111111; /* Fond des conteneurs */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.conversation-list {
    flex: 0 0 300px; /* Largeur fixe plus grande pour la liste */
    background-color: #1A1A1A; /* Fond légèrement différent */
    border-right: 1px solid #282828; /* Séparateur */
    padding: 20px 0;
    overflow-y: auto;
    position: relative;
}
.conversation-list::-webkit-scrollbar {
    width: 8px;
}
.conversation-list::-webkit-scrollbar-track {
    background: #111111;
}
.conversation-list::-webkit-scrollbar-thumb {
    background: #444444;
    border-radius: 4px;
}
.conversation-list::-webkit-scrollbar-thumb:hover {
    background: #555555;
}


.conversation-list h3 {
    text-align: center;
    color: #FFFFFF; /* Blanc */
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #2E8B57; /* Ligne d'accentuation verte */
    font-size: 1.6em;
    font-weight: 600;
}

.conversation-item {
    padding: 15px 20px; /* Padding ajusté */
    border-bottom: 1px solid #282828;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #E0E0E0;
}

.conversation-item.active,
.conversation-item:hover {
    background-color: #2E8B57; /* Vert pour actif/survol */
    color: #FFFFFF;
}
.conversation-item.active .name,
.conversation-item:hover .name {
    color: #FFFFFF;
}

.conversation-item:last-child {
    border-bottom: none;
}

.conversation-item .avatar {
    width: 40px;
    height: 40px;
    background-color: #666666;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.1em;
    border: 2px solid #555555; /* Bordure par défaut */
}

.conversation-item.active .avatar,
.conversation-item:hover .avatar {
    border-color: #FFFFFF; /* Bordure blanche quand actif/survol */
}

.conversation-item .name {
    font-weight: 600;
    color: #F0F0F0; /* Blanc cassé pour le nom */
    font-size: 1.05em;
}


.chat-window {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: #0A0A0A; /* Fond de la fenêtre de chat */
}

.chat-header {
    background: linear-gradient(to right, #1A1A1A, #111111); /* Dégradé pour le header de chat */
    padding: 15px 20px;
    font-weight: bold;
    font-size: 1.2em;
    color: #F8F8F8;
    border-bottom: 1px solid #282828;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.close-chat-btn {
    background: none;
    border: none;
    font-size: 1.8em;
    color: #909090; /* Gris clair */
    cursor: pointer;
    transition: color 0.2s ease;
}
.close-chat-btn:hover {
    color: #FFFFFF;
}


.messages-display {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px; /* Plus d'espace entre les messages */
    background-color: #0A0A0A; /* Fond des messages */
}
.messages-display::-webkit-scrollbar {
    width: 8px;
}
.messages-display::-webkit-scrollbar-track {
    background: #0A0A0A;
}
.messages-display::-webkit-scrollbar-thumb {
    background: #333333;
    border-radius: 4px;
}
.messages-display::-webkit-scrollbar-thumb:hover {
    background: #444444;
}

.message-bubble {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 15px;
    border-radius: 20px; /* Plus arrondi */
    max-width: 75%; /* Plus large pour les messages */
    word-wrap: break-word;
    font-size: 0.95em;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    position: relative; /* Pour le timestamp */
}

.message-bubble.sent {
    background-color: #2E8B57; /* Vert Kinema+ pour envoyé */
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px; /* Angle moins arrondi en bas */
    flex-direction: row-reverse; /* Avatar à droite */
}

.message-bubble.received {
    background-color: #1A1A1A; /* Gris foncé pour reçu */
    color: #E0E0E0; /* Blanc cassé pour reçu */
    align-self: flex-start;
    border-bottom-left-radius: 5px; /* Angle moins arrondi en bas */
    flex-direction: row; /* Avatar à gauche */
    border: 1px solid #282828; /* Bordure fine pour reçu */
}

.message-bubble .message-content-wrapper {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    color: inherit; /* Assure que le texte hérite de la couleur de la bulle */
}
.message-bubble.sent .message-content-wrapper {
    align-items: flex-end;
}
.message-bubble.received .message-content-wrapper {
    align-items: flex-start;
}

.message-bubble .message-avatar-wrapper {
    display: flex;
    align-items: flex-end;
    padding-bottom: 2px; /* Ajusté */
}

.message-bubble .message-timestamp {
    font-size: 0.7em; /* Plus petit */
    color: rgba(255, 255, 255, 0.6); /* Plus transparent pour envoyé */
    margin-top: 3px; /* Espacement réduit */
    display: block;
    text-align: right;
    white-space: nowrap;
}
.message-bubble.received .message-timestamp {
    color: rgba(224, 224, 224, 0.6); /* Gris transparent pour reçu */
    text-align: left;
}

.message-input-container {
    display: flex;
    padding: 15px 20px;
    border-top: 1px solid #282828;
    gap: 10px;
    background-color: #111111; /* Fond de la barre d'input */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

.message-input-container input {
    flex-grow: 1;
    padding: 12px;
    border: 1px solid #333333;
    border-radius: 25px; /* Très arrondi */
    font-size: 1.05em;
    background-color: #1A1A1A;
    color: #E0E0E0;
    box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.2);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.message-input-container input:focus {
    outline: none;
    border-color: #2E8B57;
    box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(46, 139, 87, 0.3);
}

.message-input-container button {
    /* Hérite de .action-btn */
    background-color: #2E8B57; /* Vert Kinema+ */
    border-radius: 25px;
    padding: 10px 22px;
}
.message-input-container button:hover {
    background-color: #246B44;
}


/* --- Main Footer (Pied de page) --- */
.main-footer {
    text-align: center;
    padding: 25px 20px;
    margin-top: 40px;
    background-color: #0A0A0A; /* Même fond que le body */
    color: #888888;
    font-size: 0.8em;
    border-top: 1px solid #1E1E1E;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

/* --- Avatar Helper Classes (Global) --- */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: white;
    background-color: #444444; /* Gris plus foncé pour les avatars */
    flex-shrink: 0;
    border: 2px solid transparent; /* Bordure transparente par défaut */
}

.avatar-small {
    width: 30px;
    height: 30px;
    font-size: 0.9em;
}

.avatar-medium {
    width: 40px;
    height: 40px;
    font-size: 1.1em;
}

/* Ajustement pour l'affichage de l'utilisateur actuel dans le header */
.user-info .avatar-small {
    border: 2px solid #2E8B57; /* Bordure verte pour l'avatar de l'utilisateur principal */
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        gap: 10px;
        padding: 12px 15px;
    }
    .main-header h1 {
        font-size: 1.6em;
    }
    .user-info {
        flex-direction: row; /* Garde en ligne sur les tablettes */
        gap: 8px;
        font-size: 0.95em;
    }
    .main-content {
        margin: 20px 10px 80px 10px; /* Ajusté pour la bottom nav */
        padding: 15px;
    }
    .section-card {
        padding: 20px;
    }
    .section-card h2 {
        font-size: 1.6em;
        margin-bottom: 15px;
        padding-bottom: 8px;
    }
    .post-creation-section textarea {
        min-height: 80px;
        padding: 12px;
    }
    .post-card {
        padding: 15px;
    }
    .post-card .post-header .avatar {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }
    .post-card .post-header .username {
        font-size: 1.1em;
    }
    .post-card .post-content {
        font-size: 0.95em;
    }
    .search-input-container {
        gap: 10px;
        margin-bottom: 15px;
    }
    .search-input-container input {
        padding: 10px;
    }
    .search-btn {
        padding: 8px 15px;
        font-size: 0.9em;
    }
    .inbox-container {
        flex-direction: column;
        min-height: auto;
        border-radius: 10px;
    }
    .conversation-list {
        flex: none;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #282828;
        padding: 15px 0;
        max-height: 250px; /* Limite la hauteur de la liste de convos */
        border-radius: 0; /* Pas de border-radius en bas */
    }
    .conversation-list h3 {
        font-size: 1.4em;
        padding-bottom: 10px;
        margin-bottom: 15px;
    }
    .conversation-item {
        padding: 12px 15px;
        gap: 10px;
    }
    .conversation-item .avatar {
        width: 35px;
        height: 35px;
    }
    .chat-window {
        width: 100%;
    }
    .chat-header {
        font-size: 1.1em;
        padding: 10px 15px;
    }
    .messages-display {
        padding: 15px;
        max-height: 350px; /* Limite la hauteur de la fenêtre de chat */
        gap: 8px;
    }
    .message-bubble {
        max-width: 90%; /* Peut être plus large sur mobile */
        padding: 8px 12px;
    }
    .message-input-container {
        padding: 10px 15px;
    }
    .message-input-container input {
        padding: 10px;
        font-size: 0.95em;
    }
    .message-input-container button {
        padding: 8px 18px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .main-header {
        padding: 10px 15px;
    }
    .main-header h1 {
        font-size: 1.4em;
    }
    .user-info {
        font-size: 0.9em;
    }
    .action-btn {
        padding: 8px 15px;
        font-size: 0.85em;
    }
    .main-content {
        margin: 15px 8px 70px 8px;
        padding: 10px;
    }
    .section-card {
        padding: 15px;
    }
    .section-card h2 {
        font-size: 1.4em;
        padding-bottom: 6px;
    }
    .post-creation-section textarea {
        min-height: 60px;
        padding: 10px;
        font-size: 0.95em;
    }
    .post-card {
        padding: 12px;
    }
    .post-card .post-header .avatar {
        width: 35px;
        height: 35px;
        font-size: 1em;
    }
    .post-card .post-header .username {
        font-size: 1em;
    }
    .post-card .post-content {
        font-size: 0.9em;
    }
    .search-input-container {
        flex-direction: column;
        gap: 10px;
    }
    .search-btn {
        width: 100%;
        padding: 10px;
    }
    .inbox-container {
        border-radius: 8px;
    }
    .conversation-list {
        max-height: 200px;
        padding: 10px 0;
    }
    .conversation-list h3 {
        font-size: 1.2em;
    }
    .conversation-item {
        padding: 10px 12px;
    }
    .conversation-item .avatar {
        width: 30px;
        height: 30px;
    }
    .chat-header {
        font-size: 1em;
        padding: 8px 10px;
    }
    .messages-display {
        padding: 10px;
        max-height: 250px;
    }
    .message-bubble {
        max-width: 100%;
        font-size: 0.9em;
        padding: 7px 10px;
    }
    .message-input-container {
        padding: 8px 10px;
    }
    .message-input-container input {
        padding: 8px;
        font-size: 0.9em;
    }
    .message-input-container button {
        padding: 6px 12px;
        font-size: 0.85em;
        border-radius: 20px;
    }
    .main-footer {
        padding: 15px 10px;
        font-size: 0.75em;
    }
}
