/* ═══════════════════════════════════════════════════════════════════════════
   Device Chooser — cascading Merk > Serie > Model dropdown
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Trigger button in nav bar ────────────────────────────────────────────── */
.dc-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 15px;
    height: 100%;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--c-accent);
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--t-fast);
    font-family: inherit;
}

.dc-trigger:hover,
.dc-trigger.is-active {
    background: var(--c-accent-bg);
}

.dc-trigger__icon {
    flex-shrink: 0;
}

.dc-trigger .chevron--down {
    transition: transform var(--t-base);
}

.dc-trigger.is-active .chevron--down {
    transform: rotate(180deg);
}

/* ── Panel ────────────────────────────────────────────────────────────────── */
.dc-panel {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--c-border);
    border-top: 2px solid var(--c-accent);
    box-shadow: var(--shadow-lg);
    z-index: 900;
    display: none;
}

.dc-panel.is-open {
    display: block;
}

/* ── Header (breadcrumb + view button) ────────────────────────────────────── */
.dc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--c-border);
    background: var(--c-bg-subtle);
    min-height: 44px;
}

.dc-breadcrumb {
    font-size: var(--text-sm);
    color: var(--c-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dc-breadcrumb span {
    color: var(--c-text);
    font-weight: 500;
}

.dc-breadcrumb__sep {
    color: var(--c-text-faint) !important;
    font-weight: 400 !important;
}

.dc-view-btn {
    display: none;
    padding: 8px 16px;
    background: var(--c-accent);
    color: #fff !important;
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--r-md);
    text-decoration: none;
    transition: background var(--t-fast);
    white-space: nowrap;
}

.dc-view-btn:hover {
    background: var(--c-accent-dark);
}

.dc-view-btn.is-visible {
    display: inline-block;
}

/* ── Columns container ────────────────────────────────────────────────────── */
.dc-columns {
    display: flex;
    min-height: 320px;
    max-height: 420px;
}

/* ── Single column ────────────────────────────────────────────────────────── */
.dc-col {
    flex: 1;
    min-width: 0;
    border-right: 1px solid var(--c-border);
    display: flex;
    flex-direction: column;
}

.dc-col:last-child {
    border-right: none;
}

/* Hide series/model until brand is picked */
.dc-col:nth-child(2),
.dc-col:nth-child(3) {
    display: none;
}

.dc-col.is-visible {
    display: flex !important;
}

.dc-col:first-child {
    display: flex !important; /* Brand always visible */
}

.dc-col__title {
    padding: 10px 16px;
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--c-text-faint);
    border-bottom: 1px solid var(--c-border);
    background: var(--c-bg);
    flex-shrink: 0;
}

/* ── List ─────────────────────────────────────────────────────────────────── */
.dc-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    overflow-y: auto;
    flex: 1;
}

/* ── Item ─────────────────────────────────────────────────────────────────── */
.dc-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--c-text);
    transition: background var(--t-fast), color var(--t-fast);
}

.dc-item:hover {
    background: var(--c-bg-subtle);
    color: var(--c-accent);
}

.dc-item.is-active {
    background: var(--c-accent-bg);
    color: var(--c-accent);
    font-weight: 600;
}

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

.dc-item__count {
    font-size: var(--text-xs);
    color: var(--c-text-faint);
    flex-shrink: 0;
}

.dc-item__arrow {
    flex-shrink: 0;
    color: var(--c-text-faint);
}

.dc-item:hover .dc-item__arrow,
.dc-item.is-active .dc-item__arrow {
    color: var(--c-accent);
}

/* ── Loading / empty ──────────────────────────────────────────────────────── */
.dc-loading,
.dc-empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--c-text-faint);
    font-size: var(--text-sm);
    list-style: none;
}

/* ── Prevent body scroll when device chooser is open on mobile ────────────── */
body.dc-mobile-open {
    overflow: hidden;
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .dc-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border: none;
        border-radius: 0;
        border-top: 3px solid var(--c-accent);
        z-index: 9999;
        display: none;
        flex-direction: column;
        background: #fff;
    }

    .dc-panel.is-open {
        display: flex;
    }

    .dc-columns {
        flex-direction: column;
        flex: 1;
        overflow-y: auto;
        max-height: none;
    }

    .dc-col {
        border-right: none;
        border-bottom: 1px solid var(--c-border);
    }

    .dc-col:nth-child(2),
    .dc-col:nth-child(3) {
        display: none;
    }

    .dc-col.is-visible {
        display: flex !important;
    }

    .dc-col:first-child {
        display: flex !important;
    }

    .dc-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Close button for mobile */
    .dc-close {
        display: flex;
    }
}

@media (min-width: 769px) {
    .dc-close {
        display: none;
    }
}

.dc-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--c-text-muted);
    transition: color var(--t-fast);
}

.dc-close:hover {
    color: var(--c-text);
}
