/*
 * Boutons.
 * Variantes : primary, secondary, ghost, danger.
 * Tailles : default (40px), small (32px), large (48px).
 */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: 40px;
    padding: 0 var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
    text-decoration: none;
    user-select: none;
}

.btn:disabled,
.btn[aria-disabled='true'] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn__icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke-width: 2.5;
}

/* ============================================================
   Variantes
   ============================================================ */

.btn--primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn--primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn--secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.btn--secondary:hover {
    background: var(--surface-alt);
    border-color: var(--border-strong);
}

.btn--ghost {
    background: transparent;
    color: var(--accent);
}

.btn--ghost:hover {
    background: var(--accent-soft);
}

.btn--danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--border);
}

.btn--danger:hover {
    background: var(--danger-soft);
    border-color: var(--danger-soft);
}

/* ============================================================
   Tailles
   ============================================================ */

.btn--small {
    height: 32px;
    padding: 0 var(--space-3);
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn--small .btn__icon { width: 14px; height: 14px; }

.btn--large {
    height: 48px;
    padding: 0 var(--space-5);
    font-size: 15px;
}

.btn--large .btn__icon { width: 18px; height: 18px; }

/* ============================================================
   Modifiers
   ============================================================ */

.btn--block {
    width: 100%;
}

.btn--dashed {
    border-style: dashed;
    border-color: var(--border-strong);
    background: transparent;
    color: var(--text-muted);
}

.btn--dashed:hover {
    background: var(--surface-alt);
    color: var(--text);
}

/* Bouton circulaire icône seule (pour navigation header, fermeture, etc.) */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
    border: 0;
}

.btn-icon:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.2;
}

/* ============================================================
   Segmented control (filtres période, sélecteur de métrique)
   ============================================================ */

.segmented {
    display: inline-flex;
    background: var(--surface-alt);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 2px;
}

.segmented__btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: 0;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.segmented__btn:hover {
    color: var(--text);
}

.segmented__btn--active {
    background: var(--surface);
    color: var(--accent-text);
    box-shadow: var(--shadow);
}
