/**
 * GlobalCSS — Segment Controls
 * Toggle buttons estilo Apple: contenedor con fondo sutil + botones que "flotan".
 * Ref: design-style-guide.md §6 Segmented control
 */

/* ── Contenedor ── */

.gs-segment {
    display: inline-flex;
    gap: 1px;
    padding: 3px;
    background: var(--color-bg-surface, #f1f1f4);
    border-radius: 8px;
    flex-shrink: 1;
    min-width: 0;
}

/* ── Botón de segmento ── */

.gs-segment-btn {
    position: relative;
    padding: var(--space-sm) var(--space-md);
    margin: 0;
    border: none;
    background: none;
    color: var(--color-text-secondary, #6e6e73);
    font-size: var(--gs-font-caption);
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.005em;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    transition:
        color 0.18s ease,
        background-color 0.22s cubic-bezier(0, 0, 0.2, 1),
        box-shadow 0.22s cubic-bezier(0, 0, 0.2, 1);
}

.gs-segment-btn:hover {
    color: var(--color-text, #1d1d1f);
}

.gs-segment-btn.active {
    background: var(--color-bg-elevated, #fff);
    color: var(--color-text, #1d1d1f);
    font-weight: 600;
    box-shadow:
        0 0.5px 1px rgba(0,0,0,0.1),
        0 1px 4px rgba(0,0,0,0.06);
}

.gs-segment-btn:active {
    opacity: 0.7;
    transition-duration: 0.06s;
}

.gs-segment-btn:focus-visible {
    outline: 3px solid var(--color-primary-subtle, rgba(0,122,255,0.35));
    outline-offset: 1px;
}

/* ── Toggle con checkbox (labels como botón) ── */

.gs-toggle-pill {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    margin: 0;
    border-radius: 6px;
    font-size: var(--gs-font-caption);
    font-weight: 500;
    color: var(--color-text-secondary, #6e6e73);
    cursor: pointer;
    user-select: none;
    transition:
        color 0.18s ease,
        background-color 0.22s cubic-bezier(0, 0, 0.2, 1),
        box-shadow 0.22s cubic-bezier(0, 0, 0.2, 1);
}

.gs-toggle-pill:hover {
    color: var(--color-text, #1d1d1f);
}

.gs-toggle-pill input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.gs-toggle-pill:has(input:checked) {
    background: var(--color-bg-elevated, #fff);
    color: var(--color-text, #1d1d1f);
    box-shadow:
        0 0.5px 1px rgba(0,0,0,0.1),
        0 1px 4px rgba(0,0,0,0.06);
}

/* ── Color dot indicator ── */

.gs-toggle-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: opacity 0.2s ease,
                transform 0.2s ease;
}

.gs-toggle-pill input:not(:checked) ~ .gs-toggle-dot {
    opacity: 0.2;
    transform: scale(0.7);
}

/* ── Responsive: scroll horizontal en mobile ── */

@media (max-width: 768px) {
    .gs-segment {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .gs-segment::-webkit-scrollbar {
        display: none;
    }
}
