/* ============================================
   NEWS FEED - MODERN REDESIGN 2025
   ============================================ */

/* === Variables CSS === */
:root {
    --nf-primary: #667eea;
    --nf-primary-dark: #5a67d8;
    --nf-secondary: #764ba2;
    --nf-accent: #7fd8ff;
    --nf-accent-light: #b2eaff;
    --nf-bg-dark: #0f0c29;
    --nf-bg-medium: #1a1a2e;
    --nf-bg-card: rgba(15, 23, 42, 0.95);
    --nf-text-primary: #f8fafc;
    --nf-text-secondary: #94a3b8;
    --nf-text-muted: #64748b;
    --nf-border: rgba(127, 216, 255, 0.15);
    --nf-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    --nf-shadow-glow: 0 0 30px rgba(102, 126, 234, 0.15);
    --nf-radius: 16px;
    --nf-radius-lg: 24px;
    --nf-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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: var(--nf-bg-dark);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--nf-text-primary);
    line-height: 1.6;
}

/* === Titre principal === */
.news-feed-title {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.news-feed-title img {
    filter: drop-shadow(0 0 20px rgba(127, 216, 255, 0.4));
    transition: var(--nf-transition);
}

.news-feed-title img:hover {
    filter: drop-shadow(0 0 30px rgba(127, 216, 255, 0.6));
    transform: scale(1.02);
}

/* === RESPONSIVE MOBILE - NEWS FEED === */
@media (max-width: 767px) {
    .news-feed-title {
        margin-bottom: 1rem;
    }

    .news-feed-title img {
        height: 280px !important;
    }

    .news-feed-actions {
        flex-direction: column;
        gap: 0.5em;
    }

    .btn-return-home-admin {
        width: 100%;
        max-width: 280px;
        font-size: 0.9rem;
        padding: 12px 20px;
    }

    .news-feed-section {
        padding: 1rem;
        border-radius: var(--nf-radius);
    }

    /* Toolbar responsive */
    .news-feed-toolbar {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1.5rem;
        padding: 1rem;
    }

    .news-feed-toolbar-search,
    .news-feed-toolbar-categories {
        width: 100%;
        flex: 1 1 100%;
        min-width: 100%;
    }

    .news-feed-toolbar-add {
        width: 100%;
        justify-content: center;
    }

    .news-feed-toolbar-add img {
        height: 56px !important;
    }

    /* Cards FB/Posts */
    .fb-feed-card {
        padding: 1.25rem;
        margin-bottom: 1rem;
        flex-direction: column;
        gap: 0.75rem;
        border-radius: var(--nf-radius);
    }

    .fb-feed-avatar {
        width: 48px;
        height: 48px;
        top: -24px;
        left: -24px;
        font-size: 1.3em;
    }

    .fb-feed-content {
        margin-top: 8px;
    }

    .fb-feed-author {
        font-size: 1.1em;
        margin-left: 0.3em;
    }

    .fb-feed-date {
        font-size: 0.8em;
    }

    .fb-feed-text {
        font-size: 0.95em;
    }

    /* Form card */
    .fb-feed-form-card {
        padding: 1rem;
        border-radius: var(--nf-radius);
    }

    .fb-feed-form-card textarea {
        font-size: 1em;
        min-height: 80px;
    }

    /* Toolbar de l'éditeur */
    .editor-toolbar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px;
        border-radius: var(--nf-radius) var(--nf-radius) 0 0;
    }

    .editor-toolbar button,
    .editor-toolbar select {
        padding: 10px 12px;
        min-height: 42px;
        font-size: 0.85em;
    }

    #ultra-editor {
        min-height: 200px;
        padding: 16px;
        font-size: 1em;
    }

    /* Ultra editor view */
    .ultra-editor-view {
        max-width: 100%;
        padding: 20px 16px;
        border-radius: var(--nf-radius);
    }

    /* Commentaires */
    .comment-section {
        padding: 12px;
        border-radius: 12px;
    }

    .comment-form textarea {
        min-height: 48px;
        font-size: 0.9em;
    }

    .comment-form button {
        min-height: 42px;
    }

    /* Stories carousel */
    .stories-carousel {
        gap: 14px;
        padding: 14px 12px;
    }

    .story-avatar {
        width: 56px;
        height: 56px;
    }

    .story-avatar-wrapper {
        min-width: 64px;
    }

    .story-username {
        font-size: 0.8em;
        max-width: 64px;
    }
}

@media (max-width: 480px) {
    .news-feed-title img {
        height: 200px !important;
    }

    .fb-feed-avatar {
        width: 42px;
        height: 42px;
        top: -21px;
        left: -21px;
        font-size: 1.1em;
    }

    .fb-feed-author {
        font-size: 1em;
    }

    .editor-toolbar button,
    .editor-toolbar select {
        padding: 8px 10px;
        min-height: 38px;
        font-size: 0.8em;
    }

    .like-btn,
    .unlike-btn {
        font-size: 1em;
        padding: 6px 10px;
        border-radius: 8px;
    }
}

/* === Actions principales === */
.news-feed-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn-return-home-admin {
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    border: none;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: var(--nf-shadow);
    transition: var(--nf-transition);
    text-decoration: none;
    padding: 12px 28px;
}

.btn-return-home-admin:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
    color: white;
}

/* === Section principale & Cards === */
.news-feed-section,
.fb-feed-form-card,
.fb-feed-card {
    background: var(--nf-bg-card);
    border-radius: var(--nf-radius);
    border: 1px solid var(--nf-border);
    box-shadow: var(--nf-shadow);
    color: var(--nf-text-primary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.news-feed-section {
    padding: 2rem;
    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.5rem auto;
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.news-feed-category-select {
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid var(--nf-border);
    background: var(--nf-bg-card);
    color: var(--nf-accent-light);
    font-size: 1rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: var(--nf-transition);
    backdrop-filter: blur(10px);
}

.news-feed-category-select:focus {
    border-color: var(--nf-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    outline: none;
}

.news-feed-category-select:hover {
    border-color: var(--nf-accent);
}

/* === Cards façon moderne === */
.fb-feed-card {
    margin-bottom: 0;
    padding: 1.5rem;
    display: flex;
    flex-direction: row;
    gap: 1rem;
    position: relative;
    overflow: visible;
    max-width: 700px;
    margin: 0 auto;
    transition: var(--nf-transition);
}

.fb-feed-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--nf-shadow), var(--nf-shadow-glow);
    border-color: rgba(127, 216, 255, 0.3);
}

.fb-feed-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    color: white;
    font-weight: 700;
    font-size: 1.8em;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    border: 3px solid var(--nf-accent);
    position: absolute;
    top: -32px;
    left: -32px;
    z-index: 2;
    overflow: hidden;
    transition: var(--nf-transition);
}

.fb-feed-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.5);
}

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

.fb-feed-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.fb-feed-author {
    font-weight: 700;
    color: var(--nf-accent-light);
    font-size: 1.35em;
    margin-bottom: 0;
    margin-left: 0.5em;
    transition: var(--nf-transition);
}

.fb-feed-author:hover {
    color: var(--nf-accent);
}

.fb-feed-date {
    color: var(--nf-text-muted);
    font-size: 0.9em;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.fb-feed-type {
    font-size: 0.85em;
    color: white;
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    border-radius: 20px;
    padding: 4px 14px;
    margin-left: 0.5em;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.fb-feed-text {
    color: var(--nf-text-primary);
    font-size: 1.05em;
    margin-bottom: 0.5rem;
    word-break: break-word;
    line-height: 1.7;
}

/* === Formulaire de post === */
.fb-feed-form-card {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 1px solid var(--nf-border);
}

.fb-feed-form-card textarea {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--nf-border);
    background: rgba(30, 41, 59, 0.8);
    color: var(--nf-text-primary);
    padding: 14px;
    font-size: 1rem;
    margin-bottom: 1rem;
    resize: vertical;
    font-family: inherit;
    transition: var(--nf-transition);
}

.fb-feed-form-card textarea:focus {
    outline: none;
    border-color: var(--nf-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.fb-feed-form-card textarea::placeholder {
    color: var(--nf-text-muted);
}

.fb-feed-form-card button {
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--nf-transition);
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.fb-feed-form-card button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.fb-feed-form-card .feedback-alert {
    margin-bottom: 1rem;
    border-radius: 12px;
}

/* === Listes et items === */
.news-feed-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.news-feed-item {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    background: var(--nf-bg-card);
    border-radius: var(--nf-radius);
    box-shadow: var(--nf-shadow);
    margin-bottom: 1rem;
    padding: 1.25rem;
    transition: var(--nf-transition);
    border-left: 4px solid var(--nf-primary);
    border: 1px solid var(--nf-border);
}

.news-feed-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--nf-shadow), var(--nf-shadow-glow);
    border-left-color: var(--nf-accent);
}

.news-feed-date {
    min-width: 100px;
    color: var(--nf-accent);
    font-weight: 600;
    font-size: 0.95em;
    font-family: 'JetBrains Mono', monospace;
}

.news-feed-event {
    flex: 1;
    color: var(--nf-text-primary);
    font-size: 1rem;
    line-height: 1.6;
    word-break: break-word;
}

.news-feed-item-category {
    font-size: 0.85em;
    color: white;
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    border-radius: 20px;
    padding: 4px 12px;
    margin-bottom: 8px;
    display: inline-block;
    font-weight: 500;
}

.news-feed-empty {
    text-align: center;
    color: var(--nf-text-secondary);
    font-size: 1.2em;
    margin: 3rem 0;
    padding: 2rem;
    background: var(--nf-bg-card);
    border-radius: var(--nf-radius);
    border: 1px dashed var(--nf-border);
}

/* === Citation du jour === */
.news-feed-quote-of-day {
    font-size: 1.25rem;
    font-weight: 500;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%) !important;
    color: var(--nf-text-primary) !important;
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    border-radius: var(--nf-radius);
    border: 1px solid var(--nf-border);
    backdrop-filter: blur(10px);
    line-height: 1.7;
    font-style: italic;
}

/* === Barre d'outils === */
.news-feed-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    background: var(--nf-bg-card);
    padding: 1rem 1.25rem;
    border-radius: var(--nf-radius);
    border: 1px solid var(--nf-border);
    box-shadow: var(--nf-shadow);
}

.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 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-feed-toolbar-add img {
    height: 64px !important;
    width: auto;
    max-width: none;
    cursor: pointer;
    transition: var(--nf-transition);
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 4px 12px rgba(102, 126, 234, 0.3));
}

.news-feed-toolbar-add img:hover {
    filter: brightness(1.1) drop-shadow(0 8px 20px rgba(102, 126, 234, 0.5));
    transform: scale(1.08);
}

/* === Boutons like/unlike === */
.like-btn, .unlike-btn {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid var(--nf-border);
    color: var(--nf-accent);
    font-size: 1rem;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 20px;
    transition: var(--nf-transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.like-btn:hover, .unlike-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: var(--nf-primary);
    transform: scale(1.05);
}

.like-count {
    color: var(--nf-accent-light);
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
}

.like-icon {
    font-size: 1.3em;
    vertical-align: middle;
}

.like-img-btn {
    transition: var(--nf-transition);
}

.like-img-btn:hover {
    transform: scale(1.15);
    filter: drop-shadow(0 0 8px rgba(255, 107, 107, 0.5));
}

/* === Badge "Nouveau" === */
.badge-nouveau {
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    color: white;
    font-size: 0.75em;
    border-radius: 20px;
    padding: 3px 10px;
    margin-left: 0.5em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* === Top contribueurs === */
.top-users-container {
    background: var(--nf-bg-card);
    border-radius: var(--nf-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    border: 1px solid var(--nf-border);
    color: var(--nf-accent);
    backdrop-filter: blur(10px);
}

.top-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.top-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: white;
    overflow: hidden;
    border: 2px solid var(--nf-accent);
}

/* === Commentaires === */
.comment-section {
    margin-top: 1rem;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid var(--nf-border);
}

.comment {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: 700;
    color: white;
    overflow: hidden;
    border: 2px solid var(--nf-accent);
    flex-shrink: 0;
}

.comment-content {
    background: var(--nf-bg-card);
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 0.95em;
    color: var(--nf-text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--nf-border);
}

.comment-form textarea {
    width: 100%;
    min-height: 48px;
    resize: vertical;
    background: rgba(30, 41, 59, 0.8);
    color: var(--nf-text-primary);
    border: 1px solid var(--nf-border);
    border-radius: 12px;
    font-family: inherit;
    padding: 10px 14px;
    transition: var(--nf-transition);
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--nf-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.comment-form textarea::placeholder {
    color: var(--nf-text-muted);
}

.comment-form button {
    margin-top: 8px;
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 8px 18px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--nf-transition);
}

.comment-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.comment-count {
    color: var(--nf-accent);
    font-size: 0.95em;
    margin-left: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* === Barre de recherche === */
.search-bar-container {
    margin-bottom: 1rem;
    display: flex;
    justify-content: flex-end;
}

.search-bar {
    padding: 10px 16px;
    border-radius: 25px;
    border: 1px solid var(--nf-border);
    font-size: 1rem;
    background: rgba(30, 41, 59, 0.8);
    color: var(--nf-text-primary);
    transition: var(--nf-transition);
    width: 100%;
}

.search-bar:focus {
    outline: none;
    border-color: var(--nf-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.search-bar::placeholder {
    color: var(--nf-text-muted);
}

/* === Medal fiche personnage === */
#character-medal-popin {
    transition: opacity 0.2s ease-out;
    pointer-events: auto;
    background: var(--nf-bg-card);
    border-radius: var(--nf-radius);
    border: 1px solid var(--nf-border);
    box-shadow: var(--nf-shadow);
}
/* === Éditeur - Styles modernisés === */
.editor-toolbar {
    background: var(--nf-bg-card);
    padding: 12px 16px;
    border-radius: var(--nf-radius) var(--nf-radius) 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--nf-border);
    border-bottom: none;
    backdrop-filter: blur(10px);
}

.editor-toolbar button, 
.editor-toolbar input[type="color"], 
.editor-toolbar select {
    background: rgba(30, 41, 59, 0.8);
    color: var(--nf-accent);
    border: 1px solid var(--nf-border);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 0.9em;
    cursor: pointer;
    transition: var(--nf-transition);
}

.editor-toolbar button:hover,
.editor-toolbar input[type="color"]:hover, 
.editor-toolbar select:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: var(--nf-primary);
}

.editor-toolbar button.active { 
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    color: white;
    border-color: transparent;
}

#ultra-editor {
    min-height: 220px;
    background: rgba(15, 23, 42, 0.9);
    color: var(--nf-text-primary);
    border-radius: 0 0 var(--nf-radius) var(--nf-radius);
    padding: 24px;
    font-size: 1.1em;
    outline: none;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--nf-border);
    border-top: none;
    font-family: inherit;
    overflow-y: auto;
}

#ultra-editor[contenteditable=true]:empty:before {
    content: attr(data-placeholder);
    color: var(--nf-text-muted);
    font-style: italic;
}

.editor-toolbar label { 
    font-size: 0.9em; 
    color: var(--nf-text-secondary); 
    margin-right: 6px;
}

.editor-toolbar input[type="file"] { display: none; }

.editor-toolbar .custom-file-label {
    background: rgba(30, 41, 59, 0.8);
    color: var(--nf-accent);
    border-radius: 10px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.9em;
    border: 1px solid var(--nf-border);
    transition: var(--nf-transition);
}

.editor-toolbar .custom-file-label:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: var(--nf-primary);
}

.editor-actions {
    text-align: left;
    margin-top: 12px;
}

.editor-actions button {
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 10px 24px;
    font-size: 0.95em;
    cursor: pointer;
    font-weight: 600;
    transition: var(--nf-transition);
}

.editor-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

#editor-preview {
    background: var(--nf-bg-card);
    color: var(--nf-text-primary);
    border: 1px dashed var(--nf-border);
    border-radius: var(--nf-radius);
    padding: 20px;
    margin-top: 1.5rem;
    box-shadow: var(--nf-shadow);
    font-family: inherit;
    font-size: 1.1em;
}

/* Feedback alerts */
.feedback-alert { 
    padding: 12px 16px; 
    border-radius: 12px; 
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert-success { 
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(22, 163, 74, 0.15) 100%);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.alert-error { 
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.15) 100%);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
/* === Choix de fond === */
.background-choice-list {
    display: flex;
    gap: 14px;
    margin: 1.25rem 0 1.75rem 0;
    flex-wrap: wrap;
}

.background-choice-item {
    width: 90px;
    height: 68px;
    border-radius: 12px;
    border: 2px solid var(--nf-border);
    cursor: pointer;
    background-size: cover;
    background-position: center;
    transition: var(--nf-transition);
    position: relative;
    overflow: hidden;
}

.background-choice-item:hover {
    transform: scale(1.05);
    border-color: var(--nf-accent);
}

.background-choice-item.selected {
    border: 3px solid var(--nf-primary);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

.background-choice-item .checkmark {
    position: absolute;
    top: 6px;
    right: 8px;
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.editor-format-select {
    margin-bottom: 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

#ultra-editor {
    position: relative;
    background: rgba(15, 23, 42, 0.95);
    border-radius: var(--nf-radius);
    border: 1px solid var(--nf-border);
    overflow: hidden;
    margin-bottom: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: var(--nf-transition);
}

/* === Zones de texte === */
.text-zone {
    position: absolute;
    min-width: 60px;
    min-height: 30px;
    background: rgba(255, 255, 255, 0.92);
    border: 2px dashed var(--nf-primary);
    border-radius: 10px;
    padding: 8px 12px;
    cursor: move;
    resize: both;
    overflow: visible;
    font-size: 1.1em;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.text-zone.selected {
    border: 2px solid var(--nf-primary);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
    z-index: 100;
}

.add-text-zone-btn {
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--nf-transition);
}

.add-text-zone-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* === Toolbar globale à gauche === */
.global-text-zone-toolbar {
    position: absolute;
    left: -65px;
    top: 0;
    width: 52px;
    min-height: 120px;
    background: var(--nf-bg-card);
    border-radius: var(--nf-radius) 0 0 var(--nf-radius);
    box-shadow: var(--nf-shadow);
    padding: 10px 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 200;
    border: 1px solid var(--nf-border);
    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: 40px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--nf-border);
    background: rgba(30, 41, 59, 0.8);
    color: var(--nf-accent);
    font-size: 0.9em;
    margin: 0;
    padding: 0 4px;
}

.global-text-zone-toolbar input[type="range"] {
    width: 40px;
    margin: 0;
    accent-color: var(--nf-primary);
}

.global-text-zone-toolbar button {
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0;
    font-size: 1rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--nf-transition);
}

.global-text-zone-toolbar button.active,
.global-text-zone-toolbar button:hover {
    background: var(--nf-accent);
    color: var(--nf-bg-dark);
    transform: scale(1.05);
}
/* === Header Row Feed === */
.fb-feed-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    width: 100%;
}

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

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

.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.5rem;
    width: 100%;
}

.fb-feed-actions-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--nf-border);
}

/* === Ultra editor view formats === */
.ultra-editor-view {
    position: relative;
    width: 100%;
    max-width: 700px;
    margin: 1rem auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: var(--nf-radius-lg);
    border: 2px solid var(--nf-border);
    box-shadow: var(--nf-shadow);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 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: 1px !important;
}

.ultra-editor-view[style*="aspect-ratio:9/16"] .fb-feed-text.fb-feed-fullwidth {
    padding-left: 18px;
    padding-right: 18px;
}

@media (max-width: 700px) {
    .ultra-editor-view[style*="aspect-ratio:9/16"] {
        border-width: 1px !important;
    }
}

/* === Styles pour posts 9:16 === */
.fb-feed-card-9x16 {
    max-width: 350px;
    aspect-ratio: 9/16;
    margin: 0 auto 1.5rem auto;
    padding: 18px 12px;
    border-radius: var(--nf-radius-lg);
    border: 1px solid var(--nf-border);
    background: var(--nf-bg-card);
    box-shadow: var(--nf-shadow);
    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: 1em;
}

.fb-feed-card-9x16 .fb-feed-header,
.fb-feed-card-9x16 .fb-feed-header-row {
    padding-left: 8px;
    padding-right: 8px;
}

.fb-feed-card-9x16 .fb-feed-avatar {
    width: 48px;
    height: 48px;
    top: -24px;
    left: -24px;
    font-size: 1.1em;
}

@media (max-width: 500px) {
    .fb-feed-card-9x16 {
        max-width: 98vw;
        padding: 10px 3vw;
        border-radius: var(--nf-radius);
    }
    
    .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: 0.95em;
    }
}

/* === Affichage du post formaté === */
.ultra-editor-view {
    margin-top: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--nf-shadow);
    border: 1px solid var(--nf-border);
    background-color: var(--nf-bg-card);
}

.ultra-editor-view .text-zone {
    position: absolute;
    min-width: 60px;
    min-height: 30px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px dashed var(--nf-primary);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: default;
    resize: none;
    overflow: auto;
    font-size: 1.05em;
    user-select: text;
    pointer-events: auto;
}

.fb-feed-card {
    background: var(--nf-bg-card);
    border-radius: var(--nf-radius);
    padding: 1.25rem;
    margin-bottom: 0;
    box-shadow: var(--nf-shadow);
    position: relative;
    border: 1px solid var(--nf-border);
    transition: var(--nf-transition);
}

.fb-feed-card-9x16 {
    background: var(--nf-bg-card);
    border-radius: var(--nf-radius);
    padding: 1.25rem;
    margin-bottom: 0;
    box-shadow: var(--nf-shadow);
    position: relative;
    border: 1px solid var(--nf-border);
    overflow: hidden;
}

/* === Header Row (suite) === */
.fb-feed-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

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

.fb-feed-header-right {
    font-size: 0.85em;
    color: var(--nf-text-muted);
}

.fb-feed-text {
    color: var(--nf-text-primary);
    font-size: 1.05em;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.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.5rem;
    font-size: 0.9em;
    color: var(--nf-text-muted);
}

.post-views {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--nf-text-secondary);
}

.post-views img {
    height: 18px;
    width: auto;
    opacity: 0.7;
}

/* === Zones de texte (suite) === */
.text-zone {
    position: absolute;
    border: 1px dashed var(--nf-border);
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.92);
    min-width: 50px;
    min-height: 20px;
    box-sizing: border-box;
    border-radius: 8px;
}

.text-zone.selected {
    border: 2px solid var(--nf-primary);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
}

.text-zone-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    cursor: nwse-resize;
    display: none;
    border-radius: 3px;
}

.text-zone.selected .text-zone-resize-handle {
    display: block;
}

/* === Modal Story === */
#story-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
    backdrop-filter: blur(10px);
}

#story-modal-content-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

#story-modal-body {
    background-color: transparent;
    padding: 0;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

.close-story-modal {
    position: absolute;
    top: -15px;
    right: -10px;
    color: white;
    font-size: 2.5rem;
    font-weight: 300;
    cursor: pointer;
    z-index: 10001;
    line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    transition: var(--nf-transition);
}

.close-story-modal:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.story-full-view {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 98vw;
    max-height: 98vh;
    padding: 5px;
    box-sizing: border-box;
}

.story-header-modal {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.story-header-modal img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
    border: 2px solid white;
}

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

.story-content-area {
    display: block;
    border-radius: var(--nf-radius);
    overflow: hidden;
}

/* === Taille uniforme 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;
    border-radius: var(--nf-radius-lg);
}

@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 {
    user-select: text;
    cursor: default;
}

/* === Carrousel Stories façon Instagram === */
.stories-carousel {
    display: flex;
    flex-direction: row;
    gap: 20px;
    padding: 20px 16px;
    overflow-x: auto;
    background: var(--nf-bg-card);
    border-radius: var(--nf-radius-lg);
    margin: 0 auto 1.5rem auto;
    max-width: 700px;
    border: 1px solid var(--nf-border);
    box-shadow: var(--nf-shadow);
    scrollbar-width: thin;
    scrollbar-color: var(--nf-primary) rgba(30, 41, 59, 0.5);
}

.stories-carousel::-webkit-scrollbar {
    height: 6px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 3px;
}

.stories-carousel::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--nf-primary) 0%, var(--nf-secondary) 100%);
    border-radius: 3px;
}

.story-avatar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
    min-width: 72px;
    transition: var(--nf-transition);
}

.story-avatar-wrapper:hover {
    transform: scale(1.05);
}

.story-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid var(--nf-primary);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    object-fit: cover;
    background: var(--nf-bg-card);
    transition: var(--nf-transition);
}

.story-avatar-wrapper:hover .story-avatar {
    border-color: var(--nf-accent);
    box-shadow: 0 6px 25px rgba(127, 216, 255, 0.4);
}

.story-avatar.unseen {
    border-color: #f59e0b;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
}

.story-username {
    margin-top: 8px;
    font-size: 0.85em;
    color: var(--nf-text-secondary);
    text-align: center;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

/* Indicateur story non vue */
.story-avatar-wrapper .story-unseen-dot {
    position: absolute;
    bottom: 28px;
    right: 8px;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    border-radius: 50%;
    border: 2px solid var(--nf-bg-card);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.5);
    display: block;
}

/* === Responsive Carousel === */
@media (max-width: 800px) {
    .stories-carousel {
        max-width: 98vw;
        padding: 16px;
        border-radius: var(--nf-radius);
    }
}

/* === Animations et effets === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fb-feed-card {
    animation: fadeIn 0.4s ease-out;
}

/* === Lien auteur === */
.fb-author-link {
    color: inherit;
    text-decoration: none;
}

.fb-author-link:hover .fb-feed-author {
    color: var(--nf-accent);
}

/* === Login prompt === */
.feedback-login-prompt {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 1px solid var(--nf-border);
    border-radius: var(--nf-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    color: var(--nf-text-secondary);
}

.feedback-login-prompt a {
    color: var(--nf-primary);
    font-weight: 600;
    text-decoration: none;
    transition: var(--nf-transition);
}

.feedback-login-prompt a:hover {
    color: var(--nf-accent);
    text-decoration: underline;
}

/* === Résultats de recherche === */
.scenario-search-results,
.user-search-results {
    margin: 1.5rem 0 2rem 0;
}

.scenario-search-results h3,
.user-search-results h3 {
    color: var(--nf-accent-light);
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.scenario-search-card,
.user-search-card {
    background: var(--nf-bg-card);
    border-radius: var(--nf-radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--nf-shadow);
    border: 1px solid var(--nf-border);
    transition: var(--nf-transition);
}

.scenario-search-card:hover,
.user-search-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--nf-shadow), var(--nf-shadow-glow);
}

/* === Container Stories (section en haut) === */
.stories-container {
    background: var(--nf-bg-card) !important;
    border-radius: var(--nf-radius-lg) !important;
    border: 1px solid var(--nf-border) !important;
    box-shadow: var(--nf-shadow) !important;
    padding: 16px !important;
    margin-bottom: 1.5rem !important;
}

.story-preview {
    border-radius: var(--nf-radius) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
    transition: var(--nf-transition) !important;
}

.story-preview:hover {
    transform: scale(1.03) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
}