/* =========================================================
   CONTROLS
   assets/css/components/controls.css
   =========================================================
   Shared control panel components used across tool pages.

   Includes:
     Section wrapper  — .tool-section, .tool-section-label
     Dropdown card    — .tool-dropdown-* component family

   Loaded by:
     palette-builder.php
     typography-builder.php

   Tool pages override padding, min-width, and list
   direction for their specific context — see each tool's
   CSS file for those overrides.
   ========================================================= */


/* =========================================================
   SECTION WRAPPER
   ========================================================= */

.tool-section {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-primary);
}

.tool-section-label {
    font-size: 0.75rem;
    font-weight: var(--font-bold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}


/* =========================================================
   DROPDOWN CARD
   =========================================================
   Base structure shared across palette-builder and
   typography-builder. Each tool overrides padding, gap,
   min-width, and list-open direction for its context.
   ========================================================= */

.tool-dropdown-card {
    position: relative;
    border: 1px solid var(--border-primary);
    border-radius: 0.75rem;
    background: var(--surface-primary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    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;
}
