/* ─── BANDEAU DE PRÉSENCE TEMPS RÉEL (OFFER) ──────────────────────────────── */

.presence-banner-wrapper {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    margin-bottom: 1.25rem;
}

.presence-banner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
    padding: 0 2px;
}

.presence-banner-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #e5e7eb;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.presence-pulse-icon {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: presencePulseIcon 2s infinite ease-in-out;
}

@keyframes presencePulseIcon {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.presence-legend {
    font-size: 0.72rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 12px;
}

.presence-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.presence-legend .presence-badge {
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    display: inline-flex !important;
    width: 12px;
    height: 12px;
    margin: 0;
    flex-shrink: 0;
}

/* ─── CONTENEURS D'AVATARS SÉCURISÉS EN POSITION RELATIVE ──────────────────── */
.presence-avatar-wrapper,
.conv-avatar-wrapper,
.chat-header-avatar-wrapper {
    position: relative !important;
}

/* ─── PISTE DE DÉFILEMENT HORIZONTAL NATIF FLUIDE ────────────────────────── */

.presence-banner-track {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 8px 2px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE / Edge */
}

.presence-banner-track::-webkit-scrollbar {
    display: none; /* Chrome / Safari / Opera */
}

/* ─── CARTE ÉLÉMENT PROFIL ────────────────────────────────────────────────── */

.presence-profile-item {
    flex: 0 0 auto;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    width: 72px;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.presence-profile-item:hover,
.presence-profile-item:focus-visible {
    transform: translateY(-3px);
    outline: none;
}

.presence-avatar-wrapper {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    padding: 2px;
    background: transparent;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.presence-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background-color: #1f2937;
    border: 2px solid #374151;
    display: block;
}

/* ─── ANNEAUX DE STORIES ÉPHÉMÈRES (COHABITATION STYLE INSTAGRAM) ─────────── */

/* Story non consultée : anneau avec dégradé vif et lueur dynamique */
.presence-avatar-wrapper.story-unseen {
    background: linear-gradient(45deg, #f59e0b 0%, #ec4899 50%, #8b5cf6 100%);
    padding: 3px;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.45);
}

.presence-avatar-wrapper.story-unseen .presence-avatar-img {
    border: 2px solid #111827; /* contour intérieur isolant l'image du dégradé */
}

/* Story déjà consultée : anneau gris discret */
.presence-avatar-wrapper.story-seen {
    background: #6b7280;
    padding: 3px;
}

.presence-avatar-wrapper.story-seen .presence-avatar-img {
    border: 2px solid #111827;
}

/* ─── PASTILLES DE STATUT & ACCESSIBILITÉ DALTONISME ─────────────────────── */

.presence-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2.5px solid #111827; /* Découpe nette sur l'anneau */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    z-index: 5; /* Toujours au-dessus de l'anneau de story */
}

/* 🟢 EN_LIGNE : Rond vert avec point plein blanc central */
.presence-badge.badge-online {
    background-color: #22c55e;
}
.presence-badge.badge-online::after {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #ffffff;
}

/* 🟡 VIENT_DE_SE_DECONNECTER (Absent) : Rond jaune avec barre horizontale */
.presence-badge.badge-away {
    background-color: #eab308;
}
.presence-badge.badge-away::after {
    content: '';
    width: 6px;
    height: 2px;
    background-color: #000000;
    border-radius: 1px;
}

/* 🔴 HORS_LIGNE : Rond rouge avec anneau creux */
.presence-badge.badge-offline {
    background-color: #ef4444;
}
.presence-badge.badge-offline::after {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    border: 1px solid #ffffff;
    background-color: transparent;
}

/* ─── PSEUDO ET SOUS-TITRE DU PROFIL ─────────────────────────────────────── */

.presence-profile-name {
    font-size: 0.74rem;
    font-weight: 600;
    color: #f3f4f6;
    margin-top: 5px;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.presence-profile-status-text {
    font-size: 0.65rem;
    color: #9ca3af;
    line-height: 1;
    margin-top: 2px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.presence-profile-status-text.status-online {
    color: #4ade80;
}

.presence-profile-status-text.status-away {
    color: #facc15;
}

.presence-profile-status-text.status-offline {
    color: #9ca3af;
}

/* ─── SKELETON PLACEHOLDER (ÉLIMINATION DU LAYOUT SHIFT CLS) ──────────────── */

.presence-skeleton-item {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 72px;
    animation: presenceSkeletonPulse 1.4s infinite ease-in-out;
}

.skeleton-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #1f2937;
    border: 2px solid #374151;
}

.skeleton-name {
    width: 44px;
    height: 9px;
    border-radius: 4px;
    background: #1f2937;
    margin-top: 6px;
}

.skeleton-sub {
    width: 32px;
    height: 7px;
    border-radius: 3px;
    background: #1f2937;
    margin-top: 4px;
}

@keyframes presenceSkeletonPulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.85;
    }
}

/* ─── VISIONNEUSE PLEIN ÉCRAN STORIES (STYLE INSTAGRAM) ──────────────────── */

.story-fullscreen-viewer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #000000;
    align-items: center;
    justify-content: center;
}

.story-viewport {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: 100%;
    max-height: 920px;
    background: #0b0f19;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
}

/* Segments de progression */
.story-progress-segments {
    position: absolute;
    top: 10px;
    left: 12px;
    right: 12px;
    display: flex;
    gap: 4px;
    z-index: 25;
}

.story-progress-segment {
    flex: 1;
    height: 2.5px;
    background: rgba(255, 255, 255, 0.28);
    border-radius: 2px;
    overflow: hidden;
}

.story-progress-filler {
    height: 100%;
    width: 0%;
    background: #ffffff;
    border-radius: 2px;
}

/* En-tête viewer */
.story-viewer-topbar {
    position: absolute;
    top: 22px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 25;
}

.story-user-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.story-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #ffffff;
}

.story-user-pseudo {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.story-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.story-btn-sound-toggle {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 5px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background-color 0.2s ease;
    display: none; /* Affiché uniquement sur story vidéo */
}

.story-btn-sound-toggle:hover {
    background: rgba(255, 255, 255, 0.35);
}

.story-btn-profile-top {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    backdrop-filter: blur(4px);
    transition: background-color 0.2s ease;
}

.story-btn-profile-top:hover {
    background: rgba(255, 255, 255, 0.35);
    color: #ffffff;
}

.story-btn-close-viewer {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Zone média centrale */
.story-media-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #000000;
    overflow: hidden;
}

.story-media-image,
.story-media-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    background: #000000;
}

.story-caption {
    position: absolute;
    bottom: 24px;
    left: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    text-align: center;
    z-index: 15;
}

.story-loading-spinner {
    width: 38px;
    height: 38px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: storySpin 0.8s infinite linear;
}

@keyframes storySpin {
    to { transform: rotate(360deg); }
}

/* Zones tactiles gauche (40%) et droite (60%) */
.story-tap-zone {
    position: absolute;
    top: 65px;
    bottom: 0;
    z-index: 10;
    cursor: pointer;
}

.tap-left {
    left: 0;
    width: 40%;
}

.tap-right {
    right: 0;
    width: 60%;
}

/* ─── BOUTON & MODALE D'UPLOAD DE STORY (PROFILS OFFER) ───────────────────── */

.story-upload-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: #ffffff;
    border: none;
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(236, 72, 153, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.story-upload-trigger-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 3px 10px rgba(236, 72, 153, 0.6);
}

.story-upload-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.story-upload-container {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    padding: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
    color: #f3f4f6;
}

.story-upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.story-upload-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: #f9fafb;
}

.story-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    transition: border-color 0.2s ease, background-color 0.2s ease;
    margin-bottom: 14px;
}

.story-dropzone:hover {
    border-color: #ec4899;
    background: rgba(236, 72, 153, 0.05);
}

.story-preview-wrapper {
    display: none;
    position: relative;
    max-height: 260px;
    overflow: hidden;
    border-radius: 10px;
    margin-bottom: 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.story-preview-img,
.story-preview-video {
    width: 100%;
    max-height: 260px;
    object-fit: contain;
    background: #000000;
}

.story-input-caption {
    width: 100%;
    background: #1f2937;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #f3f4f6;
    padding: 8px 12px;
    font-size: 0.85rem;
    margin-bottom: 14px;
    outline: none;
    box-sizing: border-box;
}

.story-input-caption:focus {
    border-color: #ec4899;
}

.story-btn-submit {
    width: 100%;
    background: linear-gradient(135deg, #f59e0b, #ec4899, #8b5cf6);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.story-btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
