/* ═══════════════════════════════════════════════════════════
   FRIEND PROFILE MODAL — Redesign épuré & moderne
   Aesthetic: Dark luxury / editorial precision
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,300&family=DM+Serif+Display:ital@0;1&display=swap');

/* ── Modal container ─────────────────────────────────────── */
.friend-profile-modal {
    padding: 0 !important;
    background: var(--bg-elevated);
    border-radius: 20px;
    overflow: hidden;
    max-width: 820px;
    width: 90vw;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.06),
        0 32px 80px rgba(0, 0, 0, 0.6),
        0 8px 24px rgba(0, 0, 0, 0.4);
    animation: fpmSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fpmSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.friend-profile-modal::-webkit-scrollbar { display: block !important; width: 4px !important; }
.friend-profile-modal::-webkit-scrollbar-track { background: transparent; }
.friend-profile-modal::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
.friend-profile-modal::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* ── Bouton fermer ───────────────────────────────────────── */
.friend-profile-modal .close-modal {
    /* Absolute dans le header pour ne pas perturber le flux du modal */
    position: absolute;
    top: 16px;
    right: 16px;
    float: none;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.55);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.25s ease;
    backdrop-filter: blur(12px);
    cursor: pointer;
}

.friend-profile-modal .close-modal:hover {
    background: rgba(239, 68, 68, 0.75);
    border-color: rgba(239, 68, 68, 0.4);
    transform: rotate(90deg);
}

/* ── Header : cover + avatar ─────────────────────────────── */
.friend-profile-header {
    position: relative;
}

.friend-profile-cover {
    height: 200px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 40%, #0f2044 100%);
}

/* Motif géométrique subtil sur le cover */
.friend-profile-cover::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 60%, rgba(59, 130, 246, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse 50% 50% at 85% 30%, rgba(139, 92, 246, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse 60% 40% at 60% 90%, rgba(16, 185, 129, 0.08) 0%, transparent 50%);
    animation: fpmCoverPulse 12s ease-in-out infinite alternate;
}

.friend-profile-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, var(--bg-elevated) 100%);
}

@keyframes fpmCoverPulse {
    0%   { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Avatar wrapper — flottant sur le cover */
.friend-profile-avatar-wrapper {
    position: absolute;
    bottom: -55px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.friend-profile-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 3px solid var(--bg-elevated);
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.08),
        0 12px 40px rgba(0, 0, 0, 0.5);
    object-fit: cover;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.friend-profile-avatar:hover {
    transform: scale(1.04);
    box-shadow:
        0 0 0 2px rgba(59, 130, 246, 0.5),
        0 16px 48px rgba(0, 0, 0, 0.6);
}

/* ── Nom & infos ──────────────────────────────────────────── */
.friend-profile-info {
    text-align: center;
    padding: 76px 40px 4px;
}

.friend-profile-username {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 30px;
    font-weight: 400;
    letter-spacing: -0.3px;
    color: var(--text-primary);
    margin: 0 0 10px 0;
    line-height: 1.1;
}

.friend-profile-since {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    margin: 0;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.friend-profile-since svg {
    opacity: 0.5;
}

/* ── Stats ────────────────────────────────────────────────── */
.friend-profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    padding: 28px 40px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 24px;
}

.friend-profile-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 12px;
    background: transparent;
    border-radius: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s ease;
    position: relative;
}

.friend-profile-stat:last-child {
    border-right: none;
}

.friend-profile-stat:hover {
    background: rgba(255, 255, 255, 0.03);
}

.friend-profile-stat-icon {
    font-size: 22px;
    line-height: 1;
    margin-bottom: 2px;
    filter: grayscale(0.3);
}

.friend-profile-stat-content {
    text-align: center;
}

.friend-profile-stat-value {
    font-family: 'DM Sans', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.friend-profile-stat-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 3px;
    opacity: 0.7;
}

/* Stats cliquables */
.friend-profile-stat--clickable {
    cursor: pointer;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px 10px;
}

.friend-profile-stat--clickable:hover {
    background: rgba(59, 130, 246, 0.06);
}

.friend-profile-stat--clickable:active {
    transform: scale(0.97);
}

.friend-profile-stat--clickable .friend-profile-stat-content {
    text-align: left;
}

.friend-profile-stat--clickable .friend-profile-stat-icon {
    font-size: 20px;
}

.friend-profile-stat-arrow {
    color: var(--primary, #3b82f6);
    font-size: 18px;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    line-height: 1;
}

.friend-profile-stat--clickable:hover .friend-profile-stat-arrow {
    opacity: 0.8;
    transform: translateX(0);
}

/* ── Sections films / listes ─────────────────────────────── */
.friend-profile-section {
    padding: 32px 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.friend-profile-section:last-child {
    border-bottom: none;
    padding-bottom: 44px;
}

.friend-profile-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0 0 20px 0;
}

.friend-profile-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
}

.friend-profile-section-icon {
    font-size: 18px;
    opacity: 0.8;
}

/* ── Grille de films ─────────────────────────────────────── */
.friend-profile-movies {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
}

.friend-profile-movie {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    aspect-ratio: 2/3;
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.friend-profile-movie:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.friend-profile-movie img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: filter 0.3s ease;
}

.friend-profile-movie:hover img {
    filter: brightness(0.75);
}

.friend-profile-movie-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 10px 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.6) 60%, transparent 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.friend-profile-movie:hover .friend-profile-movie-overlay {
    opacity: 1;
}

.friend-profile-movie-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: white;
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.friend-profile-movie-rating {
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    color: #fbbf24;
    font-weight: 600;
    letter-spacing: 0.04em;
}

/* ── État vide ────────────────────────────────────────────── */
.friend-profile-empty {
    text-align: center;
    padding: 48px 32px;
}

.friend-profile-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.2;
}

.friend-profile-empty p {
    font-family: 'DM Sans', sans-serif;
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
    opacity: 0.7;
}

/* ── Profil privé ─────────────────────────────────────────── */
.friend-profile-private {
    text-align: center;
    padding: 60px 48px;
}

.friend-profile-private-icon {
    font-size: 56px;
    margin-bottom: 20px;
    opacity: 0.2;
    animation: fpmPulseLock 2.5s ease-in-out infinite;
}

@keyframes fpmPulseLock {
    0%, 100% { transform: scale(1); opacity: 0.2; }
    50%       { transform: scale(1.05); opacity: 0.28; }
}

.friend-profile-private-avatar {
    margin-bottom: 20px;
}

.friend-profile-private-avatar img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.08);
    object-fit: cover;
}

.friend-profile-private h2 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 26px;
    font-weight: 400;
    color: var(--text-primary);
    margin: 0 0 10px 0;
}

.friend-profile-private-text {
    font-family: 'DM Sans', sans-serif;
    color: var(--text-secondary);
    font-size: 15px;
    margin: 0 0 28px 0;
    opacity: 0.7;
}

.friend-profile-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(251, 191, 36, 0.08);
    color: #fbbf24;
    border-radius: 20px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 24px;
    border: 1px solid rgba(251, 191, 36, 0.15);
}

.friend-profile-private .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 28px;
    font-size: 15px;
    border-radius: 10px;
}

/* ── Modal "Voir tout" (Films d'un ami) ──────────────────── */
#famLazySentinel {
    height: 1px;
    width: 100%;
}

.fam-header {
    padding: 24px 28px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    z-index: 10;
    backdrop-filter: blur(16px);
}

.fam-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 14px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.2px;
}

.fam-sort-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.fam-sort-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.7;
}

.fam-sort-select {
    padding: 7px 28px 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.2s ease;
    min-width: 155px;
}

.fam-sort-select:disabled { opacity: 0.4; cursor: not-allowed; }
.fam-sort-select:focus    { outline: none; border-color: var(--primary, #3b82f6); }

.fam-count-badge {
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    opacity: 0.6;
}

/* Progress bar */
.fam-progress-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    animation: famFadeIn 0.3s ease;
}

@keyframes famFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fam-progress-bar-track {
    flex: 1;
    height: 3px;
    background: rgba(255,255,255,0.07);
    border-radius: 99px;
    overflow: hidden;
}

.fam-progress-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--primary, #3b82f6), #818cf8);
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.fam-progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    width: 60%;
    left: -60%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: famShimmer 1.4s ease-in-out infinite;
}

@keyframes famShimmer {
    0%   { left: -60%; }
    100% { left: 120%; }
}

.fam-progress-bar-fill.fam-progress-done {
    background: linear-gradient(90deg, #10b981, #34d399);
}
.fam-progress-bar-fill.fam-progress-done::after { display: none; }

.fam-progress-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 52px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
}

/* Grille 3 colonnes */
.fam-grid-wrapper {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 14px;
    padding: 20px 24px 28px;
}

/* Spinner initial */
.fam-initial-loader {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 60px 0;
}

.fam-initial-spinner {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(255, 255, 255, 0.07);
    border-top-color: var(--primary, #3b82f6);
    border-radius: 50%;
    animation: famSpin 0.7s linear infinite;
}

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

.fam-initial-text {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
    opacity: 0.6;
}

/* ══════════════════════════════════════════════════════════════
   FRIENDS MOVIE MODAL — amis ayant vu ce film
   Fenêtre agrandie + design repensé
   ══════════════════════════════════════════════════════════════ */

.friends-movie-modal-container {
    max-width: 680px;
    width: 92vw;
    max-height: 85vh;
    background: var(--bg-elevated);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.06),
        0 40px 90px rgba(0, 0, 0, 0.65);
    animation: fpmSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.friends-movie-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.friends-movie-modal-close:hover {
    background: rgba(239, 68, 68, 0.8);
    border-color: rgba(239, 68, 68, 0.4);
    transform: rotate(90deg);
}

/* Header repensé — clean & moderne */
.friends-movie-modal-header {
    padding: 36px 36px 28px;
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.8) 0%, rgba(30, 41, 59, 0.9) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}

.friends-movie-modal-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 80% at 10% 50%, rgba(59, 130, 246, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse 50% 60% at 90% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 55%);
    pointer-events: none;
}

.friends-movie-modal-header h2 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 24px;
    font-weight: 400;
    margin: 0 0 8px 0;
    line-height: 1.25;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
    max-width: calc(100% - 48px);
}

.friends-movie-modal-subtitle {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    position: relative;
    z-index: 1;
    letter-spacing: 0.02em;
    opacity: 0.8;
}

/* Body scrollable */
.friends-movie-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px 28px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.friends-movie-modal-body::-webkit-scrollbar { display: block !important; width: 4px !important; }
.friends-movie-modal-body::-webkit-scrollbar-track { background: transparent; }
.friends-movie-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

/* Section dans le body */
.friends-movie-section {
    margin-bottom: 32px;
}

.friends-movie-section:last-child {
    margin-bottom: 0;
}

.friends-movie-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.friends-movie-section-icon {
    font-size: 18px;
    line-height: 1;
    opacity: 0.8;
}

.friends-movie-section-header h3 {
    flex: 1;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0;
    opacity: 0.8;
}

.friends-movie-section-count {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Liste des amis */
.friends-movie-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.friends-movie-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.22s ease;
}

.friends-movie-item:hover {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.2);
    transform: translateX(3px);
}

.friends-movie-item-avatar {
    position: relative;
    flex-shrink: 0;
}

.friends-movie-item-avatar img {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.08);
    transition: border-color 0.2s ease;
}

.friends-movie-item:hover .friends-movie-item-avatar img {
    border-color: rgba(59, 130, 246, 0.4);
}

.friends-movie-item-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    border: 2px solid var(--bg-elevated);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.friends-movie-item-badge.liked   { background: linear-gradient(135deg, #ef4444, #dc2626); }
.friends-movie-item-badge.watched { background: linear-gradient(135deg, #10b981, #059669); }

.friends-movie-item-info {
    flex: 1;
    min-width: 0;
}

.friends-movie-item-name {
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.1px;
}

.friends-movie-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
}

.friends-movie-item-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #fbbf24;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
}

.friends-movie-item-date {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-secondary);
    opacity: 0.7;
}

.friends-movie-item-arrow {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.15);
    transition: all 0.22s ease;
}

.friends-movie-item:hover .friends-movie-item-arrow {
    color: var(--primary);
    transform: translateX(3px);
}

/* États vide/loading/error */
.friends-movie-modal-loading,
.friends-movie-modal-empty,
.friends-movie-modal-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 40px;
    text-align: center;
}

.friends-movie-modal-empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.15;
}

.friends-movie-modal-empty h2,
.friends-movie-modal-error h2 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 20px;
    font-weight: 400;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.friends-movie-modal-empty p,
.friends-movie-modal-error p {
    font-family: 'DM Sans', sans-serif;
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
    opacity: 0.6;
}

/* Badge cliquable dans le modal film */
.movie-friends-badge {
    transition: all 0.25s ease;
    cursor: pointer;
}

.movie-friends-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.25);
}

.movie-friends-badge:active {
    transform: translateY(0);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .friend-profile-modal {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 95vh;
        width: 100%;
    }

    .friend-profile-cover { height: 150px; }

    .friend-profile-stats {
        grid-template-columns: repeat(2, 1fr);
        padding: 24px 24px 0;
    }

    .friend-profile-stat {
        border-right: 1px solid rgba(255,255,255,0.05);
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    .friend-profile-stat:nth-child(2n) { border-right: none; }
    .friend-profile-stat:nth-last-child(-n+2) { border-bottom: none; }

    .friend-profile-section { padding: 24px 24px; }

    .friend-profile-movies {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }

    .friend-profile-avatar { width: 90px; height: 90px; }
    .friend-profile-avatar-wrapper { bottom: -36px; }
    .friend-profile-info { padding: 64px 24px 4px; }
    .friend-profile-username { font-size: 24px; }

    .friends-movie-modal-container {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
        width: 100%;
    }

    .friends-movie-modal-header { padding: 28px 24px 22px; }
    .friends-movie-modal-header h2 { font-size: 20px; }
    .friends-movie-modal-body { padding: 18px 18px 24px; }
    .friends-movie-item { padding: 12px 14px; }
    .friends-movie-item-avatar img { width: 44px; height: 44px; }
    .friends-movie-item-name { font-size: 14px; }
}

@media (max-width: 480px) {
    .friend-profile-stat-value { font-size: 22px; }
    .fam-grid-wrapper { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; padding: 14px 14px 22px; }
    .friends-movie-modal-header h2 { font-size: 18px; }
    .friends-movie-section-header h3 { font-size: 12px; }
}

@media (min-width: 769px) {
    .friend-profile-modal { max-width: 820px; }
    .friends-movie-modal-container { max-width: 680px; }
}



/* ═══════════════════════════════════════════════════════════════
   FRIEND PROFILE MODAL — PATCH DEFINITIF v4
   À charger EN DERNIER après tous les autres CSS
   ═══════════════════════════════════════════════════════════════ */

/* ── Modal container ─────────────────────────────────────────── */
.friend-profile-modal {
    position: relative !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* ── Bouton fermer ────────────────────────────────────────────── */
.friend-profile-modal .close-modal {
    position: sticky !important;
    top: 14px !important;
    float: right !important;
    margin: 14px 14px -50px auto !important;
    z-index: 300 !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.65) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    font-size: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    backdrop-filter: blur(12px) !important;
    cursor: pointer !important;
    transition: background 0.2s ease, transform 0.2s ease !important;
}
.friend-profile-modal .close-modal:hover {
    background: rgba(239, 68, 68, 0.85) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    transform: rotate(90deg) !important;
}

/* ── Structure header/cover ───────────────────────────────────── */
.friend-profile-header {
    position: static !important;
    overflow: visible !important;
}
.friend-profile-cover {
    position: relative !important;
    overflow: hidden !important;
    display: block !important;
}

/* ── Avatar : margin-top négatif pour chevaucher le cover ──────  */
.friend-profile-avatar-wrapper {
    position: relative !important;
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-bottom: 0 !important;
    width: fit-content !important;
    z-index: 20 !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
}
.friend-profile-avatar {
    border-radius: 50% !important;
    border: 3px solid var(--bg-elevated) !important;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 12px 40px rgba(0,0,0,0.5) !important;
    object-fit: cover !important;
    display: block !important;
}

/* ── Nom + date ───────────────────────────────────────────────── */
.friend-profile-info {
    text-align: center !important;
    position: relative !important;
    z-index: 10 !important;
}

/* ── Stats ───────────────────────────────────────────────────── */
.friend-profile-stats {
    position: relative !important;
    z-index: 5 !important;
}

/* ── Sections ────────────────────────────────────────────────── */
.friend-profile-section {
    position: relative !important;
    z-index: 5 !important;
}

/* ══════════════════════════════════════════════════════════════
   PC (>= 769px)
   - Sections profil  : 5 films par ligne
   - "Voir tout"      : 4 films par ligne
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
    .friend-profile-modal {
        max-width: 820px !important;
        width: 90vw !important;
        max-height: 88vh !important;
        border-radius: 20px !important;
    }
    .friend-profile-cover {
        height: 200px !important;
    }
    .friend-profile-avatar-wrapper {
        margin-top: -55px !important;
    }
    .friend-profile-avatar {
        width: 110px !important;
        height: 110px !important;
    }
    .friend-profile-info {
        padding: 16px 40px 8px !important;
    }
    .friend-profile-stats {
        grid-template-columns: repeat(4, 1fr) !important;
        padding: 24px 40px 0 !important;
        margin-top: 20px !important;
    }
    .friend-profile-section {
        padding: 32px 40px !important;
    }

    /* 5 films par ligne dans les sections du profil */
    .friend-profile-movies {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 12px !important;
    }

    /* "Voir tout" : 4 colonnes */
    .fam-grid-wrapper {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    .fam-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ══════════════════════════════════════════════════════════════
   MOBILE (<= 768px)
   - Sections profil  : 2 colonnes × 2 lignes = 4 films
   - "Voir tout"      : 3 films par ligne
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .friend-profile-modal {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        max-height: 95vh !important;
    }
    .friend-profile-cover {
        height: 160px !important;
    }
    .friend-profile-avatar {
        width: 90px !important;
        height: 90px !important;
    }
    .friend-profile-avatar-wrapper {
        margin-top: -45px !important;
    }
    .friend-profile-info {
        padding: 14px 24px 6px !important;
    }
    .friend-profile-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        padding: 16px 20px 0 !important;
        margin-top: 14px !important;
    }
    .friend-profile-section {
        padding: 20px !important;
    }
    .friend-profile-username {
        font-size: 22px !important;
    }
    .friend-profile-modal .close-modal {
        margin: 12px 12px -50px auto !important;
    }

    /* 2 colonnes × 2 lignes = 4 films affichés */
    .friend-profile-movies {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    /* "Voir tout" : 3 colonnes */
    .fam-grid-wrapper {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .fam-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* ── Très petit écran (<= 360px) ─────────────────────────────── */
@media (max-width: 360px) {
    .friend-profile-movies {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .fam-grid-wrapper,
    .fam-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* ── Masquer le 5e film sur mobile (JS charge 5, CSS en cache 1) */
@media (max-width: 768px) {
    .friend-profile-movies .friend-profile-movie:nth-child(n+5) {
        display: none !important;
    }
}
/* ═══════════════════════════════════════════════════════════
   BOTTOM SHEET — Modaux amis sur mobile
   Écrase le align-items: center de modals.css
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Overlay : colle le contenu en bas */
    #friendProfileModal.modal.active,
    #friendAllMoviesModal.modal.active {
        align-items: flex-end !important;
        justify-content: center !important;
        padding: 0 !important;
    }

    /* Annule le margin: 16px de mobile.css sur le modal-content */
    #friendProfileModal .modal-content,
    #friendAllMoviesModal .modal-content {
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        max-height: 93vh !important;
        height: 93vh !important;
        overflow-y: auto !important;
        padding: 0 !important;
    }
}