/* ============================================================
   MEGA CHAT — Professional Dark Theme
   ============================================================ */

/* ── Wrapper principal ───────────────────────────────────── */
.mc-wrap {
    display: flex;
    flex-direction: column;
    height: 600px;
    max-width: 860px;
    margin: 0 auto;
    background: #0F1624;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(0,212,255,0.12);
    font-family: 'Montserrat', sans-serif;
}

/* ── Header ──────────────────────────────────────────────── */
.mc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(135deg, #0D1E3A 0%, #1A56DB 100%);
    border-bottom: 1px solid rgba(0,212,255,0.2);
    flex-shrink: 0;
}

.mc-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mc-header-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.mc-header-title {
    font-size: 1rem;
    font-weight: 800;
    color: #00D4FF;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mc-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00e676;
    box-shadow: 0 0 6px #00e676;
    animation: mc-pulse 2s ease-in-out infinite;
}

@keyframes mc-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.8); }
}

.mc-online {
    font-size: 0.72rem;
    color: #8B879E;
    margin-top: 2px;
}

.mc-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mc-me-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.8rem;
    color: #fff;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.25);
}

.mc-me-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #F0ECE3;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mc-logout-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: #F0ECE3;
    padding: 5px 9px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
}
.mc-logout-btn:hover { background: rgba(230,57,70,0.25); border-color: rgba(230,57,70,0.4); color: #ff6b6b; }

.mc-change-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #F0ECE3;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.mc-change-btn:hover { background: rgba(255,255,255,0.16); }

/* ── Zone messages ───────────────────────────────────────── */
.mc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #070B14;
    scroll-behavior: smooth;
}

.mc-messages::-webkit-scrollbar { width: 5px; }
.mc-messages::-webkit-scrollbar-track { background: transparent; }
.mc-messages::-webkit-scrollbar-thumb { background: rgba(0,212,255,0.25); border-radius: 4px; }

/* Séparateur de date */
.mc-date-sep {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    color: #8B879E;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.mc-date-sep::before,
.mc-date-sep::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(139,135,158,0.25);
}

/* ── Messages ────────────────────────────────────────────── */
.mc-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 80%;
    animation: mc-slide-in 0.2s ease-out;
}

@keyframes mc-slide-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mc-other { align-self: flex-start; }
.mc-own   { align-self: flex-end; flex-direction: row-reverse; }

.mc-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.7rem;
    color: #fff;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.15);
}

.mc-bubble-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mc-own .mc-bubble-wrap { align-items: flex-end; }

.mc-sender {
    font-size: 0.7rem;
    font-weight: 700;
    color: #8B879E;
    margin-bottom: 2px;
    padding-left: 4px;
}

.mc-bubble {
    position: relative;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.875rem;
    line-height: 1.45;
    word-break: break-word;
    background: #1A1625;
    color: #F0ECE3;
    max-width: 400px;
}

.mc-other .mc-bubble {
    border-bottom-left-radius: 4px;
    background: #162034;
}

.mc-own .mc-bubble {
    border-bottom-right-radius: 4px;
    color: #fff;
}

.mc-bubble:hover .mc-del-btn { opacity: 1; }

.mc-del-btn {
    opacity: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    margin-left: 8px;
    padding: 0;
    transition: opacity 0.15s;
    vertical-align: middle;
    line-height: 1;
}

.mc-time {
    font-size: 0.65rem;
    color: #8B879E;
    padding: 0 4px;
}

/* ── Zone saisie ─────────────────────────────────────────── */
.mc-input-area {
    position: relative;
    padding: 12px 16px;
    background: #0F1624;
    border-top: 1px solid rgba(0,212,255,0.12);
    flex-shrink: 0;
}

.mc-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #162034;
    border: 1px solid rgba(0,212,255,0.15);
    border-radius: 50px;
    padding: 6px 8px 6px 14px;
    transition: border-color 0.2s;
}

.mc-form:focus-within {
    border-color: rgba(0,212,255,0.45);
}

.mc-emoji-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.mc-emoji-toggle:hover { opacity: 1; }

.mc-text-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #F0ECE3;
    font-size: 0.9rem;
    font-family: 'Montserrat', sans-serif;
    padding: 4px 0;
    min-width: 0;
}
.mc-text-input::placeholder { color: #8B879E; }

.mc-send-btn {
    background: linear-gradient(135deg, #1A56DB, #2E70F5);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}
.mc-send-btn:hover { background: linear-gradient(135deg, #2E70F5, #00D4FF); box-shadow: 0 0 12px rgba(0,212,255,0.4); }
.mc-send-btn:active { transform: scale(0.92); }
.mc-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Emoji picker */
.mc-emoji-container {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 16px;
    background: #162034;
    border: 1px solid rgba(0,212,255,0.18);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    z-index: 100;
}
.mc-emoji-container.open { display: block; }

.mc-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.mc-emoji-item {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    border-radius: 6px;
    padding: 4px;
    line-height: 1;
    transition: background 0.15s;
}
.mc-emoji-item:hover { background: rgba(0,212,255,0.12); }

.mc-error {
    font-size: 0.75rem;
    color: #ff5252;
    margin-top: 6px;
    padding-left: 14px;
    min-height: 16px;
}

/* ── Écran de configuration ──────────────────────────────── */
.mc-setup {
    max-width: 420px;
    margin: 40px auto;
    padding: 36px 32px;
    background: #0F1624;
    border-radius: 20px;
    box-shadow: 0 8px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(0,212,255,0.12);
    text-align: center;
    font-family: 'Montserrat', sans-serif;
}

.mc-setup-logo {
    font-size: 3rem;
    margin-bottom: 12px;
}

.mc-setup-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: #00D4FF;
    margin: 0 0 6px;
}

.mc-setup-sub {
    font-size: 0.85rem;
    color: #8B879E;
    margin: 0 0 24px;
}

.mc-setup-input {
    width: 100%;
    background: #162034;
    border: 1px solid rgba(0,212,255,0.25);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-family: 'Montserrat', sans-serif;
    color: #F0ECE3;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
    margin-bottom: 20px;
}
.mc-setup-input:focus { border-color: #00D4FF; }
.mc-setup-input::placeholder { color: #8B879E; }

.mc-setup-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #8B879E;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 12px;
    text-align: left;
}

.mc-color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 24px;
}

.mc-color-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    padding: 0;
}
.mc-color-btn:hover { transform: scale(1.15); }
.mc-color-btn.selected {
    border-color: #fff;
    transform: scale(1.2);
    box-shadow: 0 0 0 2px rgba(0,212,255,0.5);
}

.mc-setup-submit {
    width: 100%;
    background: linear-gradient(135deg, #1A56DB, #2E70F5);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 13px 24px;
    font-size: 1rem;
    font-weight: 800;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: opacity 0.2s, transform 0.1s;
}
.mc-setup-submit:hover { opacity: 0.9; }
.mc-setup-submit:active { transform: scale(0.97); }

/* ── Layout sidebar + main ───────────────────────────────── */
.mc-wrap {
    flex-direction: column;
}

.mc-notice {
    background: rgba(26, 86, 219, 0.12);
    border-bottom: 1px solid rgba(26, 86, 219, 0.25);
    color: #93b4f7;
    font-size: 10px;
    padding: 5px 14px;
    text-align: center;
    letter-spacing: .02em;
}
.mc-notice strong { color: #b8ccff; }

.mc-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.mc-sidebar {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #080E1C;
    border-right: 1px solid rgba(0,212,255,0.1);
    overflow-y: auto;
    overflow-x: hidden;
}
.mc-sidebar::-webkit-scrollbar { width: 3px; }
.mc-sidebar::-webkit-scrollbar-thumb { background: rgba(0,212,255,0.2); border-radius: 2px; }

.mc-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #070B14;
}

/* ── Sidebar sections ────────────────────────────────────── */
.mc-sidebar-section {
    padding: 12px 0 6px;
}

.mc-employees-section {
    flex: 1;
    border-top: 1px solid rgba(0,212,255,0.08);
    margin-top: 4px;
}

.mc-sidebar-title {
    font-size: 0.62rem;
    font-weight: 800;
    color: #8B879E;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0 14px 8px;
}

.mc-sidebar-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px 8px 14px;
}

.mc-sidebar-loading {
    font-size: 0.75rem;
    color: #8B879E;
    padding: 8px 14px;
}

/* ── Canal items ─────────────────────────────────────────── */
.mc-ch-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    border-radius: 8px;
    margin: 1px 6px;
    transition: background 0.15s;
    min-width: 0;
}
.mc-ch-item:hover { background: rgba(0,212,255,0.07); }
.mc-ch-item.mc-ch-active { background: rgba(26,86,219,0.35); }

.mc-ch-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.mc-ch-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.65rem;
    color: #fff;
    flex-shrink: 0;
}

.mc-ch-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mc-ch-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #D0CCE0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mc-ch-item.mc-ch-active .mc-ch-name { color: #fff; }

.mc-ch-last {
    font-size: 0.65rem;
    color: #8B879E;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mc-badge {
    background: #E63946;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    border-radius: 10px;
    padding: 1px 6px;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* ── Employee items ──────────────────────────────────────── */
.mc-emp-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 8px;
    margin: 1px 6px;
}
.mc-emp-item:hover { background: rgba(0,212,255,0.07); }
.mc-emp-item:hover .mc-dm-btn { opacity: 1; }

.mc-emp-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.68rem;
    color: #fff;
    flex-shrink: 0;
}

.mc-emp-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mc-emp-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: #D0CCE0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mc-emp-dot {
    font-size: 0.62rem;
    color: #8B879E;
}

.mc-dm-btn {
    background: rgba(0,212,255,0.1);
    border: 1px solid rgba(0,212,255,0.2);
    border-radius: 6px;
    color: #00D4FF;
    font-size: 0.75rem;
    padding: 3px 7px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    flex-shrink: 0;
}
.mc-dm-btn:hover { background: rgba(0,212,255,0.2); }

.mc-new-group-btn {
    background: rgba(0,212,255,0.1);
    border: 1px solid rgba(0,212,255,0.25);
    border-radius: 6px;
    color: #00D4FF;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 8px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.mc-new-group-btn:hover { background: rgba(0,212,255,0.2); }

/* ── Channel header ──────────────────────────────────────── */
.mc-channel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #0A1020;
    border-bottom: 1px solid rgba(0,212,255,0.1);
    flex-shrink: 0;
    font-size: 0.88rem;
    font-weight: 800;
    color: #F0ECE3;
}

.mc-channel-header-icon { font-size: 1rem; }
.mc-channel-header-name { color: #F0ECE3; }

/* ── Vide ────────────────────────────────────────────────── */
.mc-empty {
    text-align: center;
    color: #8B879E;
    margin-top: 40px;
    font-size: 0.85rem;
}

/* ── Sidebar toggle (mobile) ─────────────────────────────── */
.mc-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: #F0ECE3;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 6px 0 0;
    line-height: 1;
}

/* ── Modal groupe ────────────────────────────────────────── */
.mc-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.mc-modal {
    background: #0F1624;
    border: 1px solid rgba(0,212,255,0.2);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 16px 64px rgba(0,0,0,0.8);
}

.mc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1rem;
    font-weight: 800;
    color: #00D4FF;
}

.mc-modal-close {
    background: none;
    border: none;
    color: #8B879E;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s;
}
.mc-modal-close:hover { color: #F0ECE3; }

.mc-modal-input {
    background: #162034;
    border: 1px solid rgba(0,212,255,0.25);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: 'Montserrat', sans-serif;
    color: #F0ECE3;
    outline: none;
    transition: border-color 0.2s;
}
.mc-modal-input:focus { border-color: #00D4FF; }
.mc-modal-input::placeholder { color: #8B879E; }

.mc-modal-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #8B879E;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.mc-member-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 260px;
}
.mc-member-list::-webkit-scrollbar { width: 3px; }
.mc-member-list::-webkit-scrollbar-thumb { background: rgba(0,212,255,0.2); border-radius: 2px; }

.mc-member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.mc-member-item:hover { background: rgba(0,212,255,0.08); }

.mc-member-check { accent-color: #00D4FF; width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }
.mc-member-name { flex: 1; font-size: 0.82rem; font-weight: 600; color: #D0CCE0; }

.mc-modal-submit {
    background: linear-gradient(135deg, #1A56DB, #2E70F5);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 11px 20px;
    font-size: 0.9rem;
    font-weight: 800;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: opacity 0.2s;
}
.mc-modal-submit:hover { opacity: 0.9; }

.mc-modal-error {
    font-size: 0.75rem;
    color: #ff5252;
    min-height: 16px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 680px) {
    .mc-sidebar-toggle { display: block; }

    .mc-sidebar {
        position: absolute;
        left: 0; top: 0; bottom: 0;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        width: 260px;
        border-radius: 0 16px 16px 0;
        box-shadow: 4px 0 24px rgba(0,0,0,0.6);
    }
    .mc-sidebar.mc-sidebar-open { transform: translateX(0); }

    .mc-body { position: relative; }
    .mc-wrap { height: 520px; border-radius: 0; }
    .mc-me-name { display: none; }
    .mc-emoji-grid { grid-template-columns: repeat(6, 1fr); }
    .mc-msg { max-width: 92%; }
}
