/* The website builder card at the foot of the sidebar, its icon in the collapsed rail, and the list of websites it
   opens when the customer has several (Components/Layout/BuilderCard.razor). The card has the same look as
   WebbuilderWeb's sidebar upgrade card. */

/* ==========
     card
   ========== */

.bdc {
    position: relative;
}

.bdc-card {
    position: relative;
    margin-bottom: 8px;
    padding: 18px;
    border-radius: 20px;
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(150deg, #29075C 0%, #5524B5 58%, #8F5BE6 100%);
    color: #FFFFFF;
}

/* Soft peach glow in the corner of the card */
.bdc-card::after {
    content: "";
    position: absolute;
    top: -40px;
    right: -40px;
    z-index: -1;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 183, 165, 0.45) 0%, transparent 70%);
}

.bdc-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    font-size: 19px;
    color: var(--app-color-white);
}

.bdc-title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
}

.bdc-text {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.78);
}

/* The shared white button for a dark card (app-btn-inverse); the card only places it */
.bdc-btn {
    width: 100%;
    margin-top: 14px;
}

/* The single icon that stands for the card in the collapsed rail */
.bdc-mini {
    display: none;
}

.bdc-mini .ml-nav-icon {
    color: var(--app-accent);
}

.ml-rail .bdc-card {
    display: none;
}

.ml-rail .bdc-mini {
    display: flex;
}

/* ==========
     card
   ========== */

/* ======================
     list of websites
   ====================== */

/* Catches a click anywhere outside the list, which closes it */
.bdc-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1;
}

/* Above the card, as wide as the sidebar's content */
.bdc-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    left: 0;
    z-index: 2;
    max-height: min(420px, calc(100vh - 160px));
    max-height: min(420px, calc(100dvh - 160px));
    /* The scrollbar keeps its room on the right, so the rows sit as far from either side (rules/UI.md, R43); touch
       screens draw no scrollbar room and take the even padding back (below) */
    padding: 8px 0 8px 12px;
    scrollbar-gutter: stable;
    border: 1px solid var(--app-line);
    border-radius: 18px;
    overflow-y: auto;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-menu);
    transform-origin: bottom center;
    animation: bdc-panel-in 0.2s var(--app-ease-out);
}

.bdc-panel::-webkit-scrollbar-track {
    margin: 12px 0;
}

/* Beside the narrow rail, which clips anything outside it, so the list is placed on the screen instead */
.ml-rail .bdc-panel {
    position: fixed;
    right: auto;
    bottom: 16px;
    left: calc(var(--ml-rail-width) + 12px);
    width: 300px;
    transform-origin: bottom left;
}

@keyframes bdc-panel-in {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.bdc-panel-title {
    margin: 0;
    padding: 8px 10px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--app-text-muted);
}

.bdc-panel-title:focus {
    outline: none;
}

.bdc-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bdc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 8px 10px;
    border-radius: 12px;
    color: var(--app-text);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.bdc-item:focus-visible {
    outline: 2px solid var(--app-accent);
    outline-offset: -2px;
}

@media (hover: hover) {
    .bdc-item:not(.bdc-item-skeleton):hover {
        background: var(--app-accent-soft);
        color: var(--app-text);
    }

    .bdc-item:hover .bdc-item-go {
        opacity: 1;
        transform: translateX(0);
    }
}

.bdc-avatar {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--app-gradient-brand);
    font-size: 15px;
    font-weight: 600;
    color: #FFFFFF;
}

.bdc-item-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bdc-item-name,
.bdc-item-sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bdc-item-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

.bdc-item-sub {
    font-size: 12px;
    line-height: 1.4;
    color: var(--app-text-muted);
}

/* Shows on hover that the website opens in a new tab */
.bdc-item-go {
    flex: none;
    font-size: 16px;
    color: var(--app-accent);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.2s ease, transform 0.2s var(--app-ease-out);
}

/* Touch screens have no hover, so the mark always shows there; their scrollbar takes no room */
@media (hover: none) {
    .bdc-item-go {
        opacity: 1;
        transform: none;
    }

    .bdc-panel {
        padding: 8px;
        scrollbar-gutter: auto;
    }
}

.bdc-avatar-skeleton {
    flex: none;
    border-radius: 12px;
}

.bdc-failed {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 4px 10px 10px;
}

.bdc-failed p {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--app-text-muted);
}

@media (prefers-reduced-motion: reduce) {
    .bdc-panel {
        animation: none;
    }

    .bdc-item-go {
        transition: none;
    }
}

/* ======================
     list of websites
   ====================== */

/* ==============
     responsive
   ============== */

/* The drawer (tablet and mobile) always shows the full card, even when the desktop sidebar is the rail, and its list
   opens above the card again */
@media (max-width: 1199.98px) {
    .ml-rail .bdc-card {
        display: block;
    }

    .ml-rail .bdc-mini {
        display: none;
    }

    .ml-rail .bdc-panel {
        position: absolute;
        right: 0;
        bottom: calc(100% + 8px);
        left: 0;
        width: auto;
        transform-origin: bottom center;
    }
}

/* ==============
     responsive
   ============== */
