body, html {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background-image: url('bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-color: #0a162200 !important;
    font-family: 'EB Garamond', serif;
    color: #fffbe7;
}

/* Titres et actions */
.news-feed-title {
    color: #b2eaff; /* Light blue title */
    text-align: center;
    font-size: 2.2rem; /* Slightly smaller to fit better */
    margin-bottom: 10px;
    text-shadow: 0 0 8px #7fd8ff, 0 0 5px #0a223a;
}

.news-feed-actions {
    display: flex;
    justify-content: center;
    gap: 1em;
    margin-bottom: 1.5em;
}

.btn-return-home-admin {
    background: rgba(10, 34, 58, 0.75);
    border: 2px solid #7fd8ff;
    color: #fffbe7;
    font-family: 'EB Garamond', serif;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(127, 216, 255, 0.5);
    transition: background-color 0.3s, box-shadow 0.3s;
    text-decoration: none;
    padding: 10px 25px;
}
.btn-return-home-admin:hover {
    background-color: rgba(30, 60, 90, 0.9);
    box-shadow: 0 0 18px rgba(178, 234, 255, 0.7);
    color: #b2eaff;
}

/* Section principale */
.news-feed-section,
.fb-feed-form-card,
.fb-feed-card {
    background: rgba(10, 20, 45, 0.93);
    border-radius: 15px;
    border: 1px solid rgba(127, 216, 255, 0.18);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(127, 216, 255, 0.13) inset;
    color: #fffbe7;
}

.news-feed-section {
    padding: 2em 1.5em;
    max-width: 700px;
    margin: 0 auto;
}

/* Centrer la liste principale du feed */
#news-feed-list,
.news-feed-list {
    max-width: 700px;
    margin: 0 auto 1.5em auto;
    width: 100%;
    padding: 0;
    display: block;
}

/* Catégories */
.news-feed-categories-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1em;
    margin-bottom: 2em;
    flex-wrap: wrap;
}

.news-feed-category-select {
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid #7fd8ff;
    background: rgba(20, 35, 60, 0.9);
    color: #b2eaff;
    font-size: 1.1em;
    font-family: inherit;
    margin-right: 1em;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.news-feed-category-select:focus {
    border-color: #b2eaff;
    box-shadow: 0 0 8px #b2eaff33;
    outline: none;
}

/* Cards façon Facebook */
.fb-feed-card {
    margin-bottom: 1.5em;
    padding: 1.2em 1.5em 1em 1.5em;
    display: flex;
    flex-direction: row;
    gap: 1em;
    border: 1px solid #7fd8ff33;
    position: relative;
    overflow: visible;
    max-width: 700px;
    margin: 0 auto 1.5em auto;
}

.fb-feed-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7fd8ff 0%, #7e57c2 100%);
    color: #fffbe7;
    font-weight: bold;
    font-size: 2.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 8px #7fd8ff33;
    border: 3px solid #7fd8ff;
    position: absolute;
    top: -36px;
    left: -36px;
    z-index: 2;
    overflow: hidden;
    /* Optionnel : effet lumineux autour */
    box-shadow: 0 0 18px #7fd8ff88, 0 1px 8px #7fd8ff33;
}

.fb-feed-content {
    flex: 1;
    min-width: 0;
    margin-top: -15px;
}

.fb-feed-header {
    display: flex;
    align-items: center;
    gap: 0.7em;
    margin-bottom: 0.2em;
}

.fb-feed-author {
    font-weight: bold;
    color: #b2eaff;
    font-size: 1.50em;
    margin-bottom: -15px;
    margin-left: 0.7em;
}

.fb-feed-date {
    color: #7fd8ff;
    font-size: 0.98em;
    font-family: 'Fira Mono', 'Consolas', monospace;
}

.fb-feed-type {
    font-size: 0.95em;
    color: #fffbe7;
    background: #7fd8ff;
    border-radius: 5px;
    padding: 2px 10px;
    margin-left: 0.5em;
    font-weight: bold;
    box-shadow: 0 0 8px #7fd8ff33;
}

.fb-feed-text {
    color: #fffbe7;
    font-size: 1.13em;
    margin-bottom: 0.2em;
    word-break: break-word;
    text-shadow: 0 1px 2px #0a223a44;
}

/* Formulaire de post */
.fb-feed-form-card {
    margin-bottom: 2em;
    padding: 1.2em 1.5em 1em 1.5em;
    border: 1px solid #7fd8ff33;
}
.fb-feed-form-card textarea {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #b2eaff;
    background: rgba(20, 35, 60, 0.9);
    color: #fffbe7;
    padding: 12px;
    font-size: 1.1em;
    margin-bottom: 0.7em;
    resize: vertical;
    font-family: 'EB Garamond', serif;
}
.fb-feed-form-card textarea:focus {
    outline: none;
    border-color: #b2eaff;
    box-shadow: 0 0 12px #b2eaff55;
}
.fb-feed-form-card button {
    background: #7fd8ff;
    color: #0a1622;
    border: none;
    border-radius: 8px;
    padding: 10px 22px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'EB Garamond', serif;
    box-shadow: 0 0 8px #7fd8ff33;
}
.fb-feed-form-card button:hover {
    background: #b2eaff;
}
.fb-feed-form-card .feedback-alert {
    margin-bottom: 0.7em;
}

/* Listes et items */
.news-feed-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.news-feed-item {
    display: flex;
    align-items: flex-start;
    gap: 1.2em;
    background: rgba(20, 35, 60, 0.9);
    border-radius: 10px;
    box-shadow: 0 1px 4px #7fd8ff22;
    margin-bottom: 1.1em;
    padding: 1.1em 1.2em;
    transition: box-shadow 0.2s;
    border-left: 5px solid #7fd8ff;
}
.news-feed-item:hover {
    box-shadow: 0 4px 16px #7fd8ff33;
    border-left: 5px solid #b2eaff;
}
.news-feed-date {
    min-width: 110px;
    color: #7fd8ff;
    font-weight: bold;
    font-size: 1.05em;
    font-family: 'Fira Mono', 'Consolas', monospace;
    margin-top: 2px;
}
.news-feed-event {
    flex: 1;
    color: #fffbe7;
    font-size: 1.08em;
    line-height: 1.5;
    word-break: break-word;
}
.news-feed-item-category {
    font-size: 0.95em;
    color: #7fd8ff;
    background: #0a223a;
    border-radius: 5px;
    padding: 2px 10px;
    margin-bottom: 6px;
    display: inline-block;
}
.news-feed-empty {
    text-align: center;
    color: #b2eaff;
    font-size: 1.2em;
    margin: 2em 0;
}

/* Citation du jour */
.news-feed-quote-of-day {
    font-size: 1.45em;
    font-weight: bold;
    background: none !important;
    color: #ffffff !important;
    text-align: center;
    margin-bottom: 1em;
    padding: 0.5em 0 0.7em 0;
    border-radius: 0;
    box-shadow: none;
    text-shadow: 0 2px 8px #fffbe799, 0 1px 2px #0a223a33;
    letter-spacing: 0.01em;
}

/* Barre de recherche, menu déroulant et bouton ajouter sur la même ligne */
.news-feed-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1em;
    margin-bottom: 1.5em;
    margin-top: 0.5em;
    flex-wrap: wrap;
}
.news-feed-toolbar-search {
    flex: 2 1 200px;
    min-width: 140px;
}
.news-feed-toolbar-categories {
    flex: 1 1 120px;
    min-width: 110px;
}
.news-feed-toolbar-add {
    flex: 0 0 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.news-feed-toolbar-add img {
    height: 72px !important;
    width: auto;
    max-width: none;
    cursor: pointer;
    transition: filter 0.2s;
    display: block;
    margin: 0 auto;
}
.news-feed-toolbar-add img:hover {
    filter: brightness(1.15) drop-shadow(0 0 8px #7fd8ff88);
}

/* Boutons like/unlike */
.like-btn, .unlike-btn {
    background: none;
    border: none;
    color: #7fd8ff;
    font-size: 1.1em;
    cursor: pointer;
    margin-left: 0.5em;
    padding: 0 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.like-btn:hover, .unlike-btn:hover {
    background: #0a223a;
}
.like-count {
    color: #b2eaff;
    font-size: 1em;
    margin-left: 0.2em;
}
.like-icon {
    font-size: 1.2em;
    vertical-align: middle;
}

/* Badge "Nouveau" */
.badge-nouveau {
    background: #22334a;
    color: #7fd8ff;
    font-size: 0.85em;
    border-radius: 6px;
    padding: 2px 8px;
    margin-left: 0.7em;
    font-weight: bold;
    border: 1px solid #7fd8ff;
    box-shadow: 0 0 6px #0a223a99;
}

/* Top contribueurs */
.top-users-container {
    background: #1a263a;
    border-radius: 8px;
    padding: 0.7em 1em;
    margin-bottom: 1em;
    display: flex;
    align-items: center;
    gap: 1.5em;
    border: 1px solid #7fd8ff33;
    color: #7fd8ff;
}
.top-user {
    display: flex;
    align-items: center;
    gap: 0.5em;
}
.top-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #22334a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1em;
    color: #7fd8ff;
    overflow: hidden;
    border: 1.5px solid #7fd8ff;
}

/* Commentaires */
.comment-section {
    margin-top: 10px;
    background: #16243a;
    border-radius: 6px;
    padding: 8px 12px;
    border: 1px solid #7fd8ff22;
}
.comment {
    margin-bottom: 6px;
    display: flex;
    align-items: flex-start;
    gap: 0.5em;
}
.comment-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #22334a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95em;
    font-weight: bold;
    color: #7fd8ff;
    overflow: hidden;
    border: 1px solid #7fd8ff;
}
.comment-content {
    background: #1a263a;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.97em;
    color: #b2eaff;
    box-shadow: 0 0 4px #0a223a55;
}
.comment-form textarea {
    width: 100%;
    min-height: 36px;
    resize: vertical;
    background: #22334a;
    color: #b2eaff;
    border: 1px solid #7fd8ff;
    border-radius: 5px;
    font-family: inherit;
    padding: 6px 8px;
}
.comment-form textarea:focus {
    outline: none;
    border-color: #b2eaff;
    box-shadow: 0 0 8px #7fd8ff55;
}
.comment-form button {
    margin-top: 4px;
    background: #22334a;
    color: #7fd8ff;
    border: 1px solid #7fd8ff;
    border-radius: 5px;
    padding: 3px 12px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s, color 0.2s;
}
.comment-form button:hover {
    background: #7fd8ff;
    color: #0a1622;
}
.comment-count {
    color: #7fd8ff;
    font-size: 0.95em;
    margin-left: 0.7em;
}

/* Barre de recherche */
.search-bar-container {
    margin-bottom: 1em;
    display: flex;
    justify-content: flex-end;
}
.search-bar {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #7fd8ff;
    font-size: 1em;
    background: #22334a;
    color: #b2eaff;
}
.search-bar:focus {
    outline: none;
    border-color: #b2eaff;
    box-shadow: 0 0 8px #7fd8ff33;
}
/* Ajoutez dans styles/news_feed.css */
#character-medal-popin {
    transition: opacity 0.15s;
    pointer-events: auto;
}
   /* Styles from ultra_editor.php, adapted for news_feed.php context */
        .editor-toolbar {
            background: #16243a; /* Darker background for toolbar */
            padding: 10px;
            border-radius: 12px 12px 0 0;
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: center;
            border: 1px solid #7fd8ff; /* Added border to match editor */
            border-bottom: none;
        }
        .editor-toolbar button, 
        .editor-toolbar input[type="color"], 
        .editor-toolbar select {
            background: #22334a;
            color: #7fd8ff;
            border: 1px solid #7fd8ff; /* Subtle border for buttons */
            border-radius: 6px;
            padding: 6px 10px;
            font-size: 0.9em; /* Slightly smaller for more buttons */
            cursor: pointer;
        }
        .editor-toolbar button:hover,
        .editor-toolbar input[type="color"]:hover, 
        .editor-toolbar select:hover {
            background: #2a3f58; /* Hover effect */
        }
        .editor-toolbar button.active { background: #7fd8ff; color: #22334a; }
        
        #ultra-editor { /* This is the main contenteditable editor area */
            min-height: 200px; /* Adjusted height */
            background: #101c2b; /* Match previous custom-editor-area background */
            color: #b2eaff;     /* Match previous custom-editor-area text color */
            border-radius: 0 0 12px 12px;
            padding: 20px; /* Adjusted padding */
            font-size: 1.2em; /* Consistent font size */
            outline: none;
            box-shadow: 0 0 8px #7fd8ff22;
            border: 2px solid #7fd8ff; /* Consistent border */
            font-family: 'EB Garamond', serif;
            overflow-y: auto;
        }
        #ultra-editor[contenteditable=true]:empty:before {
            content: attr(data-placeholder);
            color: #6a7e95; 
            font-style: italic;
        }

        .editor-toolbar label { font-size: 0.9em; color: #b2eaff; margin-right: 4px; }
        .editor-toolbar input[type="file"] { display: none; }
        .editor-toolbar .custom-file-label {
            background: #22334a;
            color: #7fd8ff;
            border-radius: 6px;
            padding: 6px 10px;
            cursor: pointer;
            font-size: 0.9em;
            border: 1px solid #7fd8ff;
        }
        .editor-actions { /* For preview button */
            text-align: left; /* Align preview button to the left */
            margin-top: 10px;
        }
        .editor-actions button {
            background: #22334a; /* Consistent button style */
            color: #7fd8ff;
            border: 1px solid #7fd8ff;
            border-radius: 8px;
            padding: 8px 18px;
            font-size: 0.95em;
            cursor: pointer;
        }
        .editor-actions button:hover {
            background: #2a3f58;
        }
        #editor-preview { /* Preview area */
            background: #0d1521; /* Darker background for preview */
            color: #b2eaff;
            border: 1px dashed #7fd8ff; /* Dashed border for distinction */
            border-radius: 8px;
            padding: 18px;
            margin-top: 1em;
            box-shadow: 0 0 8px #7fd8ff22;
            font-family: 'EB Garamond', serif; /* Ensure preview uses same font */
            font-size: 1.2em; /* Match editor font size */
        }
        /* Feedback alerts - already present in news_feed.css or similar, but can be defined here if needed */
        .feedback-alert { padding: 10px; border-radius: 6px; margin-bottom: 1em; }
        .alert-success { background-color: #d4edda; color: #155724; }
        .alert-error { background-color: #f8d7da; color: #721c24; }
  .background-choice-list {
            display: flex;
            gap: 12px;
            margin: 1em 0 1.5em 0;
            flex-wrap: wrap;
        }
        .background-choice-item {
            width: 80px;
            height: 60px;
            border-radius: 10px;
            border: 2px solid #7fd8ff44;
            cursor: pointer;
            background-size: cover;
            background-position: center;
            transition: border 0.2s;
            position: relative;
        }
        .background-choice-item.selected {
            border: 3px solid #1976d2;
            box-shadow: 0 0 8px #1976d2aa;
        }
        .background-choice-item .checkmark {
            position: absolute;
            top: 4px;
            right: 6px;
            background: #1976d2;
            color: #fff;
            border-radius: 50%;
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1em;
            font-weight: bold;
        }
        .editor-format-select {
            margin-bottom: 1em;
            display: flex;
            gap: 1em;
            align-items: center;
        }
        #ultra-editor {
            position: relative;
            background: #16263a;
            border-radius: 12px;
            border: 2px solid #7fd8ff44;
            overflow: hidden;
            margin-bottom: 0;
            /* Taille dynamique via JS */
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            transition: background-image 0.2s;
        }
        .text-zone {
            position: absolute;
            min-width: 60px;
            min-height: 30px;
            background: rgba(255,255,255,0.8);
            border: 1.5px dashed #1976d2;
            border-radius: 6px;
            padding: 4px 8px;
            cursor: move;
            resize: both;
            overflow: visible;
            font-size: 1.1em;
            /* padding-left: 56px;  <-- SUPPRIMER */
        }
        .text-zone.selected {
            border: 2.5px solid #1976d2;
            box-shadow: 0 0 8px #1976d2aa;
            z-index: 100;
        }
        .add-text-zone-btn {
            margin-bottom: 0.5em;
            background: #1976d2;
            color: #fff;
            border: none;
            border-radius: 6px;
            padding: 0.4em 1.2em;
            cursor: pointer;
            font-weight: bold;
        }
        /* Nouvelle toolbar globale à gauche de l'éditeur */
        .global-text-zone-toolbar {
            position: absolute;
            left: -60px;
            top: 0;
            width: 48px;
            min-height: 100px;
            background: #16263a;
            border-radius: 10px 0 0 10px;
            box-shadow: 2px 2px 8px #0003;
            padding: 6px 4px 6px 4px;
            display: flex;
            flex-direction: column;
            gap: 7px;
            z-index: 200;
            border: 2px solid #1976d2;
            border-right: none;
            align-items: center;
            transition: opacity 0.2s;
        }
        .global-text-zone-toolbar.hidden {
            opacity: 0;
            pointer-events: none;
        }
        .global-text-zone-toolbar select,
        .global-text-zone-toolbar input[type="color"] {
            width: 38px;
            height: 26px;
            border-radius: 5px;
            border: 1px solid #7fd8ff;
            background: #22334a;
            color: #b2eaff;
            font-size: 0.95em;
            margin: 0;
            padding: 0 2px;
        }
        .global-text-zone-toolbar input[type="range"] {
            width: 38px;
            margin: 0;
            accent-color: #7fd8ff;
        }
        .global-text-zone-toolbar button {
            background: #1976d2;
            color: #fff;
            border: none;
            border-radius: 5px;
            padding: 0 0;
            font-size: 1.1em;
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background 0.15s;
        }
        .global-text-zone-toolbar button.active,
        .global-text-zone-toolbar button:hover {
            background: #7fd8ff;
            color: #1976d2;
        }
        .fb-feed-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.3em;
    width: 100%;
}

.fb-feed-header-left {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.fb-feed-header-right {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.fb-feed-fullwidth {
    width: 100%;
    padding: 0;
    margin: 0;
}

.fb-feed-bottom-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 0.3em;
    width: 100%;
}

.fb-feed-actions-row {
    display: flex;
    align-items: center;
    gap: 1.2em;
    margin-top: -0.9em;
    margin-bottom: 0.2em;
}

/* Ultra editor view formats */
.ultra-editor-view {
    position: relative;
    width: 100%;
    max-width: 700px;
    margin: 0 auto 1.5em auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 22px;
    border: 3px solid #b2eaff;
    box-shadow: 0 4px 32px #7fd8ff33, 0 0 0 8px #fffbe722 inset;
    background: linear-gradient(135deg, #6ec6f7 0%, #b2eaff 100%);
    padding: 32px;
    aspect-ratio: 16/9;
}

.ultra-editor-view[style*="aspect-ratio:9/16"] {
    max-width: 350px;
    aspect-ratio: 9/16;
    padding: 24px 12px;
    border-width: 1.2px !important; /* Réduit la bordure pour le format 9:16 */
}

.ultra-editor-view[style*="aspect-ratio:9/16"] .fb-feed-text.fb-feed-fullwidth {
    padding-left: 18px;
    padding-right: 18px;
    /* Vous pouvez ajuster la valeur selon le rendu souhaité */
}

/* Optionnel : pour affiner encore plus la bordure sur mobile */
@media (max-width: 700px) {
    .ultra-editor-view[style*="aspect-ratio:9/16"] {
        border-width: 1px !important;
    }
}

/* --- Styles spécifiques pour les posts 9:16 --- */
.fb-feed-card-9x16 {
    max-width: 350px;
    aspect-ratio: 9/16;
    margin: 0 auto 1.5em auto;
    padding: 18px 8px 18px 8px;
    border-radius: 18px;
    border: 2px solid #b2eaff;
    background: linear-gradient(135deg, #6ec6f7 0%, #b2eaff 100%);
    box-shadow: 0 2px 16px #7fd8ff33, 0 0 0 4px #fffbe722 inset;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.fb-feed-card-9x16 .fb-feed-text,
.fb-feed-card-9x16 .fb-feed-text.fb-feed-fullwidth {
    padding-left: 12px;
    padding-right: 12px;
    font-size: 1.08em;
    /* Ajoutez ici d'autres styles spécifiques au texte */
}

.fb-feed-card-9x16 .fb-feed-header,
.fb-feed-card-9x16 .fb-feed-header-row {
    padding-left: 8px;
    padding-right: 8px;
    /* Ajustez selon besoin */
}

.fb-feed-card-9x16 .fb-feed-avatar {
    width: 48px;
    height: 48px;
    top: -24px;
    left: -24px;
    font-size: 1.1em;
    /* Autres ajustements si besoin */
}

/* Responsive pour 9:16 */
@media (max-width: 500px) {
    .fb-feed-card-9x16 {
        max-width: 98vw;
        padding: 8px 2vw;
        border-radius: 10px;
    }
    .fb-feed-card-9x16 .fb-feed-text,
    .fb-feed-card-9x16 .fb-feed-text.fb-feed-fullwidth {
        padding-left: 4vw;
        padding-right: 4vw;
        font-size: 1em;
    }
}

/* --- Fin styles 9:16 --- */

/* Ajout styles pour l'affichage du post formaté */
.ultra-editor-view {
    margin-top: 1em;
    margin-bottom: 1em;
    box-shadow: 0 2px 18px #7fd8ff22;
    border: 2px solid #7fd8ff44;
    background-color: #16263a;
    /* Le background-image est appliqué inline si besoin */
}
.ultra-editor-view .text-zone {
    position: absolute;
    min-width: 60px;
    min-height: 30px;
    background: rgba(255, 255, 255, 0.8);
    border: 1.5px dashed #1976d2;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: default;
    resize: none;
    overflow: auto;
    font-size: 1.1em;
    user-select: text;
    pointer-events: auto;
    contenteditable: false !important; /* <-- Ajouté pour désactiver l'édition */
}
.fb-feed-card {
    background: #101c2b;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 1.5em;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    position: relative;
}
.fb-feed-card-9x16 {
    /* Styles spécifiques pour les cartes 9:16 */
    background: #101c2b;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 1.5em;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}
.fb-feed-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8em;
}
.fb-feed-header-left {
    display: flex;
    align-items: center;
}
.fb-feed-header-right {
    font-size: 0.9em;
    color: #bbb;
}
.fb-feed-text {
    color: #e0e0e0;
    font-size: 1.1em;
    line-height: 1.4;
    margin-bottom: 1em;
}
.fb-feed-fullwidth {
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
}
.fb-feed-bottom-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 0.5em;
    font-size: 0.9em;
    color: #bbb;
}
.post-views {
    display: flex;
    align-items: center;
}
.post-views img {
    height: 18px;
    width: auto;
    margin-right: 4px;
    opacity: 0.7;
}

.text-zone {
    position: absolute;
    border: 1px dashed #ccc;
    padding: 5px;
    background-color: rgba(255, 255, 255, 0.8);
    min-width: 50px; /* Empêche la zone d'être trop petite */
    min-height: 20px; /* Empêche la zone d'être trop petite */
    box-sizing: border-box; /* Important pour le calcul de la taille */
}
.text-zone.selected {
    border: 2px solid #1976d2;
    box-shadow: 0 0 5px rgba(25, 118, 210, 0.7);
}
.text-zone-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background-color: #1976d2;
    cursor: nwse-resize;
    display: none; /* Caché par défaut */
}
.text-zone.selected .text-zone-resize-handle {
    display: block; /* Visible quand la zone est sélectionnée */
}

/* Styles for Story Modal */
#story-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Allow scroll if content somehow overflows viewport */
    background-color: rgba(0,0,0,0.85);
    display: flex; /* Used by JS to show modal, enables centering */
    align-items: center;
    justify-content: center;
    padding: 10px; /* Reduced padding to allow content to be larger */
    box-sizing: border-box;
}

#story-modal-content-wrapper {
    position: relative; /* For positioning the close button */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: auto; /* Shrink-wrap content or expand up to max */
    height: auto; /* Shrink-wrap content or expand up to max */
    max-width: 100%; /* Ensure it doesn't exceed modal padding */
    max-height: 100%; /* Ensure it doesn't exceed modal padding */
}

#story-modal-body {
    background-color: transparent;
    padding: 0;
    border: 0;
    display: flex; /* To center the .story-full-view */
    align-items: center;
    justify-content: center;
    width: auto; /* Let content dictate size up to max */
    height: auto; /* Let content dictate size up to max */
    max-width: 100%; /* Takes full available space from parent */
    max-height: 100%; /* Takes full available space from parent */
}

.close-story-modal {
    position: absolute;
    top: -10px; /* Adjust to be outside the main content, relative to wrapper */
    right: -5px;  /* Adjust to be outside the main content, relative to wrapper */
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001; /* Above other modal content */
    line-height: 1;
}

.story-full-view {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* max-width/max-height ensure the entire component (header + content area) fits */
    /* These values should be large enough to contain the JS calculated sizes */
    max-width: 98vw; 
    max-height: 98vh; 
    padding: 5px; /* Minimal padding within the full view itself */
    box-sizing: border-box;
}

.story-header-modal {
    position: absolute; /* Positioned relative to story-full-view */
    top: 10px; /* Adjusted for reduced padding */
    left: 10px; /* Adjusted for reduced padding */
    z-index: 10; /* Above story-content-area's background */
    display: flex;
    align-items: center;
    background-color: rgba(0,0,0,0.6);
    padding: 6px 12px;
    border-radius: 20px;
}

.story-header-modal img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
    border: 1.5px solid #fff;
}

.story-header-modal .story-author-name {
    font-weight: bold;
    color: white;
    font-size: 0.95em;
}

.story-content-area {
    /* Styles like position, overflow, border-radius, aspect-ratio,
       width, height, max-width, max-height, background are set inline by JS */
    display: block; /* Ensure it behaves as a block for sizing */
}

/* --- Uniformisation de la taille des stories en modal --- */
.story-content-area,
.ultra-editor-view-9x16 {
    width: 392px !important;
    height: 696px !important;
    max-width: 392px !important;
    max-height: 696px !important;
    aspect-ratio: 9/16 !important;
    padding: 0 !important;
    margin: 0 auto !important;
    box-sizing: border-box;
    display: block;
}

/* Pour mobile : la story prend toute la largeur, hauteur auto pour garder le ratio */
@media (max-width: 420px) {
    .story-content-area,
    .ultra-editor-view-9x16 {
        width: 98vw !important;
        height: calc(98vw * 16 / 9) !important;
        max-width: 98vw !important;
        max-height: calc(98vw * 16 / 9) !important;
    }
}

.story-content-area .text-zone {
    /* Ensure text zones are not editable and are displayed as intended */
    /* pointer-events: none; /* Uncomment if text zones should not be interactive at all */
    user-select: text; /* Allow text selection if desired */
    cursor: default;
}

/* Ensure ultra-editor specific styles for 9x16 format are applied if needed */
.ultra-editor-view-9x16 {
    /* Any specific overrides for 9x16 view if not handled by inline styles */
}

/* --- Stories Instagram-like carousel --- */
.stories-carousel {
    display: flex;
    flex-direction: row;
    gap: 18px;
    padding: 18px 0 18px 0;
    overflow-x: auto;
    background: rgba(10, 20, 45, 0.92);
    border-radius: 18px;
    margin: 0 auto 24px auto;
    max-width: 700px;
    scrollbar-width: thin;
    scrollbar-color: #7fd8ff #16243a;
}
.stories-carousel::-webkit-scrollbar {
    height: 7px;
    background: #16243a;
}
.stories-carousel::-webkit-scrollbar-thumb {
    background: #7fd8ff;
    border-radius: 8px;
}

.story-avatar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
    min-width: 70px;
}

.story-avatar {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: 3px solid #7fd8ff;
    box-shadow: 0 0 12px #7fd8ff55;
    object-fit: cover;
    background: #22334a;
    transition: border-color 0.18s, box-shadow 0.18s;
}
.story-avatar-wrapper:hover .story-avatar {
    border-color: #b2eaff;
    box-shadow: 0 0 18px #b2eaff99;
}
.story-avatar.unseen {
    border-color: #ffb300;
    box-shadow: 0 0 18px #ffb30099;
}
.story-username {
    margin-top: 6px;
    font-size: 0.98em;
    color: #b2eaff;
    text-align: center;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Indicateur story non vue (petit rond) */
.story-avatar-wrapper .story-unseen-dot {
    position: absolute;
    bottom: 10px;
    right: 12px;
    width: 13px;
    height: 13px;
    background: #ffb300;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 6px #ffb30099;
    display: block;
}

/* Responsive carousel */
@media (max-width: 800px) {
    .stories-carousel {
        max-width: 98vw;
        padding-left: 4vw;
        padding-right: 4vw;
    }
}