/* =========================================================
   DROPDOWN
   assets/css/components/dropdown.css
   =========================================================
   Shared custom dropdown ("tool-dropdown-card") — the SINGLE source
   of truth for the dropdown UI across the project (like tabs.css is
   for tabs). Used by the palette + typography tools and the Design
   Language Studio.

   Moved here verbatim from components/controls.css so every consumer
   loads ONE dropdown definition. A sensible default padding/gap is
   baked in so the component works standalone; each tool's small
   padding / list-open-direction overrides still layer on top from
   its own CSS (palette-builder.css, typography-builder.css,
   tool-shell.css responsive).

   Standard class names:
     .tool-dropdown-card      container (combobox)
     .tool-dropdown-top       icon + label row
     .tool-dropdown-bottom    selected value + chevron row
     .tool-dropdown-list      options popover
     .tool-dropdown-opt       option button
   ========================================================= */

.tool-dropdown-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--border-primary);
    border-radius: 0.75rem;
    background: var(--surface-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
    box-sizing: border-box;
}

.tool-dropdown-card:hover {
    background: var(--surface-hover);
}

.tool-dropdown-top {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    font-weight: var(--font-medium);
}

.tool-dropdown-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.tool-dropdown-icon svg {
    width: 16px;
    height: 16px;
}

.tool-dropdown-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
    font-weight: var(--font-semi-bold);
    color: var(--text-primary);
}

.tool-dropdown-value-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    overflow: hidden;
}

.tool-dropdown-value-left span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-dropdown-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.tool-dropdown-chevron {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.tool-dropdown-chevron svg {
    display: block;
    width: 16px;
    height: 16px;
}

.tool-dropdown-chevron--open svg {
    transform: rotate(180deg);
    transition: transform 0.15s ease;
}

/* Default: opens upward — palette sticky bar sits at the bottom of
   the viewport, so the list must clear above it. Typography sidebar
   overrides this to top: calc(100% + 6px) / bottom: auto. */
.tool-dropdown-list {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--surface-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
    z-index: 300;
    overflow: hidden;
    min-width: 160px;
}

.tool-dropdown-opt {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.5rem 0.85rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-primary);
    font: inherit;
    font-size: var(--text-sm);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: background 0.1s;
    box-sizing: border-box;
}

.tool-dropdown-opt:last-child {
    border-bottom: none;
}

.tool-dropdown-opt:hover {
    background: var(--surface-hover);
}

.tool-dropdown-opt[aria-selected="true"] {
    background: var(--surface-secondary);
    font-weight: 600;
}

.tool-dropdown-opt-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
