/**
 * Card Sort Shared — Smart Pill Dropdown v1.0.0
 *
 * Styles for the sort dropdown pill + panel used by CLO, LOF, SOA.
 * Uses cs- prefix to avoid collisions with consumer plugin styles.
 */

/* ─── Wrapper ─────────────────────────────────────────────────── */
.cs-sort-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    z-index: 50;
}

/* ─── Pill Button ─────────────────────────────────────────────── */
.cs-sort-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1.5px solid #e0e7ee;
    border-radius: 100px;
    background: #fff;
    color: #374151;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    line-height: 1.4;
    -webkit-user-select: none;
    user-select: none;
}

.cs-sort-pill:hover {
    background: #f5f7f9;
    border-color: #c4cdd5;
}

.cs-sort-pill.cs-pill-open {
    border-color: #00C896;
    background: #f0fdf9;
    box-shadow: 0 0 0 3px rgba(0, 200, 150, 0.1);
}

.cs-pill-icon {
    font-size: 0.85rem;
    line-height: 1;
}

.cs-pill-label {
    font-size: 0.8rem;
    font-weight: 600;
}

.cs-pill-caret {
    font-size: 0.7rem;
    color: #9ca3af;
    transition: transform 0.2s;
    line-height: 1;
}

.cs-pill-open .cs-pill-caret {
    transform: rotate(180deg);
}

/* ─── Dropdown Panel ──────────────────────────────────────────── */
.cs-sort-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 4px;
    z-index: 100;
    overflow: hidden;
}

/* ─── Sort Option ─────────────────────────────────────────────── */
.cs-sort-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #4b5563;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: left;
    line-height: 1.4;
}

.cs-sort-option:hover {
    background: #f5f7f9;
    color: #111827;
}

/* Active option */
.cs-sort-option.cs-active {
    color: #059669;
    font-weight: 700;
    background: #ecfdf5;
}

/* Dot indicator — only visible on active option */
.cs-option-dot {
    display: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00C896;
    flex-shrink: 0;
}

.cs-sort-option.cs-active .cs-option-dot {
    display: block;
}

.cs-option-icon {
    font-size: 0.8rem;
    line-height: 1;
    flex-shrink: 0;
}

.cs-option-label {
    flex: 1;
}

/* ─── Mobile Responsive ───────────────────────────────────────── */
@media (max-width: 480px) {
    .cs-sort-pill {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .cs-pill-label {
        font-size: 0.75rem;
    }

    .cs-sort-panel {
        min-width: 160px;
    }

    .cs-sort-option {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
}

/* ─── FLIP Animation Support ──────────────────────────────────── */
/* Cards being animated get will-change for GPU compositing */
[data-sort-original-index] {
    will-change: auto;
}
