/* ============================================================
   TRIPCOOKING — MESSENGER COOKING
   Style Discord-like avec accents TripCooking (violet/crème)
   ============================================================ */

.tcMsgPage,
.tcMsgPage * { box-sizing: border-box; }

.tcMsgPage {
    --tc-msg-violet:        #6B5BE6;
    --tc-msg-violet-deep:   #4D3FCC;
    --tc-msg-violet-soft:   #EEEAFE;
    --tc-msg-violet-pale:   #F6F3FE;
    --tc-msg-cream:         #FBF8F2;
    --tc-msg-cream-deep:    #F5EFE3;

    --tc-msg-amber:         #F4B740;
    --tc-msg-amber-deep:    #D99A1C;
    --tc-msg-rose:          #E85D75;
    --tc-msg-rose-deep:     #C73E58;
    --tc-msg-sage:          #5BA678;
    --tc-msg-peach:         #F0876A;

    --tc-msg-surface:       #FFFFFF;
    --tc-msg-surface-soft:  #FAF8F4;
    --tc-msg-surface-deep:  #F2EEF9;

    --tc-msg-ink:           #1B1733;
    --tc-msg-ink-2:         #4A4566;
    --tc-msg-ink-3:         #8983A4;
    --tc-msg-ink-4:         #BCB7CE;

    --tc-msg-line:          #EBE6F5;
    --tc-msg-line-soft:     #F2EEF9;

    --tc-msg-shadow-sm:     0 2px 8px rgba(27, 23, 51, 0.04);
    --tc-msg-shadow-md:     0 8px 24px rgba(27, 23, 51, 0.06);

    --tc-msg-online:        #5BA678;
    --tc-msg-busy:          #F4B740;
    --tc-msg-offline:       #BCB7CE;

    /* Hauteur de l'entête TripCooking — ajuste si besoin */
    --tc-msg-header-h:      60px;

    --font-display:         'Fraunces', 'Times New Roman', serif;
    --font-body:            'Plus Jakarta Sans', system-ui, sans-serif;

    font-family: var(--font-body);
    color: var(--tc-msg-ink);
    background: var(--tc-msg-cream);

    /* Le messenger commence sous l'entête fixe */
    padding-top: var(--tc-msg-header-h);
    min-height: 100vh;
}

/* ============================================================
   LAYOUT 4 COLONNES
   ============================================================ */
.tcMsgApp {
    display: grid;
    grid-template-columns: 76px 320px minmax(0, 1fr) 320px;
    gap: 0;
    /* Hauteur = écran moins l'entête */
    height: calc(100vh - var(--tc-msg-header-h));
    max-height: calc(100vh - var(--tc-msg-header-h));
    background: var(--tc-msg-surface);
    overflow: hidden;
}

/* ============================================================
   COL 1 : RAIL DES SALONS (style Discord)
   ============================================================ */
.tcMsgRail {
    background: linear-gradient(to bottom, #1B1733, #2A2150);
    color: #fff;
    overflow: hidden;
}
.tcMsgRail__inner {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    overflow-y: auto;
    height: 100%;
}
.tcMsgRail__inner::-webkit-scrollbar { width: 0; }

.tcMsgRailIcon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    display: grid;
    place-items: center;
    cursor: pointer;
    text-decoration: none;
    transition: all .25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    flex-shrink: 0;
    font-size: 22px;
}
.tcMsgRailIcon:hover {
    border-radius: 16px;
    background: var(--tc-msg-violet);
    transform: scale(1.05);
}
.tcMsgRailIcon.is-active {
    border-radius: 16px;
    background: var(--tc-msg-violet);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}
.tcMsgRailIcon.is-active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 28px;
    background: #fff;
    border-radius: 0 4px 4px 0;
}

.tcMsgRailIcon--home {
    background: linear-gradient(135deg, var(--tc-msg-violet), var(--tc-msg-violet-deep));
}
.tcMsgRailIcon--violet {
    background: linear-gradient(135deg, var(--tc-msg-violet-soft), var(--tc-msg-violet));
}
.tcMsgRailIcon--amber {
    background: linear-gradient(135deg, var(--tc-msg-amber), var(--tc-msg-amber-deep));
    color: #4F3A0F;
}
.tcMsgRailIcon--rose {
    background: linear-gradient(135deg, var(--tc-msg-rose), var(--tc-msg-rose-deep));
}

.tcMsgRailIcon--add {
    background: rgba(91, 166, 120, 0.2);
    color: var(--tc-msg-sage);
    font-size: 26px;
    font-weight: 300;
}
.tcMsgRailIcon--add:hover {
    background: var(--tc-msg-sage);
    color: #fff;
}

.tcMsgRailIcon--explore {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}
.tcMsgRailIcon--explore:hover {
    background: var(--tc-msg-amber);
    color: #4F3A0F;
}

.tcMsgRailIcon__badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: var(--tc-msg-rose);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    padding: 0 5px;
    display: grid;
    place-items: center;
    border: 2px solid #1B1733;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.tcMsgRail__sep {
    width: 36px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1px;
    margin: 4px 0;
}

/* ============================================================
   COL 2 : LISTE CONTACTS / MEMBRES
   ============================================================ */
.tcMsgList {
    background: var(--tc-msg-surface-soft);
    border-right: 1px solid var(--tc-msg-line-soft);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tcMsgList__inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tcMsgList__header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--tc-msg-line-soft);
    background: var(--tc-msg-surface);
}

.tcMsgList__simpleHead,
.tcMsgList__groupHead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tcMsgList__simpleHead h2 {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    font-size: 22px;
    margin: 0;
    color: var(--tc-msg-ink);
}

.tcMsgList__groupHead {
    align-items: flex-start;
}
.tcMsgList__groupEmoji {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
}
.tcMsgList__groupHead > div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.tcMsgList__groupHead h2 {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    font-size: 18px;
    margin: 0;
    line-height: 1.2;
    color: var(--tc-msg-ink);
}
.tcMsgList__groupHead span {
    font-size: 12px;
    color: var(--tc-msg-ink-3);
    font-weight: 500;
}

.tcMsgIconBtn {
    background: transparent;
    border: none;
    color: var(--tc-msg-ink-3);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 14px;
    transition: all .15s;
}
.tcMsgIconBtn:hover {
    background: var(--tc-msg-violet-pale);
    color: var(--tc-msg-violet-deep);
}

/* Recherche */
.tcMsgSearch {
    margin: 14px 20px 10px;
    background: var(--tc-msg-surface);
    border: 1px solid var(--tc-msg-line);
    border-radius: 999px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: border-color .15s;
}
.tcMsgSearch:focus-within {
    border-color: var(--tc-msg-violet);
    box-shadow: 0 0 0 3px var(--tc-msg-violet-pale);
}
.tcMsgSearch span {
    color: var(--tc-msg-ink-3);
    font-size: 14px;
}
.tcMsgSearch input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    color: var(--tc-msg-ink);
    font-family: inherit;
}

/* Filtres */
.tcMsgFilters {
    display: flex;
    gap: 6px;
    padding: 0 20px 12px;
}
.tcMsgFilter {
    background: transparent;
    border: 1px solid var(--tc-msg-line);
    color: var(--tc-msg-ink-2);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}
.tcMsgFilter:hover {
    background: var(--tc-msg-violet-pale);
    border-color: var(--tc-msg-violet-pale);
}
.tcMsgFilter.is-active {
    background: var(--tc-msg-violet);
    color: #fff;
    border-color: var(--tc-msg-violet);
}

/* Scroll zone */
.tcMsgList__scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px 12px;
}
.tcMsgList__scroll::-webkit-scrollbar { width: 6px; }
.tcMsgList__scroll::-webkit-scrollbar-thumb {
    background: var(--tc-msg-line);
    border-radius: 999px;
}

.tcMsgGroupSection {
    margin-bottom: 14px;
}

.tcMsgListTitle {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--tc-msg-ink-3);
    margin: 12px 8px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tcMsgListTitle span {
    background: var(--tc-msg-violet-pale);
    color: var(--tc-msg-violet-deep);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    letter-spacing: 0;
}

/* Avatar générique */
.tcMsgAvatar {
    position: relative;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tc-msg-amber), var(--tc-msg-peach));
    display: grid;
    place-items: center;
    color: #4F3A0F;
    font-family: var(--font-display);
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}
.tcMsgAvatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tcMsgAvatar--xs { width: 22px; height: 22px; font-size: 10px; }
.tcMsgAvatar--sm { width: 32px; height: 32px; font-size: 12px; }
.tcMsgAvatar--md { width: 40px; height: 40px; font-size: 14px; }
.tcMsgAvatar--lg { width: 56px; height: 56px; font-size: 18px; }
.tcMsgAvatar--xl { width: 84px; height: 84px; font-size: 28px; }

.tcMsgAvatar__dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--tc-msg-offline);
    border: 2.5px solid var(--tc-msg-surface-soft);
}
.tcMsgAvatar--lg .tcMsgAvatar__dot,
.tcMsgAvatar--xl .tcMsgAvatar__dot {
    width: 16px;
    height: 16px;
}
.tcMsgAvatar__dot--online { background: var(--tc-msg-online); }
.tcMsgAvatar__dot--busy { background: var(--tc-msg-busy); }

/* Item membre dans la sidebar */
.tcMsgMember {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s;
}
.tcMsgMember:hover {
    background: var(--tc-msg-violet-pale);
}
.tcMsgMember__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.tcMsgMember__body strong {
    font-size: 13px;
    color: var(--tc-msg-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tcMsgMember__body span {
    font-size: 11px;
    color: var(--tc-msg-ink-3);
}

/* À propos du groupe (sidebar) */
.tcMsgGroupAbout {
    background: var(--tc-msg-surface);
    border: 1px solid var(--tc-msg-line-soft);
    border-radius: 12px;
    padding: 14px;
    margin-top: 6px;
}
.tcMsgGroupAbout p {
    font-size: 12.5px;
    color: var(--tc-msg-ink-2);
    margin: 0 0 12px;
    line-height: 1.5;
}

.tcMsgBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 999px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .2s;
}
.tcMsgBtn--primary {
    background: linear-gradient(135deg, var(--tc-msg-violet), var(--tc-msg-violet-deep));
    color: #fff;
}
.tcMsgBtn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(107, 91, 230, 0.35);
}
.tcMsgBtn--secondary {
    background: var(--tc-msg-surface);
    color: var(--tc-msg-ink);
    border-color: var(--tc-msg-line);
}
.tcMsgBtn--secondary:hover {
    border-color: var(--tc-msg-violet);
    color: var(--tc-msg-violet);
}
.tcMsgBtn--full { width: 100%; }

/* Contact list (DM) */
.tcMsgContact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background .15s;
    margin-bottom: 2px;
    border: 1px solid transparent;
}
.tcMsgContact:hover {
    background: var(--tc-msg-violet-pale);
}
.tcMsgContact.is-active {
    background: var(--tc-msg-violet-soft);
    border-color: rgba(107, 91, 230, 0.2);
}
.tcMsgContact__body {
    flex: 1;
    min-width: 0;
}
.tcMsgContact__top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 2px;
}
.tcMsgContact__top strong {
    font-size: 13.5px;
    color: var(--tc-msg-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tcMsgContact__time {
    font-size: 10.5px;
    color: var(--tc-msg-ink-3);
    flex-shrink: 0;
}
.tcMsgContact__bot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.tcMsgContact__preview,
.tcMsgContact__tag {
    font-size: 11.5px;
    color: var(--tc-msg-ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.tcMsgContact.has-unread .tcMsgContact__preview,
.tcMsgContact.has-unread .tcMsgContact__top strong {
    color: var(--tc-msg-ink);
    font-weight: 700;
}
.tcMsgContact__badge {
    background: var(--tc-msg-rose);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    padding: 0 5px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

/* État vide */
.tcMsgEmpty {
    text-align: center;
    padding: 40px 20px;
    color: var(--tc-msg-ink-3);
}
.tcMsgEmpty span {
    font-size: 38px;
    display: block;
    margin-bottom: 12px;
}
.tcMsgEmpty p {
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 16px;
}

/* Footer de la liste avec profil utilisateur */
.tcMsgList__footer {
    padding: 10px 14px;
    border-top: 1px solid var(--tc-msg-line-soft);
    background: var(--tc-msg-surface);
    display: flex;
    align-items: center;
    gap: 10px;
}
.tcMsgList__footerBody {
    flex: 1;
    min-width: 0;
}
.tcMsgList__footerBody strong {
    display: block;
    font-size: 13px;
    color: var(--tc-msg-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tcMsgList__footerBody span {
    font-size: 10.5px;
    color: var(--tc-msg-online);
}
.tcMsgList__footerActions {
    display: flex;
    gap: 2px;
}

/* ============================================================
   COL 3 : ZONE DE CHAT
   ============================================================ */
.tcMsgChat {
    background: var(--tc-msg-surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.tcMsgChat__header {
    padding: 14px 22px;
    border-bottom: 1px solid var(--tc-msg-line-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    background: var(--tc-msg-surface);
}

.tcMsgChat__title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.tcMsgChat__hash {
    color: var(--tc-msg-ink-4);
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}
.tcMsgChat__emoji {
    font-size: 18px;
}
.tcMsgChat__title h1 {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    font-size: 18px;
    margin: 0;
    color: var(--tc-msg-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tcMsgChat__sep {
    color: var(--tc-msg-ink-4);
    margin: 0 4px;
}
.tcMsgChat__topic,
.tcMsgChat__status {
    font-size: 13px;
    color: var(--tc-msg-ink-3);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tcMsgChat__actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.tcMsgChat__actions .tcMsgIconBtn {
    font-size: 16px;
    width: 36px;
    height: 36px;
    padding: 0;
    display: grid;
    place-items: center;
}

/* Messages */
.tcMsgChat__messagesWrap {
    flex: 1;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--tc-msg-surface) 0%, var(--tc-msg-surface-soft) 100%);
}
.tcMsgChat__messagesWrap::-webkit-scrollbar { width: 8px; }
.tcMsgChat__messagesWrap::-webkit-scrollbar-thumb {
    background: var(--tc-msg-line);
    border-radius: 999px;
}
.tcMsgChat__messages {
    padding: 24px 32px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 100%;
}

/* Bannière de bienvenue */
.tcMsgWelcome {
    text-align: center;
    padding: 30px 20px 20px;
    border-bottom: 1px dashed var(--tc-msg-line);
    margin-bottom: 8px;
}
.tcMsgWelcome__icon {
    width: 80px;
    height: 80px;
    border-radius: 22px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    font-size: 36px;
    box-shadow: var(--tc-msg-shadow-md);
}
.tcMsgWelcome h2 {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    font-size: 28px;
    margin: 0 0 8px;
    color: var(--tc-msg-ink);
}
.tcMsgWelcome h2 em {
    color: var(--tc-msg-violet-deep);
    font-style: italic;
}
.tcMsgWelcome p {
    font-size: 13.5px;
    color: var(--tc-msg-ink-3);
    margin: 0 0 16px;
    line-height: 1.6;
}
.tcMsgWelcome__actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Séparateur de jour */
.tcMsgDayDivider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
}
.tcMsgDayDivider::before,
.tcMsgDayDivider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--tc-msg-line);
}
.tcMsgDayDivider span {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--tc-msg-ink-3);
    padding: 4px 10px;
    background: var(--tc-msg-cream);
    border-radius: 999px;
    border: 1px solid var(--tc-msg-line-soft);
}

/* Groupe de message (avatar + body) */
.tcMsgGrp {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.tcMsgGrp__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tcMsgGrp__header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}
.tcMsgGrp__header strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--tc-msg-ink);
}
.tcMsgGrp--mine .tcMsgGrp__header strong {
    color: var(--tc-msg-violet-deep);
}
.tcMsgGrp__time {
    font-size: 11px;
    color: var(--tc-msg-ink-3);
    font-weight: 500;
}

/* Bulles */
.tcMsgBubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 540px;
    word-wrap: break-word;
}
.tcMsgBubble--received {
    background: var(--tc-msg-violet-pale);
    color: var(--tc-msg-ink);
    border-radius: 14px 14px 14px 4px;
}
.tcMsgBubble--sent {
    background: linear-gradient(135deg, var(--tc-msg-violet), var(--tc-msg-violet-deep));
    color: #fff;
    border-radius: 14px 14px 4px 14px;
    align-self: flex-start;
}
.tcMsgGrp + .tcMsgGrp .tcMsgBubble--received {
    border-radius: 4px 14px 14px 4px;
}
.tcMsgGrp + .tcMsgGrp .tcMsgBubble--sent {
    border-radius: 14px 4px 4px 14px;
}

/* Réactions */
.tcMsgReactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}
.tcMsgReact {
    background: var(--tc-msg-surface);
    border: 1px solid var(--tc-msg-line);
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 600;
    color: var(--tc-msg-ink-2);
    cursor: pointer;
    transition: all .15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tcMsgReact:hover {
    border-color: var(--tc-msg-violet);
}
.tcMsgReact--active {
    background: var(--tc-msg-violet-pale);
    border-color: var(--tc-msg-violet);
    color: var(--tc-msg-violet-deep);
}
.tcMsgReact span { font-size: 14px; }

.tcMsgReactAdd {
    background: transparent;
    border: 1px dashed var(--tc-msg-line);
    border-radius: 999px;
    width: 26px;
    height: 22px;
    color: var(--tc-msg-ink-3);
    cursor: pointer;
    font-size: 12px;
    transition: all .15s;
}
.tcMsgReactAdd:hover {
    background: var(--tc-msg-violet-pale);
    border-color: var(--tc-msg-violet);
    color: var(--tc-msg-violet-deep);
}

/* Card de recette partagée dans le chat */
.tcMsgRecipeCard {
    margin-top: 6px;
    background: var(--tc-msg-surface);
    border: 1px solid var(--tc-msg-line);
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    transition: all .2s;
}
.tcMsgRecipeCard:hover {
    border-color: var(--tc-msg-violet);
    transform: translateY(-2px);
    box-shadow: var(--tc-msg-shadow-md);
}
.tcMsgRecipeCard__media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}
.tcMsgRecipeCard__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tcMsgRecipeCard__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, var(--tc-msg-amber), var(--tc-msg-amber-deep));
    color: #4F3A0F;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}
.tcMsgRecipeCard__body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tcMsgRecipeCard__body strong {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    font-size: 16px;
    color: var(--tc-msg-ink);
    line-height: 1.2;
}
.tcMsgRecipeCard__body span {
    font-size: 12px;
    color: var(--tc-msg-violet);
    font-weight: 600;
}

/* Indicateur de frappe */
.tcMsgTyping {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    color: var(--tc-msg-ink-3);
    font-size: 12px;
}
.tcMsgTyping strong {
    color: var(--tc-msg-ink);
    font-weight: 700;
}
.tcMsgTyping__dots {
    display: flex;
    gap: 3px;
}
.tcMsgTyping__dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--tc-msg-violet);
    animation: tcMsgTypingDot 1.2s infinite;
}
.tcMsgTyping__dots span:nth-child(2) { animation-delay: 0.2s; }
.tcMsgTyping__dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes tcMsgTypingDot {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

/* ============================================================
   COMPOSER (zone de saisie)
   ============================================================ */
.tcMsgChat__composer {
    padding: 12px 22px 20px;
    background: var(--tc-msg-surface);
    border-top: 1px solid var(--tc-msg-line-soft);
    flex-shrink: 0;
}

.tcMsgComposer {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--tc-msg-surface-soft);
    border: 1px solid var(--tc-msg-line);
    border-radius: 22px;
    padding: 6px 6px 6px 10px;
    transition: border-color .15s;
}
.tcMsgComposer:focus-within {
    border-color: var(--tc-msg-violet);
    box-shadow: 0 0 0 3px var(--tc-msg-violet-pale);
}

.tcMsgComposer__plus {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--tc-msg-violet-pale);
    border: none;
    color: var(--tc-msg-violet-deep);
    font-size: 20px;
    font-weight: 300;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all .15s;
    flex-shrink: 0;
}
.tcMsgComposer__plus:hover {
    background: var(--tc-msg-violet);
    color: #fff;
    transform: rotate(90deg);
}

.tcMsgComposer__inputWrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.tcMsgComposer__inputWrap input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    padding: 8px 6px;
    color: var(--tc-msg-ink);
    font-family: inherit;
}
.tcMsgComposer__inputWrap input::placeholder {
    color: var(--tc-msg-ink-3);
}

.tcMsgComposer__tools {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}
.tcMsgComposer__tool {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--tc-msg-ink-3);
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    display: grid;
    place-items: center;
    font-weight: 700;
    transition: all .15s;
}
.tcMsgComposer__tool:hover {
    background: var(--tc-msg-violet-pale);
    color: var(--tc-msg-violet-deep);
}

.tcMsgComposer__send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tc-msg-violet), var(--tc-msg-violet-deep));
    border: none;
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 16px;
    transition: all .15s;
    flex-shrink: 0;
}
.tcMsgComposer__send:hover:not(:disabled) {
    transform: scale(1.05) rotate(-15deg);
    box-shadow: 0 6px 18px rgba(107, 91, 230, 0.45);
}
.tcMsgComposer__send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tcMsgComposer__hint {
    margin-top: 6px;
    padding: 0 14px;
    font-size: 11px;
    color: var(--tc-msg-ink-3);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}
.tcMsgComposer__hint kbd {
    background: var(--tc-msg-surface-soft);
    border: 1px solid var(--tc-msg-line);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: ui-monospace, monospace;
    font-size: 10px;
    color: var(--tc-msg-ink-2);
    font-weight: 600;
}

/* ============================================================
   COL 4 : SIDEBAR INFO / MEMBRES
   ============================================================ */
.tcMsgInfo {
    background: var(--tc-msg-surface-soft);
    border-left: 1px solid var(--tc-msg-line-soft);
    overflow-y: auto;
    transition: width .25s ease;
}
.tcMsgInfo::-webkit-scrollbar { width: 6px; }
.tcMsgInfo::-webkit-scrollbar-thumb {
    background: var(--tc-msg-line);
    border-radius: 999px;
}
.tcMsgInfo.is-collapsed {
    width: 0;
    padding: 0;
    border-left: none;
}

.tcMsgInfoBanner {
    height: 100px;
    display: grid;
    place-items: center;
    font-size: 48px;
    color: #fff;
    position: relative;
}
.tcMsgInfoBanner--violet {
    background: linear-gradient(135deg, #6B5BE6, #4D3FCC);
}
.tcMsgInfoBanner--amber {
    background: linear-gradient(135deg, #F4B740, #D99A1C);
    color: #4F3A0F;
}
.tcMsgInfoBanner--rose {
    background: linear-gradient(135deg, #E85D75, #C73E58);
}

.tcMsgInfo__profile {
    background: var(--tc-msg-surface);
    border-bottom: 1px solid var(--tc-msg-line-soft);
}
.tcMsgInfo__main {
    padding: 16px 18px 18px;
    text-align: center;
}
.tcMsgInfo__main h2 {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    font-size: 19px;
    margin: 0 0 4px;
    color: var(--tc-msg-ink);
}
.tcMsgInfo__topic {
    font-size: 12px;
    color: var(--tc-msg-ink-3);
    display: block;
    margin-bottom: 8px;
}
.tcMsgInfo__desc {
    font-size: 12.5px;
    color: var(--tc-msg-ink-2);
    line-height: 1.5;
    margin: 0 0 14px;
}
.tcMsgInfo__statusLine {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--tc-msg-ink-3);
    margin-bottom: 14px;
}
.tcMsgInfo__statusDot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tc-msg-offline);
}
.tcMsgInfo__statusDot.is-online {
    background: var(--tc-msg-online);
}

.tcMsgInfo__quickActions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.tcMsgQuick {
    background: var(--tc-msg-surface-soft);
    border: 1px solid var(--tc-msg-line-soft);
    border-radius: 10px;
    padding: 8px 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all .15s;
    font-family: inherit;
}
.tcMsgQuick:hover {
    background: var(--tc-msg-violet-pale);
    border-color: var(--tc-msg-violet);
}
.tcMsgQuick span {
    font-size: 16px;
}
.tcMsgQuick small {
    font-size: 10.5px;
    color: var(--tc-msg-ink-2);
    font-weight: 600;
}

.tcMsgInfoSection {
    padding: 16px 18px;
    border-bottom: 1px solid var(--tc-msg-line-soft);
}
.tcMsgInfoSection h3 {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--tc-msg-ink-3);
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tcMsgInfoSection h3 span {
    background: var(--tc-msg-violet-pale);
    color: var(--tc-msg-violet-deep);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    letter-spacing: 0;
}

.tcMsgInfoMembers__cat {
    font-size: 10.5px;
    letter-spacing: 0.1em;
    color: var(--tc-msg-ink-3);
    margin: 8px 0 4px;
    font-weight: 600;
}

.tcMsgInfoMember {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 4px;
    border-radius: 8px;
    transition: background .15s;
    cursor: pointer;
}
.tcMsgInfoMember:hover {
    background: var(--tc-msg-violet-pale);
}
.tcMsgInfoMember--offline {
    opacity: 0.6;
}
.tcMsgInfoMember div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.tcMsgInfoMember strong {
    font-size: 12.5px;
    color: var(--tc-msg-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tcMsgInfoMember span {
    font-size: 11px;
    color: var(--tc-msg-ink-3);
}

/* Recettes épinglées */
.tcMsgInfoPinned {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.tcMsgInfoPin {
    display: flex;
    gap: 10px;
    background: var(--tc-msg-surface);
    border: 1px solid var(--tc-msg-line-soft);
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all .15s;
}
.tcMsgInfoPin:hover {
    border-color: var(--tc-msg-violet);
    transform: translateX(-2px);
}
.tcMsgInfoPin__media {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    overflow: hidden;
}
.tcMsgInfoPin__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tcMsgInfoPin__body {
    padding: 8px 8px 8px 0;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.tcMsgInfoPin__body strong {
    font-size: 12.5px;
    color: var(--tc-msg-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.tcMsgInfoPin__body span {
    font-size: 10.5px;
    color: var(--tc-msg-ink-3);
}

/* Grille de photos partagées */
.tcMsgInfoMediaGrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}
.tcMsgInfoMedia {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    background: var(--tc-msg-violet-pale);
    transition: all .15s;
}
.tcMsgInfoMedia img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}
.tcMsgInfoMedia:hover {
    transform: scale(0.96);
}
.tcMsgInfoMedia:hover img {
    transform: scale(1.1);
}

.tcMsgInfoEmpty {
    text-align: center;
    padding: 16px 10px;
    font-size: 12px;
    color: var(--tc-msg-ink-3);
    font-style: italic;
}

/* Switches */
.tcMsgSwitch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 13px;
    color: var(--tc-msg-ink);
    cursor: pointer;
}
.tcMsgSwitch input {
    display: none;
}
.tcMsgSwitch i {
    width: 36px;
    height: 20px;
    background: var(--tc-msg-line);
    border-radius: 999px;
    position: relative;
    transition: background .2s;
}
.tcMsgSwitch i::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.tcMsgSwitch input:checked + i {
    background: var(--tc-msg-violet);
}
.tcMsgSwitch input:checked + i::after {
    transform: translateX(16px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Desktop large : tout visible */
@media (max-width: 1280px) {
    .tcMsgApp {
        grid-template-columns: 64px 280px minmax(0, 1fr) 280px;
    }
    .tcMsgChat__messages {
        padding: 22px 24px 16px;
    }
}

/* Desktop / tablette large : la sidebar info devient un drawer */
@media (max-width: 1100px) {
    .tcMsgApp {
        grid-template-columns: 64px 280px minmax(0, 1fr);
    }

    /* Sidebar info en drawer slide-in depuis la droite */
    .tcMsgInfo {
        position: fixed;
        right: 0;
        top: var(--tc-msg-header-h);
        height: calc(100vh - var(--tc-msg-header-h));
        width: 320px;
        max-width: 90vw;
        transform: translateX(100%);
        transition: transform .3s ease;
        z-index: 200;
        box-shadow: -10px 0 40px rgba(27, 23, 51, 0.18);
        border-left: 1px solid var(--tc-msg-line-soft);
    }
    .tcMsgInfo.is-open {
        transform: translateX(0);
    }

    /* Bouton fermeture du drawer (visible seulement quand drawer ouvert) */
    .tcMsgInfo__closeBtn {
        position: absolute;
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.95);
        border: 1px solid var(--tc-msg-line);
        color: var(--tc-msg-ink);
        cursor: pointer;
        display: grid;
        place-items: center;
        font-size: 18px;
        z-index: 10;
        box-shadow: var(--tc-msg-shadow-sm);
    }
    .tcMsgInfo__closeBtn:hover {
        background: var(--tc-msg-violet);
        color: #fff;
    }

    /* Backdrop sombre derrière le drawer */
    .tcMsgInfoBackdrop {
        display: none;
        position: fixed;
        inset: var(--tc-msg-header-h) 0 0 0;
        background: rgba(15, 12, 35, 0.4);
        z-index: 150;
        opacity: 0;
        transition: opacity .3s;
    }
    .tcMsgInfoBackdrop.is-active {
        display: block;
        opacity: 1;
    }
}

/* Sur desktop large, on n'a PAS besoin du drawer ni du backdrop */
@media (min-width: 1101px) {
    .tcMsgInfo__closeBtn,
    .tcMsgInfoBackdrop {
        display: none !important;
    }
}

/* ============================================================
   TABLETTE (≤ 900px) : on cache le rail des salons et on transforme
   en mode "vues empilées" : Liste OU Chat
   ============================================================ */
@media (max-width: 900px) {
    .tcMsgPage {
        --tc-msg-header-h: 60px;
    }

    .tcMsgApp {
        grid-template-columns: 1fr;
        position: relative;
    }

    /* Rail Discord : devient un dock horizontal en haut OU caché */
    .tcMsgRail {
        position: fixed;
        left: 0;
        top: var(--tc-msg-header-h);
        height: calc(100vh - var(--tc-msg-header-h));
        width: 64px;
        z-index: 80;
        transform: translateX(-100%);
        transition: transform .25s;
    }
    .tcMsgApp.show-rail .tcMsgRail {
        transform: translateX(0);
    }

    /* Liste contacts : full width par défaut, slide gauche quand chat ouvert */
    .tcMsgList {
        position: relative;
        width: 100%;
        border-right: none;
        transition: transform .3s ease;
    }

    /* Chat : caché derrière, full width quand actif */
    .tcMsgChat {
        position: fixed;
        top: var(--tc-msg-header-h);
        left: 0;
        right: 0;
        height: calc(100vh - var(--tc-msg-header-h));
        z-index: 60;
        background: var(--tc-msg-surface);
        transform: translateX(100%);
        transition: transform .3s ease;
    }

    /* Quand l'app est en mode "chat ouvert" */
    .tcMsgApp.show-chat .tcMsgChat {
        transform: translateX(0);
    }

    /* Bouton retour à la liste depuis le chat */
    .tcMsgChat__back {
        display: grid;
        place-items: center;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: var(--tc-msg-violet-pale);
        border: none;
        color: var(--tc-msg-violet-deep);
        cursor: pointer;
        font-size: 20px;
        flex-shrink: 0;
        margin-right: 6px;
    }
    .tcMsgChat__back:hover {
        background: var(--tc-msg-violet);
        color: #fff;
    }

    /* Bouton menu pour ouvrir le rail des salons (depuis la liste) */
    .tcMsgList__menuBtn {
        display: grid;
        place-items: center;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: var(--tc-msg-violet-pale);
        border: none;
        color: var(--tc-msg-violet-deep);
        cursor: pointer;
        font-size: 18px;
        flex-shrink: 0;
        margin-right: 6px;
    }

    /* En tablette, masquer la sidebar info par défaut, elle reste en drawer */
    .tcMsgInfo {
        width: 100vw;
        max-width: 100vw;
    }

    /* Composer plus compact */
    .tcMsgChat__composer {
        padding: 10px 14px 14px;
    }
    .tcMsgComposer__hint {
        display: none;
    }
}

/* Sur desktop, le bouton back et le menu de la liste sont cachés */
@media (min-width: 901px) {
    .tcMsgChat__back,
    .tcMsgList__menuBtn {
        display: none !important;
    }
}

/* ============================================================
   MOBILE (≤ 640px) : adaptations finales
   ============================================================ */
@media (max-width: 640px) {
    .tcMsgApp {
        height: calc(100vh - var(--tc-msg-header-h));
    }

    /* Header chat : version compacte */
    .tcMsgChat__header {
        padding: 10px 14px;
        gap: 6px;
    }
    .tcMsgChat__title h1 {
        font-size: 16px;
    }
    .tcMsgChat__topic,
    .tcMsgChat__sep {
        display: none;
    }
    .tcMsgChat__actions .tcMsgIconBtn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    /* On garde uniquement les actions essentielles sur mobile */
    .tcMsgChat__actions .tcMsgIconBtn[title="Appel vocal"],
    .tcMsgChat__actions .tcMsgIconBtn[title="Épinglés"] {
        display: none;
    }

    /* List header */
    .tcMsgList__header {
        padding: 14px 14px 10px;
    }
    .tcMsgList__simpleHead h2 {
        font-size: 19px;
    }
    .tcMsgSearch {
        margin: 12px 14px 8px;
    }
    .tcMsgFilters {
        padding: 0 14px 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .tcMsgFilters::-webkit-scrollbar { display: none; }
    .tcMsgFilter {
        flex-shrink: 0;
    }
    .tcMsgList__scroll {
        padding: 0 8px 10px;
    }

    /* Footer profil */
    .tcMsgList__footer {
        padding: 8px 12px;
    }
    .tcMsgList__footerActions .tcMsgIconBtn {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }

    /* Messages : moins de padding latéral */
    .tcMsgChat__messages {
        padding: 16px 12px;
        gap: 16px;
    }

    /* Bulles : adapter la largeur max */
    .tcMsgBubble {
        max-width: calc(100vw - 80px);
        font-size: 14px;
    }

    /* Card recette dans le chat : plus compacte */
    .tcMsgRecipeCard {
        max-width: 100%;
    }

    /* Welcome banner plus compact */
    .tcMsgWelcome {
        padding: 24px 16px 16px;
    }
    .tcMsgWelcome__icon {
        width: 64px;
        height: 64px;
        font-size: 28px;
    }
    .tcMsgWelcome h2 {
        font-size: 22px;
    }

    /* Composer : compact */
    .tcMsgChat__composer {
        padding: 8px 10px 12px;
    }
    .tcMsgComposer {
        padding: 4px 4px 4px 6px;
    }
    .tcMsgComposer__plus {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    .tcMsgComposer__send {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }
    /* Sur mobile on cache GIF/recette/photo, on garde juste emoji + plus */
    .tcMsgComposer__tool[title="GIF"],
    .tcMsgComposer__tool[title="Photo"] {
        display: none;
    }

    /* Avatar groupe head plus compact */
    .tcMsgList__groupHead h2 {
        font-size: 16px;
    }
    .tcMsgList__groupEmoji {
        font-size: 26px;
    }

    /* Drawer info en plein écran sur mobile */
    .tcMsgInfo {
        width: 100vw;
        max-width: 100vw;
    }

    /* Banner du drawer info plus haute pour le toucher */
    .tcMsgInfoBanner {
        height: 80px;
        font-size: 38px;
    }
}

/* Très petit mobile (< 380px) */
@media (max-width: 380px) {
    .tcMsgChat__title h1 {
        font-size: 15px;
    }
    .tcMsgChat__actions {
        gap: 0;
    }
    .tcMsgChat__actions .tcMsgIconBtn {
        width: 30px;
        height: 30px;
    }
    .tcMsgChat__actions .tcMsgIconBtn[title="Visio"] {
        display: none;
    }
    .tcMsgWelcome h2 {
        font-size: 19px;
    }
    .tcMsgBubble {
        font-size: 13.5px;
        padding: 9px 12px;
    }
}