/* ============================================================
   discord-friends.css — Eclipse Zone
   Sistema de amigos y DMs fullscreen estilo Discord
   Totalmente adaptado para móvil
   ============================================================ */

/* ─────────────────────────────────────────────────────────────
   OVERLAY DE AMIGOS
   ───────────────────────────────────────────────────────────── */

.friends-overlay {
    position: fixed;
    inset: 0;
    z-index: 12500;
    display: none;
    background: var(--bg, #313338);
}

.friends-overlay.fo-open {
    display: flex;
    animation: foSlideIn .22s cubic-bezier(.25,.46,.45,.94);
}

.dmf-screen {
    animation: foSlideIn .22s cubic-bezier(.25,.46,.45,.94);
}

@keyframes foSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* En desktop se mantiene como fade simple */
@media (min-width: 769px) {
    .friends-overlay.fo-open,
    .dmf-screen {
        animation: foFadeIn .18s ease;
    }
}

@keyframes foFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Layout: sidebar + main ─────────────────────────────────── */
.fo-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

/* ── Sidebar izquierdo (DMs) ─────────────────────────────────── */
.fo-sidebar {
    width: 240px;
    min-width: 200px;
    background: var(--card-bg, #2b2d31);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    scrollbar-width: thin;
}

.fo-sidebar::-webkit-scrollbar { width: 3px; }
.fo-sidebar::-webkit-scrollbar-thumb { background: var(--primary-color, #5865F2); border-radius: 3px; }

.fo-sidebar-header {
    padding: 12px 10px 6px;
}

.fo-sidebar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.25);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: .8rem;
    color: var(--ds-muted, #949ba4);
}

.fo-sidebar-search input {
    background: none;
    border: none;
    outline: none;
    color: var(--ds-text, #f2f3f5);
    font-size: .82rem;
    width: 100%;
}

.fo-sidebar-label {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ds-muted, #949ba4);
    padding: 14px 10px 6px;
}

.fo-dm-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 6px 8px;
}

.fo-dm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
}

.fo-dm-item:hover {
    background: rgba(255,255,255,0.07);
}

.fo-dm-item.active {
    background: rgba(var(--primary-rgb, 88,101,242), .2);
}

.fo-dm-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--primary-color, #5865F2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: .85rem;
}

.fo-dm-info {
    flex: 1;
    min-width: 0;
}

.fo-dm-name {
    font-size: .85rem;
    font-weight: 600;
    color: var(--ds-text, #f2f3f5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fo-dm-last {
    font-size: .72rem;
    color: var(--ds-muted, #949ba4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fo-dm-avatar-txt {
    background: var(--primary-color, #5865F2);
    color: #fff;
    font-weight: 700;
    font-size: .85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
}

.fo-dm-empty {
    padding: 16px 12px;
    font-size: .8rem;
    color: var(--ds-muted, #949ba4);
    text-align: center;
    line-height: 1.6;
}

.fo-dm-empty-btn {
    margin-top: 8px;
    background: var(--primary-color, #5865F2);
    border: none;
    color: #fff;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-block;
}

.fo-dm-empty-btn:hover { background: #4752c4; }

/* ── Área principal ─────────────────────────────────────────── */
.fo-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.fo-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    height: 56px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: var(--bg, #313338);
    flex-shrink: 0;
}

.fo-topbar-back {
    display: none; /* Solo en móvil */
    background: none;
    border: none;
    color: var(--ds-text, #f2f3f5);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    line-height: 1;
}

.fo-topbar-icon {
    font-size: 1.15rem;
    color: var(--ds-muted, #949ba4);
}

.fo-topbar-title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--ds-text, #f2f3f5);
    margin-right: 8px;
    white-space: nowrap;
}

/* ── Nav tabs ───────────────────────────────────────────────── */
.fo-nav-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}

.fo-nav-tabs::-webkit-scrollbar { display: none; }

.fo-tab {
    background: none;
    border: none;
    color: var(--ds-muted, #949ba4);
    font-size: .85rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.fo-tab:hover {
    background: rgba(255,255,255,0.07);
    color: var(--ds-text, #f2f3f5);
}

.fo-tab.active {
    background: rgba(255,255,255,0.1);
    color: var(--ds-text, #f2f3f5);
}

.fo-tab-primary {
    background: var(--primary-color, #5865F2) !important;
    color: #fff !important;
}

.fo-tab-primary:hover {
    background: #4752c4 !important;
    color: #fff !important;
}

.fo-tab-badge {
    background: #f23f43;
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 5px;
    min-width: 16px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fo-topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

/* ── Cuerpo del tab ─────────────────────────────────────────── */
.fo-tab-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    scrollbar-width: thin;
}

.fo-tab-body::-webkit-scrollbar { width: 3px; }
.fo-tab-body::-webkit-scrollbar-thumb { background: var(--primary-color, #5865F2); border-radius: 3px; }

/* ── Estado vacío / carga ─────────────────────────────────── */
.fo-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 24px;
    color: var(--ds-muted, #949ba4);
    text-align: center;
}

.fo-empty i {
    font-size: 3rem;
    opacity: .25;
}

.fo-empty p {
    font-size: .9rem;
    margin: 0;
}

.fo-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--ds-muted, #949ba4);
    font-size: .85rem;
}

/* ── Lista de amigos ────────────────────────────────────────── */
.fo-list-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--ds-muted, #949ba4);
    padding: 0 0 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 4px;
}

.fo-friend-list {
    display: flex;
    flex-direction: column;
}

.fo-friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.fo-friend-item:last-child { border-bottom: none; }

.fo-friend-item:hover {
    background: rgba(255,255,255,0.06);
}

.fo-friend-item:hover .fo-friend-actions { opacity: 1; }

.fo-friend-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.fo-friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.fo-friend-avatar-txt {
    background: var(--primary-color, #5865F2);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fo-friend-status {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 2px solid var(--bg, #313338);
}

.fo-friend-status.online  { background: #23a559; }
.fo-friend-status.offline { background: #80848e; }
.fo-friend-status.idle    { background: #f0b232; }
.fo-friend-status.dnd     { background: #f23f43; }

.fo-friend-info {
    flex: 1;
    min-width: 0;
}

.fo-friend-name {
    font-size: .9rem;
    font-weight: 600;
    color: var(--ds-text, #f2f3f5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fo-friend-subtext {
    font-size: .75rem;
    color: var(--ds-muted, #949ba4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fo-friend-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity .15s;
    flex-shrink: 0;
}

/* Siempre visible en móvil */
@media (max-width: 640px) {
    .fo-friend-actions { opacity: 1; }
}

/* ── Botones de icono ────────────────────────────────────────── */
.fo-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.07);
    border: none;
    color: var(--ds-muted, #949ba4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    transition: all .15s;
}

.fo-icon-btn:hover { background: rgba(255,255,255,0.13); color: var(--ds-text,#f2f3f5); }
.fo-icon-btn.fo-icon-success { color: #23a559; }
.fo-icon-btn.fo-icon-success:hover { background: rgba(35,165,89,.2); }
.fo-icon-btn.fo-icon-danger  { color: #f23f43; }
.fo-icon-btn.fo-icon-danger:hover  { background: rgba(242,63,67,.2); }

/* ── Sección Añadir amigo ─────────────────────────────────── */
.fo-add-section {
    max-width: 500px;
    padding: 24px 0;
}

.fo-add-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ds-text, #f2f3f5);
    margin-bottom: 6px;
}

.fo-add-desc {
    font-size: .85rem;
    color: var(--ds-muted, #949ba4);
    margin-bottom: 16px;
}

.fo-add-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.fo-add-input {
    flex: 1;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--ds-text, #f2f3f5);
    font-size: .88rem;
    outline: none;
    transition: border-color .15s;
}

.fo-add-input:focus { border-color: var(--primary-color, #5865F2); }

.fo-add-msg {
    margin-top: 10px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: .82rem;
    display: flex;
    align-items: center;
    gap: 7px;
}

.fo-msg-success { background: rgba(35,165,89,.15); color: #23a559; }
.fo-msg-error   { background: rgba(242,63,67,.15);  color: #f23f43; }
.fo-msg-info    { background: rgba(88,101,242,.15); color: var(--primary-color,#5865F2); }

/* ── Botones generales ─────────────────────────────────────── */
.fo-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--ds-text, #f2f3f5);
    border-radius: 8px;
    padding: 9px 18px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}

.fo-btn:hover { background: rgba(255,255,255,0.07); }

.fo-btn-primary {
    background: var(--primary-color, #5865F2) !important;
    border-color: transparent !important;
    color: #fff !important;
}

.fo-btn-primary:hover { background: #4752c4 !important; }

/* ════════════════════════════════════════════════════════
   DM FULLSCREEN — pantalla de mensajes estilo Discord móvil
   ════════════════════════════════════════════════════════ */

.dmf-screen {
    position: fixed;
    inset: 0;
    z-index: 13000;
    background: var(--bg, #313338);
    display: none;
    flex-direction: column;
}

.dmf-screen.dmf-open {
    display: flex;
    animation: foSlideIn .22s cubic-bezier(.25,.46,.45,.94);
}

/* ── Header del DM ─────────────────────────────────────────── */
.dmf-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    height: 56px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: var(--bg, #313338);
    flex-shrink: 0;
}

.dmf-back-btn {
    background: none;
    border: none;
    color: var(--ds-text, #f2f3f5);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    line-height: 1;
    transition: background .15s;
}

.dmf-back-btn:hover { background: rgba(255,255,255,0.07); }

.dmf-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.dmf-avatar-txt {
    background: var(--primary-color, #5865F2);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.dmf-header-info {
    flex: 1;
    min-width: 0;
}

.dmf-header-name {
    font-size: .95rem;
    font-weight: 700;
    color: var(--ds-text, #f2f3f5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dmf-header-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .7rem;
    color: var(--ds-muted, #949ba4);
}

.dmf-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #23a559;
    flex-shrink: 0;
}

.dmf-icon-btn {
    background: none;
    border: none;
    color: var(--ds-muted, #949ba4);
    font-size: 1rem;
    cursor: pointer;
    padding: 7px;
    border-radius: 6px;
    line-height: 1;
    transition: all .15s;
    flex-shrink: 0;
}

.dmf-icon-btn:hover { background: rgba(255,255,255,0.07); color: var(--ds-text,#f2f3f5); }

/* ── Área de mensajes ─────────────────────────────────────── */
.dmf-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
}

.dmf-messages::-webkit-scrollbar { width: 3px; }
.dmf-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }

/* ── Mensaje individual ───────────────────────────────────── */
.dmf-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 100%;
}

.dmf-message.own {
    flex-direction: row-reverse;
}

.dmf-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 2px;
}

.dmf-msg-body {
    display: flex;
    flex-direction: column;
    max-width: 75%;
}

.dmf-message.own .dmf-msg-body { align-items: flex-end; }

.dmf-msg-name {
    font-size: .7rem;
    font-weight: 700;
    color: var(--ds-muted, #949ba4);
    margin-bottom: 2px;
    padding: 0 4px;
}

.dmf-msg-bubble {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
}

.dmf-msg-text {
    background: rgba(255,255,255,0.07);
    border-radius: 18px 18px 18px 4px;
    padding: 8px 14px;
    font-size: .88rem;
    color: var(--ds-text, #f2f3f5);
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
    max-width: 100%;
}

.dmf-message.own .dmf-msg-text {
    background: var(--primary-color, #5865F2);
    color: #fff;
    border-radius: 18px 18px 4px 18px;
}

.dmf-sticker {
    max-width: 160px;
    max-height: 160px;
    border-radius: 8px;
    display: block;
}

.dmf-msg-time {
    font-size: .62rem;
    color: var(--ds-muted, #949ba4);
    margin-top: 3px;
    padding: 0 4px;
}

/* ── Botón reply en bubble ────────────────────────────────── */
.dmf-reply-btn {
    display: none;
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--ds-muted, #949ba4);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: .72rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: color .15s, border-color .15s;
    line-height: 1;
}

.dmf-reply-btn:hover { color: var(--primary-color,#5865F2); border-color: var(--primary-color,#5865F2); }
.dmf-message:hover .dmf-reply-btn { display: inline-flex; align-items: center; }

/* siempre en móvil */
@media (max-width: 640px) {
    .dmf-message .dmf-reply-btn { display: inline-flex; align-items: center; }
}

/* ── Cita de reply ──────────────────────────────────────────── */
.dmf-reply-quote {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: rgba(255,255,255,0.06);
    border-left: 3px solid var(--primary-color, #5865F2);
    border-radius: 4px;
    font-size: .74rem;
    color: var(--ds-muted, #949ba4);
    margin-bottom: 4px;
    max-width: 100%;
    overflow: hidden;
}

.dmf-reply-quote i { color: var(--primary-color, #5865F2); flex-shrink: 0; }

.dmf-reply-author {
    font-weight: 700;
    color: var(--primary-color, #5865F2);
    white-space: nowrap;
    flex-shrink: 0;
}

.dmf-reply-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Barra de reply activa ──────────────────────────────────── */
.dmf-reply-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(88,101,242,.08);
    border-top: 1px solid rgba(88,101,242,.2);
    font-size: .78rem;
    color: var(--ds-muted, #949ba4);
    flex-shrink: 0;
    animation: slideUp .15s ease;
}

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

/* ── Barra de input ─────────────────────────────────────────── */
.dmf-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 10px 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: var(--bg, #313338);
    flex-shrink: 0;
}

.dmf-input-action {
    background: none;
    border: none;
    color: var(--ds-muted, #949ba4);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    line-height: 1;
    flex-shrink: 0;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.dmf-input-action:hover { color: var(--ds-text,#f2f3f5); background: rgba(255,255,255,0.07); }

.dmf-send-btn {
    color: var(--primary-color, #5865F2) !important;
}

.dmf-send-btn:hover { background: rgba(88,101,242,.15) !important; }

.dmf-input-wrap {
    flex: 1;
    background: rgba(255,255,255,0.07);
    border-radius: 22px;
    padding: 2px 12px;
    display: flex;
    align-items: center;
    min-height: 40px;
}

.dmf-input {
    background: none;
    border: none;
    outline: none;
    color: var(--ds-text, #f2f3f5);
    font-size: .9rem;
    width: 100%;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
    padding: 6px 0;
    scrollbar-width: thin;
}

.dmf-input::placeholder { color: var(--ds-muted, #949ba4); }

/* ════════════════════════════════════════════════════════
   RESPONSIVE — MÓVIL
   ════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* Ocultar sidebar en móvil */
    .fo-sidebar { display: none; }

    /* Topbar compacto */
    .fo-topbar {
        padding: 0 10px;
        gap: 6px;
        flex-wrap: nowrap;
        overflow: hidden;
    }

    .fo-topbar-back { display: flex; }

    .fo-topbar-title { font-size: .85rem; }

    /* Tabs scrollable horizontal */
    .fo-nav-tabs {
        gap: 2px;
    }

    .fo-tab {
        font-size: .75rem;
        padding: 5px 8px;
    }

    /* Tab body full */
    .fo-tab-body {
        padding: 14px 12px;
    }

    /* Añadir amigo: input vertical en móvil */
    .fo-add-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .fo-btn { width: 100%; justify-content: center; }

    /* Amigos: acciones siempre visibles */
    .fo-friend-actions { opacity: 1; }

    /* DM mensajes: burbujas más anchas */
    .dmf-msg-body { max-width: 82%; }
}

@media (max-width: 400px) {
    .fo-tab { font-size: .7rem; padding: 4px 6px; }
    .fo-topbar-icon { display: none; }
    .fo-topbar-title { display: none; }
}

/* ── Safe area iOS ──────────────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .dmf-input-bar {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
    .friends-overlay {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
