/* ==========================================================================
   Haru Live
   Recent Channels
   ========================================================================== */

.recent-channels {
    --rc-bg: #ffffff;
    --rc-soft-bg: #f8fafc;
    --rc-border: #e5e7eb;
    --rc-border-soft: #eef2f7;
    --rc-text: #111827;
    --rc-soft: #475569;
    --rc-muted: #94a3b8;
    --rc-blue: #2563eb;
    --rc-red: #dc2626;
    width: 100%;
    margin-bottom: 6px;
}

.recent-channels *,
.recent-channels *::before,
.recent-channels *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   PC - Collapsed
   ========================================================================== */

.recent-channels__collapsed {
    width: 100%;
    min-width: 0;

    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;

    gap: 12px;

    min-height: 48px;
    padding: 8px 12px;

    border: 1px solid var(--rc-border);
    border-radius: 10px;

    background: var(--rc-bg);

    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}

.recent-channels__label {
    flex: 0 0 auto;

    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;

    color: var(--rc-text);

    white-space: nowrap;
}

.recent-channels__collapsed-list {
    min-width: 0;

    display: flex;
    align-items: center;

    gap: 8px;

    overflow: hidden;

    white-space: nowrap;
}

.recent-channels__toggle {
    flex: 0 0 auto;

    width: 34px;
    height: 34px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid #d1d5db;
    border-radius: 8px;

    background: #fff;

    color: #475569;

    cursor: pointer;

    transition:
        background .15s ease,
        border-color .15s ease,
        color .15s ease;
}

.recent-channels__toggle:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    color: #111827;
}

.recent-channels__toggle-icon {
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}

/* ==========================================================================
   PC - Expanded
   ========================================================================== */

.recent-channels__expanded {
    width: 100%;

    border: 1px solid var(--rc-border);
    border-radius: 12px;

    background: var(--rc-bg);

    box-shadow:
        0 1px 2px rgba(15, 23, 42, .03),
        0 4px 14px rgba(15, 23, 42, .035);

    overflow: hidden;
}

.recent-channels__expanded.hidden,
.recent-channels__collapsed.hidden {
    display: none !important;
}

.recent-channels__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 14px;

    padding: 14px 16px;

    border-bottom: 1px solid var(--rc-border-soft);
}

.recent-channels__title {
    margin: 0;

    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;

    color: var(--rc-text);
}

.recent-channels__description {
    margin: 4px 0 0;

    font-size: 12px;
    line-height: 1.45;

    color: #94a3b8;

    word-break: keep-all;
}

.recent-channels__close {
    flex: 0 0 auto;

    width: 32px;
    height: 32px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid #e5e7eb;
    border-radius: 8px;

    background: #fff;

    font-size: 20px;
    font-weight: 700;
    line-height: 1;

    color: #64748b;

    cursor: pointer;

    transition:
        border-color .15s ease,
        background .15s ease,
        color .15s ease;
}

.recent-channels__close:hover {
    border-color: #fecaca;
    background: #fef2f2;
    color: #dc2626;
}

.recent-channels__body {
    padding: 14px 16px;
}

.recent-channels__grid {
    display: flex;
    flex-wrap: wrap;

    gap: 8px;
}

/* ==========================================================================
   PC - Channel Chip
   ========================================================================== */

.recent-channel-chip {
    min-width: 0;
    max-width: 100%;

    min-height: 34px;

    display: inline-flex;
    align-items: center;

    gap: 4px;

    padding: 5px 6px 5px 10px;

    border: 1px solid #e2e8f0;
    border-radius: 999px;

    background: #fff;

    transition:
        background .15s ease,
        border-color .15s ease;
}

.recent-channel-chip:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.recent-channel-chip--compact {
    flex: 0 0 auto;

    min-height: 32px;

    padding: 4px 5px 4px 9px;

    background: #f8fafc;
}

.recent-channel-chip__link {
    min-width: 0;
    max-width: 180px;

    overflow: hidden;

    font-size: 12px;
    font-weight: 700;
    line-height: 1;

    color: #334155;

    text-decoration: none;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-channel-chip__link:hover {
    color: var(--rc-blue);
}

.recent-channel-chip__delete-form {
    flex: 0 0 auto;

    display: inline-flex;

    margin: 0;
}

.recent-channel-chip__delete {
    width: 22px;
    height: 22px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: transparent;

    font-size: 14px;
    font-weight: 700;
    line-height: 1;

    color: #94a3b8;

    cursor: pointer;
}

.recent-channel-chip__delete:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* ==========================================================================
   PC - Footer
   ========================================================================== */

.recent-channels__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    padding: 10px 16px;

    border-top: 1px solid var(--rc-border-soft);

    background: #fafafa;
}

.recent-channels__count {
    font-size: 12px;

    color: #94a3b8;
}

.recent-channels__delete-all {
    min-height: 32px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 6px 9px;

    border: 1px solid #fecaca;
    border-radius: 7px;

    background: #fff;

    font-size: 12px;
    font-weight: 700;
    line-height: 1;

    color: #dc2626;

    cursor: pointer;
}

.recent-channels__delete-all:hover {
    background: #fef2f2;
}

/* ==========================================================================
   Mobile
   ========================================================================== */

@media screen and (max-width: 640px) {

    .recent-channels {
        margin-bottom: 8px;
    }

    .recent-channels__collapsed {
        gap: 6px;

        min-height: 38px;

        padding: 5px 6px;

        border-radius: 8px;
    }

    .recent-channels__label {
        font-size: 10px;
    }

    .recent-channels__collapsed-list {
        gap: 4px;
    }

    .recent-channels__toggle {
        width: 28px;
        height: 28px;

        border-radius: 6px;
    }

    .recent-channels__toggle-icon {
        font-size: 12px;
    }

    .recent-channels__expanded {
        border-radius: 9px;
    }

    .recent-channels__header {
        gap: 7px;

        padding: 8px 9px;
    }

    .recent-channels__title {
        font-size: 8.5px;
    }

    .recent-channels__description {
        margin-top: 2px;

        font-size: 6px;
    }

    .recent-channels__close {
        width: 26px;
        height: 26px;

        border-radius: 6px;

        font-size: 14px;
    }

    .recent-channels__body {
        padding: 8px;
    }

    .recent-channels__grid {
        gap: 5px;
    }

    .recent-channel-chip {
        min-height: 27px;

        padding: 3px 4px 3px 7px;
    }

    .recent-channel-chip--compact {
        min-height: 25px;

        padding: 3px 3px 3px 6px;
    }

    .recent-channel-chip__link {
        max-width: 120px;

        font-size: 6.5px;
    }

    .recent-channel-chip__delete {
        width: 18px;
        height: 18px;

        font-size: 12px;
    }

    .recent-channels__footer {
        padding: 7px 8px;
    }

    .recent-channels__count {
        font-size: 6px;
    }

    .recent-channels__delete-all {
        min-height: 26px;

        padding: 4px 6px;

        font-size: 6px;
    }

}

/* ==========================================================================
   <= 390px
   ========================================================================== */

@media screen and (max-width: 390px) {

    .recent-channels__collapsed {
        grid-template-columns:
            auto
            minmax(0, 1fr)
            auto;
    }

    .recent-channels__label {
        max-width: 72px;

        overflow: hidden;

        text-overflow: ellipsis;
    }

    .recent-channel-chip__link {
        max-width: 100px;
    }

}

/* ==========================================================================
   <= 350px
   ========================================================================== */

@media screen and (max-width: 350px) {

    .recent-channels__label {
        display: none;
    }

    .recent-channels__collapsed {
        grid-template-columns:
            minmax(0, 1fr)
            auto;
    }

    .recent-channels__footer {
        align-items: stretch;

        flex-direction: column;
    }

    .recent-channels__delete-all {
        width: 100%;
    }

}