/*
 * Footer Network — v2
 * Uses theme tokens only. No hardcoded colours.
 */

/* ── Desktop popup wrapper ── */
.fn-wrap { width: 100%; position: relative; }

/* ── Trigger reuses .sidebar-login — no extra CSS needed ── */
/* Just mark it active when open */
.fn-trigger[aria-expanded="true"] { color: var(--text-primary); }

/* ── Popup card ── */
.fn-popup {
    position: fixed;
    left: calc(var(--sidebar-width) + 8px);  /* 72px + 8px gap */
    bottom: 20px;
    width: 230px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
    z-index: 9999;
    overflow: hidden;
    animation: fn-in .16s ease both;
}
.fn-popup[hidden] { display: none; }

@keyframes fn-in {
    from { opacity: 0; transform: scale(.95) translateY(6px); }
    to   { opacity: 1; transform: scale(1)   translateY(0);   }
}

/* Popup / modal shared header */
.fn-popup-head,
.fn-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px 9px;
    border-bottom: 1px solid var(--border-light);
}

.fn-popup-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: .5px;
    text-transform: uppercase;
}

.fn-popup-close {
    width: 22px; height: 22px;
    border: none; background: transparent;
    color: var(--text-tertiary); cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    padding: 0; transition: var(--transition);
}
.fn-popup-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.fn-popup-close svg   { width: 13px; height: 13px; }

/* Shared list */
.fn-popup-list {
    list-style: none;
    margin: 0; padding: 5px 0;
    max-height: 360px;
    overflow-y: auto;
}
.fn-popup-list::-webkit-scrollbar { width: 3px; }
.fn-popup-list::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }

/* Shared item — explicit flex so theme resets can't break it */
.fn-popup-item {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 10px;
    padding: 8px 14px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition);
}
.fn-popup-item:hover { background: var(--bg-hover); }
.fn-popup-item:hover .fn-arrow { opacity: 1; transform: translate(1px,-1px); }

.fn-avatar {
    width: 26px; height: 26px;
    border-radius: 7px;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    display: flex !important;
    align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
    line-height: 1;
}

/* Colored gradient icon tile variant */
.fn-avatar.fn-avatar-icon {
    border: none;
}
.fn-avatar.fn-avatar-icon svg {
    width: 10px !important;
    height: 10px !important;
    max-width: 10px !important;
    max-height: 10px !important;
    stroke: #fff;
    fill: none;
    flex-shrink: 0;
    display: block;
}

.fn-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fn-arrow {
    width: 12px; height: 12px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--transition), transform var(--transition);
}

/* ── Mobile modal overlay ── */
.fn-modal-overlay {
    display: none;
}

@media (max-width: 768px) {
    /* Desktop popup hidden on mobile */
    .fn-wrap   { display: none; }
    .fn-popup  { display: none !important; }

    /* Modal overlay */
    .fn-modal-overlay {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 10000;
        background: rgba(0,0,0,.45);
        align-items: flex-end;
        justify-content: center;
        animation: fn-overlay-in .2s ease both;
    }
    .fn-modal-overlay[hidden] { display: none; }

    @keyframes fn-overlay-in {
        from { background: rgba(0,0,0,0); }
        to   { background: rgba(0,0,0,.45); }
    }

    .fn-modal-card {
        width: 100%;
        max-height: 70vh;
        background: var(--bg-card);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        animation: fn-card-in .22s ease both;
    }

    @keyframes fn-card-in {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    .fn-popup-list {
        max-height: none;
        flex: 1;
        overflow-y: auto;
        padding: 8px 0 env(safe-area-inset-bottom, 0);
    }

    .fn-popup-item {
        padding: 12px 20px;
        font-size: 14px;
    }

    .fn-avatar {
        width: 30px; height: 30px;
        font-size: 13px;
    }

    .fn-arrow { opacity: 0.4; }
}
