/* =========================================================
   FetchCustomersCards - refined
   ========================================================= */

.customers-cards-page {
    display: flex;
    flex-direction: column;
    gap: var(--upf-space-4);
}

/* ---------- Header ---------- */
.customers-cards-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--upf-space-4);
    flex-wrap: wrap;
}

.customers-cards-header-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.customers-cards-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--upf-text-primary);
    line-height: 1.2;
}

.customers-cards-subtitle {
    font-size: 0.88rem;
    color: var(--upf-text-secondary);
    line-height: 1.45;
    max-width: 720px;
}

.customers-cards-badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--upf-color-surface);
    color: var(--upf-text-primary);
    border: 1px solid var(--upf-color-border);
    font-size: 0.78rem;
    font-weight: 800;
    box-shadow: var(--upf-shadow-xs);
}

/* ---------- Grid card ---------- */
.customer-card-outer {
    position: relative;
}

.customer-card {
    height: 100%;
    background: var(--upf-color-surface);
    border: 1px solid var(--upf-color-border);
    border-radius: var(--upf-radius-lg);
    box-shadow: var(--upf-shadow-xs);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    position: relative;
    overflow: hidden;
}

    .customer-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--upf-shadow-sm);
        border-color: rgba(0, 0, 0, 0.08);
    }

[data-bs-theme=dark] .customer-card::after {
    background: var(--upf-primary);
}

    .customer-card::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 4px;
        background: var(--upf-dark);
        opacity: 0.95;
    }

/* ---------- Nav area (clickable header + content) ---------- */
.customer-card-nav-area {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1 1 auto;
    min-width: 0;
}

/* ---------- Card Header ---------- */
.customer-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.customer-card-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

/* ---------- Avatar ---------- */
.customer-card-avatar {
    flex: 0 0 auto;
}

/* ---------- Name ---------- */
.customer-card-name-wrap {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.customer-card-name {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--upf-text-primary);
    line-height: 1.2;
    word-break: break-word;
}

.customer-card-age {
    font-size: 0.76rem;
    color: var(--upf-text-secondary);
    font-weight: 600;
}

/* ---------- Content ---------- */
/* Layout a due colonne: info a sinistra (flex:1), tag a destra (colonna fissa) */
.customer-card-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    flex: 1 1 auto;
}

/* Colonna sinistra: dettagli cliente */
.customer-card-info {
    flex: 1;
    min-width: 0; /* evita overflow del testo */
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ---------- Details ---------- */
.customer-card-detail {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    align-items: start;
    column-gap: 10px;
    font-size: 0.82rem;
    color: var(--upf-text-secondary);
    line-height: 1.45;
    min-width: 0;
}

    .customer-card-detail i {
        font-size: 0.92rem;
        color: var(--upf-text-muted);
        margin-top: 2px;
    }

    .customer-card-detail span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .customer-card-detail.is-multiline span {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

/* ---------- Footer ---------- */
.customer-card-footer {
    padding-top: 12px;
    border-top: 1px solid var(--upf-color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.customer-card-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--upf-text-primary);
}

    .customer-card-footer-link:hover {
        color: var(--upf-dark);
    }

/* ---------- External action (nel footer, hover-only) ---------- */
.customer-card-ext-btn-footer {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--upf-color-border);
    border-radius: 8px;
    color: var(--upf-text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: opacity 0.18s ease, background-color 0.15s ease, color 0.15s ease;
}

.customer-card:hover .customer-card-ext-btn-footer {
    opacity: 1;
}

.customer-card-ext-btn-footer:hover {
    background: var(--upf-primary-soft);
    color: var(--upf-primary);
}

@media (max-width: 575.98px) {
    .customer-card-ext-btn-footer {
        opacity: 1;
    }
}

/* ---------- Empty ---------- */
.customers-empty-state {
    background: var(--upf-color-surface);
    border: 1px solid var(--upf-color-border);
    border-radius: var(--upf-radius-lg);
    box-shadow: var(--upf-shadow-xs);
    padding: 48px 20px;
    text-align: center;
}

.customers-empty-icon {
    font-size: 2rem;
    color: var(--upf-text-muted);
    margin-bottom: 12px;
}

.customers-empty-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--upf-text-primary);
    margin-bottom: 6px;
}

.customers-empty-text {
    font-size: 0.9rem;
    color: var(--upf-text-secondary);
    line-height: 1.45;
}

/* ---------- Tag badges ---------- */
/* Colonna destra: badge impilati verticalmente, allineati a destra */
.customer-card-tags {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 120px;
    max-width: 140px;
    align-self: flex-start;
    flex-shrink: 0;
}

.tag-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.5;
}

/* Overflow pill (+N) — neutral grey, shows hidden tag names on hover via title */
.tag-overflow {
    background-color: #9e9e9e;
    color: #fff;
    cursor: default;
}

/* ---------- Responsive ---------- */
@media (max-width: 575.98px) {
    .customer-card {
        padding: 14px 14px 16px;
    }

    .customer-card-ext-btn {
        opacity: 1;
    }
}
